UNPKG

@exchanges/binance

Version:

Exchange provider for Binance API

190 lines (189 loc) 5.36 kB
import { usdtM } from '../../../info'; export declare type UserDataResponse = ListenKeyExpiredResponse | MarginCallResponse | AccountUpdateResponse | OrderTradeUpdateResponse | AccountConfigUpdateResponse; export declare type UserDataResponseRaw = ListenKeyExpiredResponseRaw | MarginCallResponseRaw | AccountUpdateResponseRaw | OrderTradeUpdateResponseRaw | AccountConfigUpdateResponseRaw; export interface ListenKeyExpiredResponse { eventType: 'listenKeyExpired'; eventTime: Date; } export interface ListenKeyExpiredResponseRaw { e: 'listenKeyExpired'; E: number; } export interface MarginCallResponse { eventType: 'MARGIN_CALL'; eventTime: Date; crossWalletBalance: number; positionsOfMarginCall: { symbol: string; positionSide: usdtM.PositionSide; positionAmount: number; marginType: usdtM.MarginType; isolatedWallet: number; markPrice: number; unrealizedPnL: number; maintenanceMarginRequired: number; }[]; } export interface MarginCallResponseRaw { e: 'MARGIN_CALL'; E: number; cw: string; p: { s: string; ps: usdtM.PositionSide; pa: string; mt: usdtM.MarginType; iw: string; mp: string; up: string; mm: string; }[]; } export interface AccountUpdateResponse { eventType: 'ACCOUNT_UPDATE'; eventTime: Date; transactionTime: Date; updateData: { eventReasonType: string; balances: { asset: string; walletBalance: number; crossWalletBalance: number; }[]; positions: { symbol: string; positionAmount: number; entryPrice: number; preFeeAccumulatedRealized: number; unrealizedPnL: number; marginType: usdtM.MarginType; isolatedWallet: number; positionSide: usdtM.PositionSide; }[]; }; } export interface AccountUpdateResponseRaw { e: 'ACCOUNT_UPDATE'; E: number; T: number; a: { m: string; B: { a: string; wb: string; cw: string; }[]; P: { s: string; pa: string; ep: string; cr: string; up: string; mt: usdtM.MarginType; iw: string; ps: usdtM.PositionSide; }[]; }; } export interface OrderTradeUpdateResponse { eventType: 'ORDER_TRADE_UPDATE'; eventTime: Date; transactionTime: Date; symbol: string; clientOrderId: string; side: usdtM.OrderSide; orderType: usdtM.OrderType; timeInForce: usdtM.TimeInForce; originalQuantity: number; originalPrice: number; averagePrice: number; stopPrice: number; executionType: usdtM.ExecutionType; orderStatus: usdtM.OrderStatus; orderId: number; orderLastFilledQuantity: number; orderFilledAccumulatedQuantity: number; lastFilledPrice: number; commissionAsset: string; commissionAmount: number; orderTradeTime: Date; tradeId: number; bidsNotional: number; asksNotional: number; isBuyerMaker: boolean; isReduceOnly: boolean; stopPriceWorkingType: usdtM.WorkingType; originalOrderType: usdtM.OrderType; positionSide: usdtM.PositionSide; isConditionalOrder: boolean; activationPrice: number; callbackRate: number; realizedProfit: number; } export interface OrderTradeUpdateResponseRaw { e: 'ORDER_TRADE_UPDATE'; E: number; T: number; o: { s: string; c: string; S: usdtM.OrderSide; o: usdtM.OrderType; f: usdtM.TimeInForce; q: string; p: string; ap: string; sp: string; x: usdtM.ExecutionType; X: usdtM.OrderStatus; i: number; l: string; z: string; L: string; N: string; n: string; T: number; t: number; b: string; a: string; m: boolean; R: boolean; wt: usdtM.WorkingType; ot: usdtM.OrderType; ps: usdtM.PositionSide; cp: boolean; AP: string; cr: string; rp: string; }; } export interface AccountConfigUpdateResponse { eventType: 'ACCOUNT_CONFIG_UPDATE'; eventTime: Date; transactionTime: Date; accountTradingPairConfig?: { symbol: string; leverage: number; }; accountConfig?: { multiAssetsMode: boolean; }; } export interface AccountConfigUpdateResponseRaw { e: 'ACCOUNT_CONFIG_UPDATE'; E: number; T: number; ac: { s: string; l: number; }; ai: { j: boolean; }; } export declare function parseListenKeyExpired(data: ListenKeyExpiredResponseRaw): ListenKeyExpiredResponse; export declare function parseMarginCall(data: MarginCallResponseRaw): MarginCallResponse; export declare function parseAccountUpdate(data: AccountUpdateResponseRaw): AccountUpdateResponse; export declare function parseOrderTradeUpdate(data: OrderTradeUpdateResponseRaw): OrderTradeUpdateResponse; export declare function parseAccountConfigUpdate(data: AccountConfigUpdateResponseRaw): AccountConfigUpdateResponse; export declare function parseUserData(data: UserDataResponseRaw): UserDataResponse;