ccxt 4.2.71 → 4.2.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +195 -16
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +149 -2
- package/dist/cjs/src/pro/bingx.js +29 -6
- package/dist/cjs/src/pro/hitbtc.js +16 -7
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ascendex.d.ts +5 -1
- package/js/src/ascendex.js +149 -2
- package/js/src/base/Exchange.d.ts +56 -56
- package/js/src/base/types.d.ts +10 -0
- package/js/src/binance.d.ts +1 -1
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitrue.d.ts +3 -3
- package/js/src/cex.d.ts +1 -1
- package/js/src/gate.d.ts +1 -1
- package/js/src/htx.d.ts +1 -1
- package/js/src/idex.d.ts +1 -1
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/poloniexfutures.d.ts +2 -2
- package/js/src/pro/bingx.d.ts +1 -0
- package/js/src/pro/bingx.js +29 -6
- package/js/src/pro/bitvavo.d.ts +8 -8
- package/js/src/pro/bybit.d.ts +1 -1
- package/js/src/pro/cex.d.ts +5 -5
- package/js/src/pro/coinbase.d.ts +2 -2
- package/js/src/pro/hitbtc.js +16 -7
- package/js/src/pro/poloniex.d.ts +3 -3
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Str, Num, MarketInterface, CurrencyInterface, Account, MarginModes, MarketType, Leverage, Leverages } from './types.js';
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Str, Num, MarketInterface, CurrencyInterface, Account, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices } from './types.js';
|
|
7
7
|
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation, FundingHistory, Greeks, Leverage, Leverages } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
@@ -111,7 +111,7 @@ export default class Exchange {
|
|
|
111
111
|
last_request_body: any;
|
|
112
112
|
last_request_url: any;
|
|
113
113
|
last_request_path: any;
|
|
114
|
-
id:
|
|
114
|
+
id: Str;
|
|
115
115
|
markets: Dictionary<any>;
|
|
116
116
|
has: Dictionary<boolean | 'emulated'>;
|
|
117
117
|
status: any;
|
|
@@ -151,14 +151,14 @@ export default class Exchange {
|
|
|
151
151
|
accounts: any;
|
|
152
152
|
accountsById: any;
|
|
153
153
|
commonCurrencies: any;
|
|
154
|
-
hostname:
|
|
154
|
+
hostname: Str;
|
|
155
155
|
precisionMode: number;
|
|
156
156
|
paddingMode: any;
|
|
157
157
|
exceptions: {};
|
|
158
158
|
timeframes: Dictionary<number | string>;
|
|
159
|
-
version:
|
|
159
|
+
version: Str;
|
|
160
160
|
marketsByAltname: any;
|
|
161
|
-
name:
|
|
161
|
+
name: Str;
|
|
162
162
|
lastRestRequestTimestamp: number;
|
|
163
163
|
targetAccount: any;
|
|
164
164
|
stablePairs: {};
|
|
@@ -634,8 +634,8 @@ export default class Exchange {
|
|
|
634
634
|
handleDelta(bookside: any, delta: any): void;
|
|
635
635
|
getCacheIndex(orderbook: any, deltas: any): number;
|
|
636
636
|
findTimeframe(timeframe: any, timeframes?: any): string;
|
|
637
|
-
checkProxyUrlSettings(url?:
|
|
638
|
-
checkProxySettings(url?:
|
|
637
|
+
checkProxyUrlSettings(url?: Str, method?: Str, headers?: any, body?: any): any;
|
|
638
|
+
checkProxySettings(url?: Str, method?: Str, headers?: any, body?: any): any[];
|
|
639
639
|
checkWsProxySettings(): any[];
|
|
640
640
|
checkConflictingProxies(proxyAgentSet: any, proxyUrlSet: any): void;
|
|
641
641
|
findMessageHashes(client: any, element: string): string[];
|
|
@@ -686,7 +686,7 @@ export default class Exchange {
|
|
|
686
686
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
687
687
|
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
688
688
|
createDepositAddress(code: string, params?: {}): Promise<DepositAddressResponse>;
|
|
689
|
-
setLeverage(leverage: Int, symbol?:
|
|
689
|
+
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<{}>;
|
|
690
690
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
691
691
|
fetchLeverages(symbols?: string[], params?: {}): Promise<Leverages>;
|
|
692
692
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<{}>;
|
|
@@ -766,14 +766,14 @@ export default class Exchange {
|
|
|
766
766
|
convertOHLCVToTradingView(ohlcvs: any, timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): {};
|
|
767
767
|
fetchWebEndpoint(method: any, endpointMethod: any, returnAsJson: any, startRegex?: any, endRegex?: any): Promise<any>;
|
|
768
768
|
marketIds(symbols: any): any;
|
|
769
|
-
marketSymbols(symbols: any, type?:
|
|
769
|
+
marketSymbols(symbols: any, type?: Str, allowEmpty?: boolean, sameTypeOnly?: boolean, sameSubTypeOnly?: boolean): any;
|
|
770
770
|
marketCodes(codes: any): any;
|
|
771
771
|
parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
|
|
772
772
|
fetchL2OrderBook(symbol: string, limit?: Int, params?: {}): Promise<any>;
|
|
773
|
-
filterBySymbol(objects: any, symbol?:
|
|
773
|
+
filterBySymbol(objects: any, symbol?: Str): any;
|
|
774
774
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
775
|
-
networkCodeToId(networkCode: string, currencyCode?:
|
|
776
|
-
networkIdToCode(networkId: string, currencyCode?:
|
|
775
|
+
networkCodeToId(networkCode: string, currencyCode?: Str): string;
|
|
776
|
+
networkIdToCode(networkId: string, currencyCode?: Str): string;
|
|
777
777
|
handleNetworkCodeAndParams(params: any): any[];
|
|
778
778
|
defaultNetworkCode(currencyCode: string): any;
|
|
779
779
|
selectNetworkCodeFromUnifiedNetworks(currencyCode: any, networkCode: any, indexedNetworkEntries: any): any;
|
|
@@ -799,7 +799,7 @@ export default class Exchange {
|
|
|
799
799
|
handleParamInteger(params: object, paramName: string, defaultValue?: Int): [Int, object];
|
|
800
800
|
resolvePath(path: any, params: any): any[];
|
|
801
801
|
getListFromObjectValues(objects: any, key: IndexType): any[];
|
|
802
|
-
getSymbolsForMarketType(marketType?:
|
|
802
|
+
getSymbolsForMarketType(marketType?: Str, subType?: Str, symbolWithActiveStatus?: boolean, symbolWithUnknownStatus?: boolean): any[];
|
|
803
803
|
filterByArray(objects: any, key: IndexType, values?: any, indexed?: boolean): any;
|
|
804
804
|
fetch2(path: any, api?: any, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
|
|
805
805
|
request(path: any, api?: any, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
|
|
@@ -813,16 +813,16 @@ export default class Exchange {
|
|
|
813
813
|
editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
814
814
|
fetchPermissions(params?: {}): Promise<{}>;
|
|
815
815
|
fetchPosition(symbol: string, params?: {}): Promise<Position>;
|
|
816
|
-
watchPosition(symbol?:
|
|
816
|
+
watchPosition(symbol?: Str, params?: {}): Promise<Position>;
|
|
817
817
|
watchPositions(symbols?: string[], since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
818
818
|
watchPositionForSymbols(symbols?: string[], since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
819
819
|
fetchPositionsForSymbol(symbol: string, params?: {}): Promise<Position[]>;
|
|
820
820
|
fetchPositions(symbols?: string[], params?: {}): Promise<Position[]>;
|
|
821
821
|
fetchPositionsRisk(symbols?: string[], params?: {}): Promise<Position[]>;
|
|
822
822
|
fetchBidsAsks(symbols?: string[], params?: {}): Promise<Dictionary<Ticker>>;
|
|
823
|
-
fetchBorrowInterest(code?:
|
|
824
|
-
fetchLedger(code?:
|
|
825
|
-
fetchLedgerEntry(id: string, code?:
|
|
823
|
+
fetchBorrowInterest(code?: Str, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<BorrowInterest[]>;
|
|
824
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
825
|
+
fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<LedgerEntry>;
|
|
826
826
|
parseBidAsk(bidask: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): number[];
|
|
827
827
|
safeCurrency(currencyId: Str, currency?: Currency): CurrencyInterface;
|
|
828
828
|
safeMarket(marketId: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
|
|
@@ -862,9 +862,9 @@ export default class Exchange {
|
|
|
862
862
|
fetchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
863
863
|
fetchOrderBooks(symbols?: string[], limit?: Int, params?: {}): Promise<Dictionary<OrderBook>>;
|
|
864
864
|
watchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
865
|
-
fetchOrder(id: string, symbol?:
|
|
866
|
-
fetchOrderWs(id: string, symbol?:
|
|
867
|
-
fetchOrderStatus(id: string, symbol?:
|
|
865
|
+
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
866
|
+
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
867
|
+
fetchOrderStatus(id: string, symbol?: Str, params?: {}): Promise<string>;
|
|
868
868
|
fetchUnifiedOrder(order: any, params?: {}): Promise<Order>;
|
|
869
869
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
870
870
|
createTrailingAmountOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, trailingAmount?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
|
|
@@ -878,38 +878,38 @@ export default class Exchange {
|
|
|
878
878
|
createOrderWithTakeProfitAndStopLoss(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, takeProfit?: number, stopLoss?: number, params?: {}): Promise<Order>;
|
|
879
879
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
880
880
|
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
881
|
-
cancelOrder(id: string, symbol?:
|
|
882
|
-
cancelOrderWs(id: string, symbol?:
|
|
883
|
-
cancelOrdersWs(ids: string[], symbol?:
|
|
884
|
-
cancelAllOrders(symbol?:
|
|
885
|
-
cancelAllOrdersWs(symbol?:
|
|
881
|
+
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<{}>;
|
|
882
|
+
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<{}>;
|
|
883
|
+
cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<{}>;
|
|
884
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<{}>;
|
|
885
|
+
cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<{}>;
|
|
886
886
|
cancelUnifiedOrder(order: any, params?: {}): Promise<{}>;
|
|
887
|
-
fetchOrders(symbol?:
|
|
888
|
-
fetchOrdersWs(symbol?:
|
|
889
|
-
fetchOrderTrades(id: string, symbol?:
|
|
890
|
-
watchOrders(symbol?:
|
|
891
|
-
fetchOpenOrders(symbol?:
|
|
892
|
-
fetchOpenOrdersWs(symbol?:
|
|
893
|
-
fetchClosedOrders(symbol?:
|
|
887
|
+
fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
888
|
+
fetchOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
889
|
+
fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
890
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
891
|
+
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
892
|
+
fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
893
|
+
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
894
894
|
fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
895
|
-
fetchClosedOrdersWs(symbol?:
|
|
896
|
-
fetchMyTrades(symbol?:
|
|
897
|
-
fetchMyLiquidations(symbol?:
|
|
895
|
+
fetchClosedOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
896
|
+
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
897
|
+
fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
898
898
|
fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
899
|
-
fetchMyTradesWs(symbol?:
|
|
900
|
-
watchMyTrades(symbol?:
|
|
899
|
+
fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
900
|
+
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
901
901
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
902
|
-
fetchDepositsWithdrawals(code?:
|
|
903
|
-
fetchDeposits(symbol?:
|
|
904
|
-
fetchWithdrawals(symbol?:
|
|
905
|
-
fetchDepositsWs(code?:
|
|
906
|
-
fetchWithdrawalsWs(code?:
|
|
907
|
-
fetchFundingRateHistory(symbol?:
|
|
908
|
-
fetchFundingHistory(symbol?:
|
|
902
|
+
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
903
|
+
fetchDeposits(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
904
|
+
fetchWithdrawals(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
905
|
+
fetchDepositsWs(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<{}>;
|
|
906
|
+
fetchWithdrawalsWs(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<{}>;
|
|
907
|
+
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
908
|
+
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
909
909
|
closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
|
|
910
910
|
closeAllPositions(params?: {}): Promise<Position[]>;
|
|
911
911
|
fetchL3OrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
912
|
-
parseLastPrice(price: any, market?: Market):
|
|
912
|
+
parseLastPrice(price: any, market?: Market): LastPrice;
|
|
913
913
|
fetchDepositAddress(code: string, params?: {}): Promise<any>;
|
|
914
914
|
account(): Account;
|
|
915
915
|
commonCurrencyCode(currency: string): string;
|
|
@@ -944,10 +944,10 @@ export default class Exchange {
|
|
|
944
944
|
createStopLimitOrder(symbol: string, side: OrderSide, amount: number, price: number, stopPrice: number, params?: {}): Promise<Order>;
|
|
945
945
|
createStopMarketOrder(symbol: string, side: OrderSide, amount: number, stopPrice: number, params?: {}): Promise<Order>;
|
|
946
946
|
safeCurrencyCode(currencyId: Str, currency?: Currency): string;
|
|
947
|
-
filterBySymbolSinceLimit(array: any, symbol?:
|
|
947
|
+
filterBySymbolSinceLimit(array: any, symbol?: Str, since?: Int, limit?: Int, tail?: boolean): any;
|
|
948
948
|
filterByCurrencySinceLimit(array: any, code?: any, since?: Int, limit?: Int, tail?: boolean): any;
|
|
949
949
|
filterBySymbolsSinceLimit(array: any, symbols?: string[], since?: Int, limit?: Int, tail?: boolean): any;
|
|
950
|
-
parseLastPrices(pricesData: any, symbols?: string[], params?: {}):
|
|
950
|
+
parseLastPrices(pricesData: any, symbols?: string[], params?: {}): LastPrices;
|
|
951
951
|
parseTickers(tickers: any, symbols?: string[], params?: {}): Dictionary<Ticker>;
|
|
952
952
|
parseDepositAddresses(addresses: any, codes?: string[], indexed?: boolean, params?: {}): {};
|
|
953
953
|
parseBorrowInterests(response: any, market?: Market): any[];
|
|
@@ -958,7 +958,7 @@ export default class Exchange {
|
|
|
958
958
|
isTriggerOrder(params: any): any[];
|
|
959
959
|
isPostOnly(isMarketOrder: boolean, exchangeSpecificParam: any, params?: {}): boolean;
|
|
960
960
|
handlePostOnly(isMarketOrder: boolean, exchangeSpecificPostOnlyOption: boolean, params?: any): any[];
|
|
961
|
-
fetchLastPrices(symbols?: string[], params?: {}): Promise<
|
|
961
|
+
fetchLastPrices(symbols?: string[], params?: {}): Promise<LastPrices>;
|
|
962
962
|
fetchTradingFees(params?: {}): Promise<{}>;
|
|
963
963
|
fetchTradingFeesWs(params?: {}): Promise<{}>;
|
|
964
964
|
fetchTradingFee(symbol: string, params?: {}): Promise<{}>;
|
|
@@ -980,16 +980,16 @@ export default class Exchange {
|
|
|
980
980
|
parseIncomes(incomes: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
|
|
981
981
|
getMarketFromSymbols(symbols?: string[]): MarketInterface;
|
|
982
982
|
parseWsOHLCVs(ohlcvs: object[], market?: any, timeframe?: string, since?: Int, limit?: Int): any[];
|
|
983
|
-
fetchTransactions(code?:
|
|
983
|
+
fetchTransactions(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
984
984
|
filterByArrayPositions(objects: any, key: IndexType, values?: any, indexed?: boolean): Position[];
|
|
985
985
|
filterByArrayTickers(objects: any, key: IndexType, values?: any, indexed?: boolean): Dictionary<Ticker>;
|
|
986
986
|
createOHLCVObject(symbol: string, timeframe: string, data: any): Dictionary<Dictionary<OHLCV[]>>;
|
|
987
987
|
handleMaxEntriesPerRequestAndParams(method: string, maxEntriesPerRequest?: Int, params?: {}): [Int, any];
|
|
988
|
-
fetchPaginatedCallDynamic(method: string, symbol?:
|
|
989
|
-
safeDeterministicCall(method: string, symbol?:
|
|
990
|
-
fetchPaginatedCallDeterministic(method: string, symbol?:
|
|
991
|
-
fetchPaginatedCallCursor(method: string, symbol?:
|
|
992
|
-
fetchPaginatedCallIncremental(method: string, symbol?:
|
|
988
|
+
fetchPaginatedCallDynamic(method: string, symbol?: Str, since?: Int, limit?: Int, params?: {}, maxEntriesPerRequest?: Int): Promise<any>;
|
|
989
|
+
safeDeterministicCall(method: string, symbol?: Str, since?: Int, limit?: Int, timeframe?: Str, params?: {}): Promise<any>;
|
|
990
|
+
fetchPaginatedCallDeterministic(method: string, symbol?: Str, since?: Int, limit?: Int, timeframe?: Str, params?: {}, maxEntriesPerRequest?: any): Promise<any>;
|
|
991
|
+
fetchPaginatedCallCursor(method: string, symbol?: Str, since?: any, limit?: any, params?: {}, cursorReceived?: any, cursorSent?: any, cursorIncrement?: any, maxEntriesPerRequest?: any): Promise<any>;
|
|
992
|
+
fetchPaginatedCallIncremental(method: string, symbol?: Str, since?: any, limit?: any, params?: {}, pageKey?: any, maxEntriesPerRequest?: any): Promise<any>;
|
|
993
993
|
sortCursorPaginatedResult(result: any): any;
|
|
994
994
|
removeRepeatedElementsFromArray(input: any): any;
|
|
995
995
|
handleUntilOption(key: string, request: any, params: any, multiplier?: number): any[];
|
|
@@ -997,9 +997,9 @@ export default class Exchange {
|
|
|
997
997
|
parseLiquidation(liquidation: any, market?: Market): Liquidation;
|
|
998
998
|
parseLiquidations(liquidations: any, market?: any, since?: Int, limit?: Int): Liquidation[];
|
|
999
999
|
parseGreeks(greeks: any, market?: Market): Greeks;
|
|
1000
|
-
parseMarginModes(response: object[], symbols?: string[], symbolKey?:
|
|
1000
|
+
parseMarginModes(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): MarginModes;
|
|
1001
1001
|
parseMarginMode(marginMode: any, market?: Market): MarginMode;
|
|
1002
|
-
parseLeverages(response: object[], symbols?: string[], symbolKey?:
|
|
1002
|
+
parseLeverages(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): Leverages;
|
|
1003
1003
|
parseLeverage(leverage: any, market?: Market): Leverage;
|
|
1004
1004
|
}
|
|
1005
1005
|
export { Exchange, };
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -392,6 +392,14 @@ export interface Greeks {
|
|
|
392
392
|
underlyingPrice: number;
|
|
393
393
|
info: any;
|
|
394
394
|
}
|
|
395
|
+
export interface LastPrice {
|
|
396
|
+
symbol: string;
|
|
397
|
+
timestamp?: number;
|
|
398
|
+
datetime?: string;
|
|
399
|
+
price: number;
|
|
400
|
+
side?: OrderSide;
|
|
401
|
+
info: any;
|
|
402
|
+
}
|
|
395
403
|
export interface Leverage {
|
|
396
404
|
info: any;
|
|
397
405
|
symbol: string;
|
|
@@ -401,6 +409,8 @@ export interface Leverage {
|
|
|
401
409
|
}
|
|
402
410
|
export interface Leverages extends Dictionary<Leverage> {
|
|
403
411
|
}
|
|
412
|
+
export interface LastPrices extends Dictionary<LastPrice> {
|
|
413
|
+
}
|
|
404
414
|
export interface MarginModes extends Dictionary<MarginMode> {
|
|
405
415
|
}
|
|
406
416
|
/** [ timestamp, open, high, low, close, volume ] */
|
package/js/src/binance.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export default class binance extends Exchange {
|
|
|
34
34
|
}>;
|
|
35
35
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
36
36
|
fetchBidsAsks(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
|
|
37
|
-
fetchLastPrices(symbols?: Strings, params?: {}): Promise<
|
|
37
|
+
fetchLastPrices(symbols?: Strings, params?: {}): Promise<import("./base/types.js").LastPrices>;
|
|
38
38
|
parseLastPrice(entry: any, market?: Market): {
|
|
39
39
|
symbol: string;
|
|
40
40
|
timestamp: number;
|
package/js/src/bitfinex2.d.ts
CHANGED
|
@@ -170,6 +170,6 @@ export default class bitfinex2 extends Exchange {
|
|
|
170
170
|
symbol: any;
|
|
171
171
|
status: string;
|
|
172
172
|
};
|
|
173
|
-
fetchOrder(id: string, symbol?:
|
|
173
|
+
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
174
174
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
|
|
175
175
|
}
|
package/js/src/bitrue.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export default class bitrue extends Exchange {
|
|
|
39
39
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
40
40
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
41
41
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
42
|
-
cancelAllOrders(symbol?:
|
|
42
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
43
43
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
44
44
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
45
45
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
@@ -70,9 +70,9 @@ export default class bitrue extends Exchange {
|
|
|
70
70
|
toAccount: any;
|
|
71
71
|
status: string;
|
|
72
72
|
};
|
|
73
|
-
fetchTransfers(code?:
|
|
73
|
+
fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
74
74
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
75
|
-
setLeverage(leverage: Int, symbol?:
|
|
75
|
+
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
76
76
|
parseMarginModification(data: any, market?: any): {
|
|
77
77
|
info: any;
|
|
78
78
|
type: any;
|
package/js/src/cex.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export default class cex extends Exchange {
|
|
|
22
22
|
fetchTradingFees(params?: {}): Promise<{}>;
|
|
23
23
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
24
24
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
25
|
-
cancelAllOrders(symbol?:
|
|
25
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
26
26
|
parseOrder(order: any, market?: Market): Order;
|
|
27
27
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
28
28
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
package/js/src/gate.d.ts
CHANGED
|
@@ -333,7 +333,7 @@ export default class gate extends Exchange {
|
|
|
333
333
|
info: any;
|
|
334
334
|
};
|
|
335
335
|
parseLedgerEntryType(type: any): string;
|
|
336
|
-
setPositionMode(hedged: boolean, symbol?:
|
|
336
|
+
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
337
337
|
fetchUnderlyingAssets(params?: {}): Promise<any[]>;
|
|
338
338
|
fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
|
|
339
339
|
fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
|
package/js/src/htx.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export default class htx extends Exchange {
|
|
|
51
51
|
parseTicker(ticker: any, market?: Market): Ticker;
|
|
52
52
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
53
53
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
54
|
-
fetchLastPrices(symbols?: Strings, params?: {}): Promise<
|
|
54
|
+
fetchLastPrices(symbols?: Strings, params?: {}): Promise<import("./base/types.js").LastPrices>;
|
|
55
55
|
parseLastPrice(entry: any, market?: Market): {
|
|
56
56
|
symbol: string;
|
|
57
57
|
timestamp: any;
|
package/js/src/idex.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export default class idex extends Exchange {
|
|
|
50
50
|
parseTransactionStatus(status: any): string;
|
|
51
51
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
52
52
|
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
53
|
-
fetchDepositAddress(code?:
|
|
53
|
+
fetchDepositAddress(code?: Str, params?: {}): Promise<{
|
|
54
54
|
info: any;
|
|
55
55
|
currency: any;
|
|
56
56
|
address: string;
|
|
@@ -48,7 +48,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
48
48
|
};
|
|
49
49
|
fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
50
50
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
51
|
-
fetchOrder(id?:
|
|
51
|
+
fetchOrder(id?: Str, symbol?: Str, params?: {}): Promise<Order>;
|
|
52
52
|
parseOrder(order: any, market?: Market): Order;
|
|
53
53
|
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
54
54
|
info: any;
|
|
@@ -53,7 +53,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
53
53
|
fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
54
54
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
55
55
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
56
|
-
fetchOrder(id?:
|
|
56
|
+
fetchOrder(id?: Str, symbol?: Str, params?: {}): Promise<Order>;
|
|
57
57
|
parseOrder(order: any, market?: Market): Order;
|
|
58
58
|
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
59
59
|
info: any;
|
|
@@ -75,7 +75,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
75
75
|
previousFundingDatetime: string;
|
|
76
76
|
}>;
|
|
77
77
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
78
|
-
setMarginMode(marginMode: string, symbol?:
|
|
78
|
+
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
79
79
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
80
80
|
url: any;
|
|
81
81
|
method: string;
|
package/js/src/pro/bingx.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export default class bingx extends bingxRest {
|
|
|
20
20
|
setBalanceCache(client: Client, type: any, subscriptionHash: any, params: any): void;
|
|
21
21
|
loadBalanceSnapshot(client: any, messageHash: any, type: any): Promise<void>;
|
|
22
22
|
handleErrorMessage(client: any, message: any): boolean;
|
|
23
|
+
keepAliveListenKey(params?: {}): Promise<void>;
|
|
23
24
|
authenticate(params?: {}): Promise<void>;
|
|
24
25
|
pong(client: any, message: any): Promise<void>;
|
|
25
26
|
handleOrder(client: any, message: any): void;
|
package/js/src/pro/bingx.js
CHANGED
|
@@ -765,21 +765,44 @@ export default class bingx extends bingxRest {
|
|
|
765
765
|
}
|
|
766
766
|
return true;
|
|
767
767
|
}
|
|
768
|
-
async
|
|
769
|
-
const time = this.milliseconds();
|
|
768
|
+
async keepAliveListenKey(params = {}) {
|
|
770
769
|
const listenKey = this.safeString(this.options, 'listenKey');
|
|
771
770
|
if (listenKey === undefined) {
|
|
772
|
-
|
|
773
|
-
this.options['listenKey'] = this.safeString(response, 'listenKey');
|
|
774
|
-
this.options['lastAuthenticatedTime'] = time;
|
|
771
|
+
// A network error happened: we can't renew a listen key that does not exist.
|
|
775
772
|
return;
|
|
776
773
|
}
|
|
774
|
+
try {
|
|
775
|
+
await this.userAuthPrivatePutUserDataStream({ 'listenKey': listenKey }); // extend the expiry
|
|
776
|
+
}
|
|
777
|
+
catch (error) {
|
|
778
|
+
const types = ['spot', 'swap'];
|
|
779
|
+
for (let i = 0; i < types.length; i++) {
|
|
780
|
+
const type = types[i];
|
|
781
|
+
const url = this.urls['api']['ws'][type] + '?listenKey=' + listenKey;
|
|
782
|
+
const client = this.client(url);
|
|
783
|
+
const messageHashes = Object.keys(client.futures);
|
|
784
|
+
for (let j = 0; j < messageHashes.length; j++) {
|
|
785
|
+
const messageHash = messageHashes[j];
|
|
786
|
+
client.reject(error, messageHash);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
this.options['listenKey'] = undefined;
|
|
790
|
+
this.options['lastAuthenticatedTime'] = 0;
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
// whether or not to schedule another listenKey keepAlive request
|
|
794
|
+
const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 3600000);
|
|
795
|
+
this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
|
|
796
|
+
}
|
|
797
|
+
async authenticate(params = {}) {
|
|
798
|
+
const time = this.milliseconds();
|
|
777
799
|
const lastAuthenticatedTime = this.safeInteger(this.options, 'lastAuthenticatedTime', 0);
|
|
778
800
|
const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 3600000); // 1 hour
|
|
779
801
|
if (time - lastAuthenticatedTime > listenKeyRefreshRate) {
|
|
780
|
-
const response = await this.
|
|
802
|
+
const response = await this.userAuthPrivatePostUserDataStream();
|
|
781
803
|
this.options['listenKey'] = this.safeString(response, 'listenKey');
|
|
782
804
|
this.options['lastAuthenticatedTime'] = time;
|
|
805
|
+
this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
|
|
783
806
|
}
|
|
784
807
|
}
|
|
785
808
|
async pong(client, message) {
|
package/js/src/pro/bitvavo.d.ts
CHANGED
|
@@ -24,21 +24,21 @@ export default class bitvavo extends bitvavoRest {
|
|
|
24
24
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
25
25
|
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
26
26
|
editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
|
|
27
|
-
cancelOrderWs(id: string, symbol?:
|
|
28
|
-
cancelAllOrdersWs(symbol?:
|
|
27
|
+
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
28
|
+
cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<any>;
|
|
29
29
|
handleMultipleOrders(client: Client, message: any): void;
|
|
30
|
-
fetchOrderWs(id: string, symbol?:
|
|
31
|
-
fetchOrdersWs(symbol?:
|
|
30
|
+
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
31
|
+
fetchOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
32
32
|
watchRequest(action: any, request: any): Promise<any>;
|
|
33
|
-
fetchOpenOrdersWs(symbol?:
|
|
34
|
-
fetchMyTradesWs(symbol?:
|
|
33
|
+
fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
34
|
+
fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
35
35
|
handleMyTrades(client: Client, message: any): void;
|
|
36
36
|
withdrawWs(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<any>;
|
|
37
37
|
handleWithdraw(client: Client, message: any): void;
|
|
38
|
-
fetchWithdrawalsWs(code?:
|
|
38
|
+
fetchWithdrawalsWs(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
39
39
|
handleWithdraws(client: Client, message: any): void;
|
|
40
40
|
fetchOHLCVWs(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
41
|
-
fetchDepositsWs(code?:
|
|
41
|
+
fetchDepositsWs(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
42
42
|
handleDeposits(client: Client, message: any): void;
|
|
43
43
|
fetchTradingFeesWs(params?: {}): Promise<any>;
|
|
44
44
|
fetchMarketsWs(params?: {}): Promise<any>;
|
package/js/src/pro/bybit.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Client from '../base/ws/Client.js';
|
|
|
4
4
|
export default class bybit extends bybitRest {
|
|
5
5
|
describe(): any;
|
|
6
6
|
requestId(): any;
|
|
7
|
-
getUrlByMarketType(symbol?: Str, isPrivate?: boolean, method?:
|
|
7
|
+
getUrlByMarketType(symbol?: Str, isPrivate?: boolean, method?: Str, params?: {}): any;
|
|
8
8
|
cleanParams(params: any): any;
|
|
9
9
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
10
10
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
package/js/src/pro/cex.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export default class cex extends cexRest {
|
|
|
16
16
|
handleTicker(client: Client, message: any): void;
|
|
17
17
|
parseWsTicker(ticker: any, market?: any): Ticker;
|
|
18
18
|
fetchBalanceWs(params?: {}): Promise<Balances>;
|
|
19
|
-
watchOrders(symbol?:
|
|
19
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
20
20
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
21
21
|
handleTransaction(client: Client, message: any): void;
|
|
22
22
|
handleMyTrades(client: Client, message: any): void;
|
|
@@ -37,12 +37,12 @@ export default class cex extends cexRest {
|
|
|
37
37
|
handleOHLCV24(client: Client, message: any): any;
|
|
38
38
|
handleOHLCV1m(client: Client, message: any): void;
|
|
39
39
|
handleOHLCV(client: Client, message: any): void;
|
|
40
|
-
fetchOrderWs(id: string, symbol?:
|
|
41
|
-
fetchOpenOrdersWs(symbol?:
|
|
40
|
+
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
41
|
+
fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
42
42
|
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
43
43
|
editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
|
|
44
|
-
cancelOrderWs(id: string, symbol?:
|
|
45
|
-
cancelOrdersWs(ids: string[], symbol?:
|
|
44
|
+
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
45
|
+
cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
|
46
46
|
resolveData(client: Client, message: any): void;
|
|
47
47
|
handleConnected(client: Client, message: any): any;
|
|
48
48
|
handleErrorMessage(client: Client, message: any): void;
|
package/js/src/pro/coinbase.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import coinbaseRest from '../coinbase.js';
|
|
2
|
-
import { Strings, Tickers, Ticker, Int, Trade, OrderBook, Order } from '../base/types.js';
|
|
2
|
+
import { Strings, Tickers, Ticker, Int, Trade, OrderBook, Order, Str } from '../base/types.js';
|
|
3
3
|
export default class coinbase extends coinbaseRest {
|
|
4
4
|
describe(): any;
|
|
5
5
|
subscribe(name: any, symbol?: any, params?: {}): Promise<any>;
|
|
@@ -8,7 +8,7 @@ export default class coinbase extends coinbaseRest {
|
|
|
8
8
|
handleTickers(client: any, message: any): any;
|
|
9
9
|
parseWsTicker(ticker: any, market?: any): Ticker;
|
|
10
10
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
11
|
-
watchOrders(symbol?:
|
|
11
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
12
12
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
13
13
|
handleTrade(client: any, message: any): any;
|
|
14
14
|
handleOrder(client: any, message: any): any;
|
package/js/src/pro/hitbtc.js
CHANGED
|
@@ -250,7 +250,10 @@ export default class hitbtc extends hitbtcRest {
|
|
|
250
250
|
// }
|
|
251
251
|
// }
|
|
252
252
|
//
|
|
253
|
-
const
|
|
253
|
+
const snapshot = this.safeDict(message, 'snapshot');
|
|
254
|
+
const update = this.safeDict(message, 'update');
|
|
255
|
+
const data = snapshot ? snapshot : update;
|
|
256
|
+
const type = snapshot ? 'snapshot' : 'update';
|
|
254
257
|
const marketIds = Object.keys(data);
|
|
255
258
|
for (let i = 0; i < marketIds.length; i++) {
|
|
256
259
|
const marketId = marketIds[i];
|
|
@@ -259,17 +262,23 @@ export default class hitbtc extends hitbtcRest {
|
|
|
259
262
|
const item = data[marketId];
|
|
260
263
|
const messageHash = 'orderbooks::' + symbol;
|
|
261
264
|
if (!(symbol in this.orderbooks)) {
|
|
262
|
-
const subscription = this.
|
|
265
|
+
const subscription = this.safeDict(client.subscriptions, messageHash, {});
|
|
263
266
|
const limit = this.safeInteger(subscription, 'limit');
|
|
264
267
|
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
265
268
|
}
|
|
269
|
+
const orderbook = this.orderbooks[symbol];
|
|
266
270
|
const timestamp = this.safeInteger(item, 't');
|
|
267
271
|
const nonce = this.safeInteger(item, 's');
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
if (type === 'snapshot') {
|
|
273
|
+
const parsedSnapshot = this.parseOrderBook(item, symbol, timestamp, 'b', 'a');
|
|
274
|
+
orderbook.reset(parsedSnapshot);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
const asks = this.safeList(item, 'a', []);
|
|
278
|
+
const bids = this.safeList(item, 'b', []);
|
|
279
|
+
this.handleDeltas(orderbook['asks'], asks);
|
|
280
|
+
this.handleDeltas(orderbook['bids'], bids);
|
|
281
|
+
}
|
|
273
282
|
orderbook['timestamp'] = timestamp;
|
|
274
283
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
275
284
|
orderbook['nonce'] = nonce;
|
package/js/src/pro/poloniex.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export default class poloniex extends poloniexRest {
|
|
|
7
7
|
subscribe(name: string, messageHash: string, isPrivate: boolean, symbols?: Strings, params?: {}): Promise<any>;
|
|
8
8
|
tradeRequest(name: string, params?: {}): Promise<any>;
|
|
9
9
|
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
10
|
-
cancelOrderWs(id: string, symbol?:
|
|
11
|
-
cancelOrdersWs(ids: string[], symbol?:
|
|
12
|
-
cancelAllOrdersWs(symbol?:
|
|
10
|
+
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
11
|
+
cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<any>;
|
|
12
|
+
cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<any>;
|
|
13
13
|
handleOrderRequest(client: Client, message: any): void;
|
|
14
14
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
15
15
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
package/package.json
CHANGED