UNPKG

myfxbook-api-client

Version:
72 lines (71 loc) 2.67 kB
import * as Myfxbook from './myfxbook-api.interfaces'; declare class MyfxbookApi { private readonly email; private readonly password; private session; private getLoginDataPromise; constructor({ email, password }: Myfxbook.ApiConstructor); /** Get session id (cached value is returned upon subsequent or parallel requests)*/ private getSessionId; private makeApiCall; /** * Fetches login data object */ private login; /** * Logs out from current session */ private logout; /** * Get list of all trading accounts */ getMyAccounts(): Promise<Myfxbook.MyAccounts>; /** * Get list of all watched accounts */ getWatchedAccounts(): Promise<Myfxbook.WatchedAccounts>; /** * Get all open orders for a given account * @param id id of a trading account */ getOpenOrders(id: number | string): Promise<Myfxbook.OpenOrders>; /** * Get all open trades for a given account * @param id id of a trading account */ getOpenTrades(id: number | string): Promise<Myfxbook.OpenTrades>; /** * Get history of all trades for a given account * @param id id of a trading account */ getHistory(id: number | string): Promise<Myfxbook.TradeHistory>; /** * Get daily breakdown of all gains for a given account within time range * @param id id of a trading account * @param start start date, format : yyyy-MM-dd * @param end end date, format : yyyy-MM-dd */ getDailyGain(id: number | string, start: string, end: string): Promise<Myfxbook.DailyGain>; /** * Get total gain for a given account within time range * @param id id of a trading account * @param start start date, format : yyyy-MM-dd * @param end end date, format : yyyy-MM-dd */ getGain(id: number | string, start: string, end: string): Promise<Myfxbook.Gain>; /** Get Myfxbook Community Outlook data (https://www.myfxbook.com/community/outlook) */ getCommunityOutlook(): Promise<Myfxbook.OutlookData>; /** * Get community outlook data broken down by a country for provided symbol * @param symbol a trading instrument (currency pair) */ getCommunityOutlookByCountry(symbol: string): Promise<Myfxbook.OutlookDataByCountry>; /** * Get daily breakdown of all account data within time range * @param id id of a trading account * @param start start date, format : yyyy-MM-dd * @param end end date, format : yyyy-MM-dd */ getDailyData(id: number | string, start: string, end: string): Promise<Myfxbook.DailyData>; } export default MyfxbookApi;