UNPKG

@fraserdarwent/xapi-node

Version:

This project is made possible to get data from Forex market, execute market or limit order with NodeJS/JS through WebSocket connection

66 lines (65 loc) 7.2 kB
import { CALENDAR_RECORD, CMD_FIELD, IB_RECORD, NEWS_TOPIC_RECORD, PERIOD_FIELD, STEP_RULE_RECORD, SYMBOL_RECORD, Time, TRADE_RECORD, TRADE_TRANS_INFO, TRADING_HOURS_RECORD } from '../..'; import { TradeStatus, Transaction } from '../../interface/Interface'; import { getChartRequestResponse, getCommissionDefResponse, getCurrentUserDataResponse, getMarginLevelResponse, getMarginTradeResponse, getProfitCalculationResponse, getServerTimeResponse, getTickPricesResponse, getVersionResponse, tradeTransactionResponse, tradeTransactionStatusResponse } from '../../interface/Response'; import { SocketConnection } from './SocketConnection'; import { XAPI } from '../XAPI'; import { TRADE_TRANS_INFO_MODIFY } from "../../interface/Definitions"; interface SocketListen<T> { (data: T, time: Time, transaction: Transaction<null, null>): void; } export declare class Socket extends SocketConnection { constructor(XAPI: XAPI, password: string); listen: { getAllSymbols: (callBack: SocketListen<SYMBOL_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getCalendar: (callBack: SocketListen<CALENDAR_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getChartLastRequest: (callBack: SocketListen<getChartRequestResponse>, key?: string | null) => import("../..").ListenerChild; getChartRangeRequest: (callBack: SocketListen<getChartRequestResponse>, key?: string | null) => import("../..").ListenerChild; getCommissionDef: (callBack: SocketListen<getCommissionDefResponse>, key?: string | null) => import("../..").ListenerChild; getCurrentUserData: (callBack: SocketListen<getCurrentUserDataResponse>, key?: string | null) => import("../..").ListenerChild; getIbsHistory: (callBack: SocketListen<IB_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getMarginLevel: (callBack: SocketListen<getMarginLevelResponse>, key?: string | null) => import("../..").ListenerChild; getMarginTrade: (callBack: SocketListen<getMarginTradeResponse>, key?: string | null) => import("../..").ListenerChild; getNews: (callBack: SocketListen<NEWS_TOPIC_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getProfitCalculation: (callBack: SocketListen<getProfitCalculationResponse>, key?: string | null) => import("../..").ListenerChild; getServerTime: (callBack: SocketListen<getServerTimeResponse>, key?: string | null) => import("../..").ListenerChild; getStepRules: (callBack: SocketListen<STEP_RULE_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getSymbol: (callBack: SocketListen<SYMBOL_RECORD>, key?: string | null) => import("../..").ListenerChild; getTickPrices: (callBack: SocketListen<getTickPricesResponse>, key?: string | null) => import("../..").ListenerChild; getTradeRecords: (callBack: SocketListen<TRADE_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getTrades: (callBack: SocketListen<TRADE_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getTradesHistory: (callBack: SocketListen<TRADE_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getTradingHours: (callBack: SocketListen<TRADING_HOURS_RECORD[]>, key?: string | null) => import("../..").ListenerChild; getVersion: (callBack: SocketListen<getVersionResponse>, key?: string | null) => import("../..").ListenerChild; tradeTransaction: (callBack: SocketListen<tradeTransactionResponse>, key?: string | null) => import("../..").ListenerChild; tradeTransactionStatus: (callBack: SocketListen<tradeTransactionStatusResponse>, key?: string | null) => import("../..").ListenerChild; ping: (callBack: SocketListen<any>, key?: string | null) => import("../..").ListenerChild; login: (callBack: SocketListen<{ streamSessionId: string; }>, key?: string | null) => import("../..").ListenerChild; }; send: { getAllSymbols: () => Promise<import("../../interface/Interface").TransactionResolveSocket<SYMBOL_RECORD[]>>; getCalendar: () => Promise<import("../../interface/Interface").TransactionResolveSocket<CALENDAR_RECORD[]>>; getChartLastRequest: (period: PERIOD_FIELD, start: number, symbol: string) => Promise<import("../../interface/Interface").TransactionResolveSocket<getChartRequestResponse>>; getChartRangeRequest: (end: number, period: PERIOD_FIELD, start: number, symbol: string, ticks?: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<getChartRequestResponse>>; getCommissionDef: (symbol: string, volume: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<getCommissionDefResponse>>; getCurrentUserData: () => Promise<import("../../interface/Interface").TransactionResolveSocket<getCurrentUserDataResponse>>; getIbsHistory: (start: number, end: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<IB_RECORD[]>>; getMarginLevel: () => Promise<import("../../interface/Interface").TransactionResolveSocket<getMarginLevelResponse>>; getMarginTrade: (symbol: string, volume: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<getMarginTradeResponse>>; getNews: (start: number, end: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<NEWS_TOPIC_RECORD[]>>; getProfitCalculation: (closePrice: number, cmd: CMD_FIELD, openPrice: number, symbol: string, volume: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<getProfitCalculationResponse>>; getServerTime: () => Promise<import("../../interface/Interface").TransactionResolveSocket<getServerTimeResponse>>; getStepRules: () => Promise<import("../../interface/Interface").TransactionResolveSocket<STEP_RULE_RECORD[]>>; getSymbol: (symbol: string) => Promise<import("../../interface/Interface").TransactionResolveSocket<SYMBOL_RECORD>>; getTickPrices: (symbols: string[], timestamp?: number, level?: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<getTickPricesResponse>>; getTradeRecords: (orders: number[]) => Promise<import("../../interface/Interface").TransactionResolveSocket<TRADE_RECORD[]>>; getTrades: (openedOnly?: boolean) => Promise<import("../../interface/Interface").TransactionResolveSocket<TRADE_RECORD[]>>; getTradesHistory: (start: number, end: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<TRADE_RECORD[]>>; getTradingHours: (symbols: string[]) => Promise<import("../../interface/Interface").TransactionResolveSocket<TRADING_HOURS_RECORD[]>>; getVersion: () => Promise<import("../../interface/Interface").TransactionResolveSocket<getVersionResponse>>; tradeTransaction: (tradeTransInfo: TRADE_TRANS_INFO | TRADE_TRANS_INFO_MODIFY) => Promise<TradeStatus>; tradeTransactionStatus: (order: number) => Promise<import("../../interface/Interface").TransactionResolveSocket<tradeTransactionStatusResponse>>; }; } export {};