ccxt 4.1.2 → 4.1.4

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/js/src/kraken.js CHANGED
@@ -358,6 +358,7 @@ export default class kraken extends Exchange {
358
358
  * @method
359
359
  * @name kraken#fetchMarkets
360
360
  * @description retrieves data on all markets for kraken
361
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTradableAssetPairs
361
362
  * @param {object} [params] extra parameters specific to the exchange api endpoint
362
363
  * @returns {object[]} an array of objects representing market data
363
364
  */
@@ -543,6 +544,7 @@ export default class kraken extends Exchange {
543
544
  * @method
544
545
  * @name kraken#fetchCurrencies
545
546
  * @description fetches all available currencies on an exchange
547
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getAssetInfo
546
548
  * @param {object} [params] extra parameters specific to the kraken api endpoint
547
549
  * @returns {object} an associative dictionary of currencies
548
550
  */
@@ -601,6 +603,7 @@ export default class kraken extends Exchange {
601
603
  * @method
602
604
  * @name kraken#fetchTradingFee
603
605
  * @description fetch the trading fees for a market
606
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeVolume
604
607
  * @param {string} symbol unified market symbol
605
608
  * @param {object} [params] extra parameters specific to the kraken api endpoint
606
609
  * @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
@@ -669,6 +672,7 @@ export default class kraken extends Exchange {
669
672
  * @method
670
673
  * @name kraken#fetchOrderBook
671
674
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
675
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getOrderBook
672
676
  * @param {string} symbol unified symbol of the market to fetch the order book for
673
677
  * @param {int} [limit] the maximum amount of order book entries to return
674
678
  * @param {object} [params] extra parameters specific to the kraken api endpoint
@@ -771,6 +775,7 @@ export default class kraken extends Exchange {
771
775
  * @method
772
776
  * @name kraken#fetchTickers
773
777
  * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
778
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation
774
779
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
775
780
  * @param {object} [params] extra parameters specific to the kraken api endpoint
776
781
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
@@ -807,6 +812,7 @@ export default class kraken extends Exchange {
807
812
  * @method
808
813
  * @name kraken#fetchTicker
809
814
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
815
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation
810
816
  * @param {string} symbol unified symbol of the market to fetch the ticker for
811
817
  * @param {object} [params] extra parameters specific to the kraken api endpoint
812
818
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
@@ -851,6 +857,7 @@ export default class kraken extends Exchange {
851
857
  * @method
852
858
  * @name kraken#fetchOHLCV
853
859
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
860
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getOHLCData
854
861
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
855
862
  * @param {string} timeframe the length of time each candle represents
856
863
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -963,6 +970,7 @@ export default class kraken extends Exchange {
963
970
  * @method
964
971
  * @name kraken#fetchLedger
965
972
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
973
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
966
974
  * @param {string} code unified currency code, default is undefined
967
975
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
968
976
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
@@ -1141,6 +1149,7 @@ export default class kraken extends Exchange {
1141
1149
  * @method
1142
1150
  * @name kraken#fetchTrades
1143
1151
  * @description get the list of most recent trades for a particular symbol
1152
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getRecentTrades
1144
1153
  * @param {string} symbol unified symbol of the market to fetch trades for
1145
1154
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1146
1155
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1214,6 +1223,7 @@ export default class kraken extends Exchange {
1214
1223
  * @method
1215
1224
  * @name kraken#fetchBalance
1216
1225
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1226
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getAccountBalance
1217
1227
  * @param {object} [params] extra parameters specific to the kraken api endpoint
1218
1228
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
1219
1229
  */
@@ -1457,6 +1467,16 @@ export default class kraken extends Exchange {
1457
1467
  }
1458
1468
  const clientOrderId = this.safeString(order, 'userref');
1459
1469
  const rawTrades = this.safeValue(order, 'trades');
1470
+ const trades = [];
1471
+ for (let i = 0; i < rawTrades.length; i++) {
1472
+ const rawTrade = rawTrades[i];
1473
+ if (typeof rawTrade === 'string') {
1474
+ trades.push(this.safeTrade({ 'id': rawTrade, 'orderId': id, 'symbol': symbol, 'info': {} }));
1475
+ }
1476
+ else {
1477
+ trades.push(rawTrade);
1478
+ }
1479
+ }
1460
1480
  stopPrice = this.safeNumber(order, 'stopprice', stopPrice);
1461
1481
  return this.safeOrder({
1462
1482
  'id': id,
@@ -1480,7 +1500,7 @@ export default class kraken extends Exchange {
1480
1500
  'average': average,
1481
1501
  'remaining': undefined,
1482
1502
  'fee': fee,
1483
- 'trades': rawTrades,
1503
+ 'trades': trades,
1484
1504
  }, market);
1485
1505
  }
1486
1506
  orderRequest(method, symbol, type, request, price = undefined, params = {}) {
@@ -1616,6 +1636,7 @@ export default class kraken extends Exchange {
1616
1636
  * @method
1617
1637
  * @name kraken#fetchOrder
1618
1638
  * @description fetches information on an order made by the user
1639
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOrdersInfo
1619
1640
  * @param {string} symbol not used by kraken fetchOrder
1620
1641
  * @param {object} [params] extra parameters specific to the kraken api endpoint
1621
1642
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -1685,6 +1706,7 @@ export default class kraken extends Exchange {
1685
1706
  * @method
1686
1707
  * @name kraken#fetchOrderTrades
1687
1708
  * @description fetch all the trades made from a single order
1709
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradesInfo
1688
1710
  * @param {string} id order id
1689
1711
  * @param {string} symbol unified market symbol
1690
1712
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -1784,6 +1806,7 @@ export default class kraken extends Exchange {
1784
1806
  * @method
1785
1807
  * @name kraken#fetchMyTrades
1786
1808
  * @description fetch all trades made by the user
1809
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeHistory
1787
1810
  * @param {string} symbol unified market symbol
1788
1811
  * @param {int} [since] the earliest time in ms to fetch trades for
1789
1812
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1843,6 +1866,7 @@ export default class kraken extends Exchange {
1843
1866
  * @method
1844
1867
  * @name kraken#cancelOrder
1845
1868
  * @description cancels an open order
1869
+ * @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrder
1846
1870
  * @param {string} id order id
1847
1871
  * @param {string} symbol unified symbol of the market the order was made in
1848
1872
  * @param {object} [params] extra parameters specific to the kraken api endpoint
@@ -1873,6 +1897,7 @@ export default class kraken extends Exchange {
1873
1897
  * @method
1874
1898
  * @name kraken#cancelOrders
1875
1899
  * @description cancel multiple orders
1900
+ * @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrderBatch
1876
1901
  * @param {string[]} ids open orders transaction ID (txid) or user reference (userref)
1877
1902
  * @param {string} symbol unified market symbol
1878
1903
  * @param {object} [params] extra parameters specific to the kraken api endpoint
@@ -1897,6 +1922,7 @@ export default class kraken extends Exchange {
1897
1922
  * @method
1898
1923
  * @name kraken#cancelAllOrders
1899
1924
  * @description cancel all open orders
1925
+ * @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelAllOrders
1900
1926
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1901
1927
  * @param {object} [params] extra parameters specific to the kraken api endpoint
1902
1928
  * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -1909,6 +1935,7 @@ export default class kraken extends Exchange {
1909
1935
  * @method
1910
1936
  * @name kraken#fetchOpenOrders
1911
1937
  * @description fetch all unfilled currently open orders
1938
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
1912
1939
  * @param {string} symbol unified market symbol
1913
1940
  * @param {int} [since] the earliest time in ms to fetch open orders for
1914
1941
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -1940,6 +1967,7 @@ export default class kraken extends Exchange {
1940
1967
  * @method
1941
1968
  * @name kraken#fetchClosedOrders
1942
1969
  * @description fetches information on multiple closed orders made by the user
1970
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1943
1971
  * @param {string} symbol unified market symbol of the market orders were made in
1944
1972
  * @param {int} [since] the earliest time in ms to fetch orders for
1945
1973
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -2137,6 +2165,7 @@ export default class kraken extends Exchange {
2137
2165
  * @method
2138
2166
  * @name kraken#fetchDeposits
2139
2167
  * @description fetch all deposits made to an account
2168
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
2140
2169
  * @param {string} code unified currency code
2141
2170
  * @param {int} [since] the earliest time in ms to fetch deposits for
2142
2171
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -2173,6 +2202,7 @@ export default class kraken extends Exchange {
2173
2202
  * @method
2174
2203
  * @name kraken#fetchTime
2175
2204
  * @description fetches the current integer timestamp in milliseconds from the exchange server
2205
+ * @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getServerTime
2176
2206
  * @param {object} [params] extra parameters specific to the kraken api endpoint
2177
2207
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
2178
2208
  */
@@ -2195,6 +2225,7 @@ export default class kraken extends Exchange {
2195
2225
  * @method
2196
2226
  * @name kraken#fetchWithdrawals
2197
2227
  * @description fetch all withdrawals made from an account
2228
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentWithdrawals
2198
2229
  * @param {string} code unified currency code
2199
2230
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2200
2231
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -2231,6 +2262,7 @@ export default class kraken extends Exchange {
2231
2262
  * @method
2232
2263
  * @name kraken#createDepositAddress
2233
2264
  * @description create a currency deposit address
2265
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositAddresses
2234
2266
  * @param {string} code unified currency code of the currency for the deposit address
2235
2267
  * @param {object} [params] extra parameters specific to the kraken api endpoint
2236
2268
  * @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
@@ -2277,6 +2309,7 @@ export default class kraken extends Exchange {
2277
2309
  * @method
2278
2310
  * @name kraken#fetchDepositAddress
2279
2311
  * @description fetch the deposit address for a currency associated with this account
2312
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositAddresses
2280
2313
  * @param {string} code unified currency code
2281
2314
  * @param {object} [params] extra parameters specific to the kraken api endpoint
2282
2315
  * @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
@@ -2358,6 +2391,7 @@ export default class kraken extends Exchange {
2358
2391
  * @method
2359
2392
  * @name kraken#withdraw
2360
2393
  * @description make a withdrawal
2394
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/withdrawFunds
2361
2395
  * @param {string} code unified currency code
2362
2396
  * @param {float} amount the amount to withdraw
2363
2397
  * @param {string} address the address to withdraw to
@@ -2394,6 +2428,7 @@ export default class kraken extends Exchange {
2394
2428
  * @method
2395
2429
  * @name kraken#fetchPositions
2396
2430
  * @description fetch all open positions
2431
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions
2397
2432
  * @param {string[]|undefined} symbols not used by kraken fetchPositions ()
2398
2433
  * @param {object} [params] extra parameters specific to the kraken api endpoint
2399
2434
  * @returns {object[]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
@@ -2465,6 +2500,7 @@ export default class kraken extends Exchange {
2465
2500
  async transferOut(code, amount, params = {}) {
2466
2501
  /**
2467
2502
  * @description transfer from spot wallet to futures wallet
2503
+ * @see https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer
2468
2504
  * @param {str} code Unified currency code
2469
2505
  * @param {float} amount Size of the transfer
2470
2506
  * @param {dict} [params] Exchange specific parameters
@@ -528,7 +528,7 @@ export default class kucoinfutures extends kucoin {
528
528
  // data: 1637385119302,
529
529
  // }
530
530
  //
531
- return this.safeNumber(response, 'data');
531
+ return this.safeInteger(response, 'data');
532
532
  }
533
533
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
534
534
  /**
package/js/src/okx.js CHANGED
@@ -1134,6 +1134,7 @@ export default class okx extends Exchange {
1134
1134
  * @method
1135
1135
  * @name okx#fetchStatus
1136
1136
  * @description the latest known information on the availability of the exchange API
1137
+ * @see https://www.okx.com/docs-v5/en/#status-get-status
1137
1138
  * @param {object} [params] extra parameters specific to the okx api endpoint
1138
1139
  * @returns {object} a [status structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#exchange-status-structure}
1139
1140
  */
@@ -1182,6 +1183,7 @@ export default class okx extends Exchange {
1182
1183
  * @method
1183
1184
  * @name okx#fetchTime
1184
1185
  * @description fetches the current integer timestamp in milliseconds from the exchange server
1186
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-system-time
1185
1187
  * @param {object} [params] extra parameters specific to the okx api endpoint
1186
1188
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
1187
1189
  */
@@ -1204,6 +1206,7 @@ export default class okx extends Exchange {
1204
1206
  * @method
1205
1207
  * @name okx#fetchAccounts
1206
1208
  * @description fetch all the accounts associated with a profile
1209
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
1207
1210
  * @param {object} [params] extra parameters specific to the okx api endpoint
1208
1211
  * @returns {object} a dictionary of [account structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#account-structure} indexed by the account type
1209
1212
  */
@@ -1628,6 +1631,7 @@ export default class okx extends Exchange {
1628
1631
  * @method
1629
1632
  * @name okx#fetchOrderBook
1630
1633
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1634
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
1631
1635
  * @param {string} symbol unified symbol of the market to fetch the order book for
1632
1636
  * @param {int} [limit] the maximum amount of order book entries to return
1633
1637
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -1729,6 +1733,7 @@ export default class okx extends Exchange {
1729
1733
  * @method
1730
1734
  * @name okx#fetchTicker
1731
1735
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1736
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
1732
1737
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1733
1738
  * @param {object} [params] extra parameters specific to the okx api endpoint
1734
1739
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
@@ -1819,6 +1824,7 @@ export default class okx extends Exchange {
1819
1824
  * @method
1820
1825
  * @name okx#fetchTickers
1821
1826
  * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
1827
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1822
1828
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1823
1829
  * @param {object} [params] extra parameters specific to the okx api endpoint
1824
1830
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
@@ -2131,6 +2137,7 @@ export default class okx extends Exchange {
2131
2137
  * @method
2132
2138
  * @name okx#fetchFundingRateHistory
2133
2139
  * @description fetches historical funding rate prices
2140
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
2134
2141
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
2135
2142
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
2136
2143
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
@@ -2269,6 +2276,7 @@ export default class okx extends Exchange {
2269
2276
  * @method
2270
2277
  * @name okx#fetchTradingFee
2271
2278
  * @description fetch the trading fees for a market
2279
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
2272
2280
  * @param {string} symbol unified market symbol
2273
2281
  * @param {object} [params] extra parameters specific to the okx api endpoint
2274
2282
  * @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
@@ -2318,6 +2326,8 @@ export default class okx extends Exchange {
2318
2326
  * @method
2319
2327
  * @name okx#fetchBalance
2320
2328
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2329
+ * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
2330
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
2321
2331
  * @param {object} [params] extra parameters specific to the okx api endpoint
2322
2332
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
2323
2333
  */
@@ -2853,6 +2863,7 @@ export default class okx extends Exchange {
2853
2863
  * @method
2854
2864
  * @name okx#cancelOrder
2855
2865
  * @description cancels an open order
2866
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
2856
2867
  * @param {string} id order id
2857
2868
  * @param {string} symbol unified symbol of the market the order was made in
2858
2869
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -2907,6 +2918,8 @@ export default class okx extends Exchange {
2907
2918
  * @method
2908
2919
  * @name okx#cancelOrders
2909
2920
  * @description cancel multiple orders
2921
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
2922
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
2910
2923
  * @param {string[]} ids order ids
2911
2924
  * @param {string} symbol unified market symbol
2912
2925
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -3209,6 +3222,8 @@ export default class okx extends Exchange {
3209
3222
  * @method
3210
3223
  * @name okx#fetchOrder
3211
3224
  * @description fetch an order by the id
3225
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details
3226
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-details
3212
3227
  * @param {string} id the order id
3213
3228
  * @param {string} symbol unified market symbol
3214
3229
  * @param {object} [params] extra and exchange specific parameters
@@ -3355,6 +3370,8 @@ export default class okx extends Exchange {
3355
3370
  * @name okx#fetchOpenOrders
3356
3371
  * @description Fetch orders that are still open
3357
3372
  * @description fetch all unfilled currently open orders
3373
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list
3374
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list
3358
3375
  * @param {string} symbol unified market symbol
3359
3376
  * @param {int} [since] the earliest time in ms to fetch open orders for
3360
3377
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -3503,6 +3520,8 @@ export default class okx extends Exchange {
3503
3520
  * @method
3504
3521
  * @name okx#fetchCanceledOrders
3505
3522
  * @description fetches information on multiple canceled orders made by the user
3523
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
3524
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
3506
3525
  * @param {string} symbol unified market symbol of the market orders were made in
3507
3526
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
3508
3527
  * @param {int} [limit] max number of orders to return, default is undefined
@@ -3677,6 +3696,8 @@ export default class okx extends Exchange {
3677
3696
  * @method
3678
3697
  * @name okx#fetchClosedOrders
3679
3698
  * @description fetches information on multiple closed orders made by the user
3699
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
3700
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
3680
3701
  * @param {string} symbol unified market symbol of the market orders were made in
3681
3702
  * @param {int} [since] the earliest time in ms to fetch orders for
3682
3703
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -3842,6 +3863,7 @@ export default class okx extends Exchange {
3842
3863
  * @method
3843
3864
  * @name okx#fetchMyTrades
3844
3865
  * @description fetch all trades made by the user
3866
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
3845
3867
  * @param {string} symbol unified market symbol
3846
3868
  * @param {int} [since] the earliest time in ms to fetch trades for
3847
3869
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -3902,6 +3924,7 @@ export default class okx extends Exchange {
3902
3924
  * @method
3903
3925
  * @name okx#fetchOrderTrades
3904
3926
  * @description fetch all the trades made from a single order
3927
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
3905
3928
  * @param {string} id order id
3906
3929
  * @param {string} symbol unified market symbol
3907
3930
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -4220,6 +4243,7 @@ export default class okx extends Exchange {
4220
4243
  * @method
4221
4244
  * @name okx#fetchDepositAddressesByNetwork
4222
4245
  * @description fetch a dictionary of addresses for a currency, indexed by network
4246
+ * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
4223
4247
  * @param {string} code unified currency code of the currency for the deposit address
4224
4248
  * @param {object} [params] extra parameters specific to the okx api endpoint
4225
4249
  * @returns {object} a dictionary of [address structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure} indexed by the network
@@ -4261,6 +4285,7 @@ export default class okx extends Exchange {
4261
4285
  * @method
4262
4286
  * @name okx#fetchDepositAddress
4263
4287
  * @description fetch the deposit address for a currency associated with this account
4288
+ * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
4264
4289
  * @param {string} code unified currency code
4265
4290
  * @param {object} [params] extra parameters specific to the okx api endpoint
4266
4291
  * @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
@@ -4301,6 +4326,7 @@ export default class okx extends Exchange {
4301
4326
  * @method
4302
4327
  * @name okx#withdraw
4303
4328
  * @description make a withdrawal
4329
+ * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
4304
4330
  * @param {string} code unified currency code
4305
4331
  * @param {float} amount the amount to withdraw
4306
4332
  * @param {string} address the address to withdraw to
@@ -5245,6 +5271,7 @@ export default class okx extends Exchange {
5245
5271
  * @method
5246
5272
  * @name okx#fetchTransfers
5247
5273
  * @description fetch a history of internal transfers made on an account
5274
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
5248
5275
  * @param {string} code unified currency code of the currency transferred
5249
5276
  * @param {int} [since] the earliest time in ms to fetch transfers for
5250
5277
  * @param {int} [limit] the maximum number of transfers structures to retrieve
@@ -5411,6 +5438,7 @@ export default class okx extends Exchange {
5411
5438
  * @method
5412
5439
  * @name okx#fetchFundingRate
5413
5440
  * @description fetch the current funding rate
5441
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
5414
5442
  * @param {string} symbol unified market symbol
5415
5443
  * @param {object} [params] extra parameters specific to the okx api endpoint
5416
5444
  * @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
@@ -5449,6 +5477,7 @@ export default class okx extends Exchange {
5449
5477
  * @method
5450
5478
  * @name okx#fetchFundingHistory
5451
5479
  * @description fetch the history of funding payments paid and received on this account
5480
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
5452
5481
  * @param {string} symbol unified market symbol
5453
5482
  * @param {int} [since] the earliest time in ms to fetch funding history for
5454
5483
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -5669,6 +5698,7 @@ export default class okx extends Exchange {
5669
5698
  * @method
5670
5699
  * @name okx#setPositionMode
5671
5700
  * @description set hedged to true or false for a market
5701
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
5672
5702
  * @param {bool} hedged set to true to use long_short_mode, false for net_mode
5673
5703
  * @param {string} symbol not used by okx setPositionMode
5674
5704
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -5703,6 +5733,7 @@ export default class okx extends Exchange {
5703
5733
  * @method
5704
5734
  * @name okx#setMarginMode
5705
5735
  * @description set margin mode to 'cross' or 'isolated'
5736
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
5706
5737
  * @param {string} marginMode 'cross' or 'isolated'
5707
5738
  * @param {string} symbol unified market symbol
5708
5739
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -5751,6 +5782,7 @@ export default class okx extends Exchange {
5751
5782
  * @method
5752
5783
  * @name okx#fetchBorrowRates
5753
5784
  * @description fetch the borrow interest rates of all currencies
5785
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
5754
5786
  * @param {object} [params] extra parameters specific to the okx api endpoint
5755
5787
  * @returns {object} a list of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
5756
5788
  */
@@ -5790,6 +5822,7 @@ export default class okx extends Exchange {
5790
5822
  * @method
5791
5823
  * @name okx#fetchBorrowRate
5792
5824
  * @description fetch the rate of interest to borrow a currency for margin trading
5825
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
5793
5826
  * @param {string} code unified currency code
5794
5827
  * @param {object} [params] extra parameters specific to the okx api endpoint
5795
5828
  * @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
@@ -5883,6 +5916,7 @@ export default class okx extends Exchange {
5883
5916
  * @method
5884
5917
  * @name okx#fetchBorrowRateHistories
5885
5918
  * @description retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined
5919
+ * @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
5886
5920
  * @param {string[]|undefined} codes list of unified currency codes, default is undefined
5887
5921
  * @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
5888
5922
  * @param {int} [limit] max number of borrow rate prices to return, default is undefined
@@ -5925,6 +5959,7 @@ export default class okx extends Exchange {
5925
5959
  * @method
5926
5960
  * @name okx#fetchBorrowRateHistory
5927
5961
  * @description retrieves a history of a currencies borrow interest rate at specific time slots
5962
+ * @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
5928
5963
  * @param {string} code unified currency code
5929
5964
  * @param {int} [since] timestamp for the earliest borrow rate
5930
5965
  * @param {int} [limit] the maximum number of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} to retrieve
@@ -6016,6 +6051,7 @@ export default class okx extends Exchange {
6016
6051
  * @method
6017
6052
  * @name okx#reduceMargin
6018
6053
  * @description remove margin from a position
6054
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
6019
6055
  * @param {string} symbol unified market symbol
6020
6056
  * @param {float} amount the amount of margin to remove
6021
6057
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -6028,6 +6064,7 @@ export default class okx extends Exchange {
6028
6064
  * @method
6029
6065
  * @name okx#addMargin
6030
6066
  * @description add margin
6067
+ * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
6031
6068
  * @param {string} symbol unified market symbol
6032
6069
  * @param {float} amount amount of margin to add
6033
6070
  * @param {object} [params] extra parameters specific to the okx api endpoint
@@ -143,14 +143,20 @@ export default class binance extends binanceRest {
143
143
  // valid <levels> are 5, 10, or 20
144
144
  //
145
145
  // default 100, max 1000, valid limits 5, 10, 20, 50, 100, 500, 1000
146
+ await this.loadMarkets();
147
+ const market = this.market(symbol);
146
148
  if (limit !== undefined) {
147
- if ((limit !== 5) && (limit !== 10) && (limit !== 20) && (limit !== 50) && (limit !== 100) && (limit !== 500) && (limit !== 1000)) {
148
- throw new ExchangeError(this.id + ' watchOrderBook limit argument must be undefined, 5, 10, 20, 50, 100, 500 or 1000');
149
+ if (market['contract']) {
150
+ if ((limit !== 5) && (limit !== 10) && (limit !== 20) && (limit !== 50) && (limit !== 100) && (limit !== 500) && (limit !== 1000)) {
151
+ throw new ExchangeError(this.id + ' watchOrderBook limit argument must be undefined, 5, 10, 20, 50, 100, 500 or 1000');
152
+ }
153
+ }
154
+ else {
155
+ if (limit > 5000) {
156
+ throw new ExchangeError(this.id + ' watchOrderBook limit argument must be less than or equal to 5000');
157
+ }
149
158
  }
150
159
  }
151
- //
152
- await this.loadMarkets();
153
- const market = this.market(symbol);
154
160
  let type = market['type'];
155
161
  if (market['contract']) {
156
162
  type = market['linear'] ? 'future' : 'delivery';
@@ -856,7 +856,7 @@ export default class whitebit extends Exchange {
856
856
  // ]
857
857
  // }
858
858
  //
859
- const timestamp = this.parseNumber(Precise.stringMul(this.safeString(response, 'timestamp'), '1000'));
859
+ const timestamp = this.parseToInt(Precise.stringMul(this.safeString(response, 'timestamp'), '1000'));
860
860
  return this.parseOrderBook(response, symbol, timestamp);
861
861
  }
862
862
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
package/skip-tests.json CHANGED
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "binance": {
50
50
  "httpsProxy": "http://51.83.140.52:11230",
51
+ "skipPhpAsync": true,
51
52
  "skipWs": true,
52
53
  "skipMethods": {
53
54
  "loadMarkets": {
@@ -79,6 +80,7 @@
79
80
  },
80
81
  "binancecoinm": {
81
82
  "httpsProxy": "http://51.83.140.52:11230",
83
+ "skipPhpAsync": true,
82
84
  "skipWs": true,
83
85
  "skipMethods": {
84
86
  "loadMarkets": {
@@ -97,6 +99,7 @@
97
99
  },
98
100
  "binanceusdm": {
99
101
  "httpsProxy": "http://51.83.140.52:11230",
102
+ "skipPhpAsync": true,
100
103
  "skipWs": true,
101
104
  "skipMethods": {
102
105
  "fetchTickers": {
@@ -120,6 +123,7 @@
120
123
  },
121
124
  "tokocrypto": {
122
125
  "httpsProxy": "http://51.83.140.52:11230",
126
+ "skipPhpAsync": true,
123
127
  "skipWs": true
124
128
  },
125
129
  "bitbank": {
@@ -912,7 +916,8 @@
912
916
  }
913
917
  },
914
918
  "kuna": {
915
- "httpsProxy": "http://51.83.140.52:11230"
919
+ "httpsProxy": "http://51.83.140.52:11230",
920
+ "skipPhpAsync": true
916
921
  },
917
922
  "kucoin": {
918
923
  "skipWs": true,