ccxt 4.4.82 → 4.4.85

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.
Files changed (103) hide show
  1. package/README.md +5 -7
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +1 -9
  4. package/dist/cjs/src/apex.js +2 -1
  5. package/dist/cjs/src/base/Exchange.js +15 -2
  6. package/dist/cjs/src/bitget.js +1 -3
  7. package/dist/cjs/src/bitrue.js +14 -35
  8. package/dist/cjs/src/bitso.js +33 -0
  9. package/dist/cjs/src/bitstamp.js +33 -0
  10. package/dist/cjs/src/blofin.js +154 -13
  11. package/dist/cjs/src/btcbox.js +25 -5
  12. package/dist/cjs/src/bybit.js +16 -40
  13. package/dist/cjs/src/cex.js +2 -4
  14. package/dist/cjs/src/coinbase.js +56 -40
  15. package/dist/cjs/src/coinbaseexchange.js +142 -32
  16. package/dist/cjs/src/coincatch.js +14 -67
  17. package/dist/cjs/src/coinex.js +29 -32
  18. package/dist/cjs/src/coinlist.js +16 -15
  19. package/dist/cjs/src/coinmetro.js +22 -11
  20. package/dist/cjs/src/coinone.js +8 -10
  21. package/dist/cjs/src/coinsph.js +126 -1
  22. package/dist/cjs/src/cryptocom.js +111 -1
  23. package/dist/cjs/src/cryptomus.js +43 -89
  24. package/dist/cjs/src/delta.js +76 -36
  25. package/dist/cjs/src/derive.js +46 -10
  26. package/dist/cjs/src/ellipx.js +175 -79
  27. package/dist/cjs/src/gate.js +1 -1
  28. package/dist/cjs/src/gemini.js +3 -5
  29. package/dist/cjs/src/hitbtc.js +56 -69
  30. package/dist/cjs/src/hyperliquid.js +2 -2
  31. package/dist/cjs/src/kraken.js +29 -24
  32. package/dist/cjs/src/kucoinfutures.js +6 -0
  33. package/dist/cjs/src/lbank.js +1 -1
  34. package/dist/cjs/src/paradex.js +119 -3
  35. package/dist/cjs/src/pro/binance.js +31 -33
  36. package/dist/cjs/src/pro/bithumb.js +5 -3
  37. package/dist/cjs/src/pro/kraken.js +289 -79
  38. package/dist/cjs/src/pro/mexc.js +302 -8
  39. package/dist/cjs/src/pro/poloniex.js +6 -2
  40. package/examples/js/cli.js +127 -13
  41. package/js/ccxt.d.ts +2 -11
  42. package/js/ccxt.js +2 -8
  43. package/js/src/abstract/blofin.d.ts +8 -0
  44. package/js/src/abstract/btcbox.d.ts +1 -0
  45. package/js/src/apex.js +2 -1
  46. package/js/src/base/Exchange.d.ts +15 -1
  47. package/js/src/base/Exchange.js +15 -2
  48. package/js/src/base/types.d.ts +3 -0
  49. package/js/src/bitget.js +1 -3
  50. package/js/src/bitrue.js +14 -35
  51. package/js/src/bitso.js +33 -0
  52. package/js/src/bitstamp.js +33 -0
  53. package/js/src/blofin.d.ts +42 -2
  54. package/js/src/blofin.js +154 -13
  55. package/js/src/btcbox.js +25 -5
  56. package/js/src/bybit.js +16 -40
  57. package/js/src/cex.js +2 -4
  58. package/js/src/coinbase.js +56 -40
  59. package/js/src/coinbaseexchange.js +142 -32
  60. package/js/src/coincatch.js +14 -67
  61. package/js/src/coinex.js +28 -29
  62. package/js/src/coinlist.js +16 -15
  63. package/js/src/coinmetro.js +22 -11
  64. package/js/src/coinone.js +8 -10
  65. package/js/src/coinsph.d.ts +10 -1
  66. package/js/src/coinsph.js +126 -1
  67. package/js/src/cryptocom.d.ts +10 -1
  68. package/js/src/cryptocom.js +111 -1
  69. package/js/src/cryptomus.js +43 -89
  70. package/js/src/delta.js +76 -36
  71. package/js/src/derive.js +46 -10
  72. package/js/src/ellipx.d.ts +2 -3
  73. package/js/src/ellipx.js +175 -80
  74. package/js/src/gate.js +1 -1
  75. package/js/src/gemini.js +3 -5
  76. package/js/src/hitbtc.js +56 -69
  77. package/js/src/hyperliquid.js +2 -2
  78. package/js/src/kraken.js +29 -24
  79. package/js/src/kucoinfutures.d.ts +1 -0
  80. package/js/src/kucoinfutures.js +6 -0
  81. package/js/src/lbank.js +1 -1
  82. package/js/src/paradex.d.ts +12 -1
  83. package/js/src/paradex.js +119 -3
  84. package/js/src/pro/binance.d.ts +26 -26
  85. package/js/src/pro/binance.js +31 -33
  86. package/js/src/pro/bithumb.js +5 -3
  87. package/js/src/pro/kraken.d.ts +7 -6
  88. package/js/src/pro/kraken.js +290 -80
  89. package/js/src/pro/mexc.d.ts +58 -0
  90. package/js/src/pro/mexc.js +302 -8
  91. package/js/src/pro/poloniex.d.ts +1 -1
  92. package/js/src/pro/poloniex.js +6 -2
  93. package/package.json +1 -1
  94. package/js/src/abstract/bl3p.d.ts +0 -22
  95. package/js/src/abstract/bl3p.js +0 -11
  96. package/js/src/abstract/idex.d.ts +0 -29
  97. package/js/src/abstract/idex.js +0 -11
  98. package/js/src/bl3p.d.ts +0 -116
  99. package/js/src/bl3p.js +0 -552
  100. package/js/src/idex.d.ts +0 -312
  101. package/js/src/idex.js +0 -1961
  102. package/js/src/pro/idex.d.ts +0 -81
  103. package/js/src/pro/idex.js +0 -720
@@ -876,7 +876,7 @@ class lbank extends lbank$1 {
876
876
  if (market['swap']) {
877
877
  return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
878
878
  }
879
- return this.parseOrderBook(orderbook, market['symbol'], timestamp);
879
+ return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 1, 0);
880
880
  }
881
881
  parseTrade(trade, market = undefined) {
882
882
  //
@@ -72,6 +72,7 @@ class paradex extends paradex$1 {
72
72
  'fetchFundingRate': false,
73
73
  'fetchFundingRateHistory': false,
74
74
  'fetchFundingRates': false,
75
+ 'fetchGreeks': true,
75
76
  'fetchIndexOHLCV': false,
76
77
  'fetchIsolatedBorrowRate': false,
77
78
  'fetchIsolatedBorrowRates': false,
@@ -554,15 +555,16 @@ class paradex extends paradex$1 {
554
555
  let expiry = this.safeInteger(market, 'expiry_at');
555
556
  const optionType = this.safeString(market, 'option_type');
556
557
  const strikePrice = this.safeString(market, 'strike_price');
558
+ const takerFee = this.parseNumber('0.0003');
559
+ let makerFee = this.parseNumber('-0.00005');
557
560
  if (isOption) {
558
561
  const optionTypeSuffix = (optionType === 'CALL') ? 'C' : 'P';
559
562
  symbol = symbol + '-' + strikePrice + '-' + optionTypeSuffix;
563
+ makerFee = this.parseNumber('0.0003');
560
564
  }
561
565
  else {
562
566
  expiry = undefined;
563
567
  }
564
- const takerFee = this.parseNumber('0.0003');
565
- const makerFee = this.parseNumber('-0.00005');
566
568
  return this.safeMarketStructure({
567
569
  'id': marketId,
568
570
  'symbol': symbol,
@@ -1275,7 +1277,7 @@ class paradex extends paradex$1 {
1275
1277
  'status': this.parseOrderStatus(status),
1276
1278
  'symbol': symbol,
1277
1279
  'type': this.parseOrderType(orderType),
1278
- 'timeInForce': this.parseTimeInForce(this.safeString(order, 'instrunction')),
1280
+ 'timeInForce': this.parseTimeInForce(this.safeString(order, 'instruction')),
1279
1281
  'postOnly': undefined,
1280
1282
  'reduceOnly': reduceOnly,
1281
1283
  'side': side,
@@ -2345,6 +2347,120 @@ class paradex extends paradex$1 {
2345
2347
  };
2346
2348
  return await this.privatePostAccountMarginMarket(this.extend(request, params));
2347
2349
  }
2350
+ /**
2351
+ * @method
2352
+ * @name paradex#fetchGreeks
2353
+ * @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
2354
+ * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary
2355
+ * @param {string} symbol unified symbol of the market to fetch greeks for
2356
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2357
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
2358
+ */
2359
+ async fetchGreeks(symbol, params = {}) {
2360
+ await this.loadMarkets();
2361
+ const market = this.market(symbol);
2362
+ const request = {
2363
+ 'market': market['id'],
2364
+ };
2365
+ const response = await this.publicGetMarketsSummary(this.extend(request, params));
2366
+ //
2367
+ // {
2368
+ // "results": [
2369
+ // {
2370
+ // "symbol": "BTC-USD-114000-P",
2371
+ // "mark_price": "10835.66892602",
2372
+ // "mark_iv": "0.71781855",
2373
+ // "delta": "-0.98726024",
2374
+ // "greeks": {
2375
+ // "delta": "-0.9872602390817709",
2376
+ // "gamma": "0.000004560958862297231",
2377
+ // "vega": "227.11344863639806",
2378
+ // "rho": "-302.0617972461581",
2379
+ // "vanna": "0.06609830491614832",
2380
+ // "volga": "925.9501532805552"
2381
+ // },
2382
+ // "last_traded_price": "10551.5",
2383
+ // "bid": "10794.9",
2384
+ // "bid_iv": "0.05",
2385
+ // "ask": "10887.3",
2386
+ // "ask_iv": "0.8783283",
2387
+ // "last_iv": "0.05",
2388
+ // "volume_24h": "0",
2389
+ // "total_volume": "195240.72672261014",
2390
+ // "created_at": 1747644009995,
2391
+ // "underlying_price": "103164.79162649",
2392
+ // "open_interest": "0",
2393
+ // "funding_rate": "0.000004464241170536191",
2394
+ // "price_change_rate_24h": "0.074915",
2395
+ // "future_funding_rate": "0.0001"
2396
+ // }
2397
+ // ]
2398
+ // }
2399
+ //
2400
+ const data = this.safeList(response, 'results', []);
2401
+ const greeks = this.safeDict(data, 0, {});
2402
+ return this.parseGreeks(greeks, market);
2403
+ }
2404
+ parseGreeks(greeks, market = undefined) {
2405
+ //
2406
+ // {
2407
+ // "symbol": "BTC-USD-114000-P",
2408
+ // "mark_price": "10835.66892602",
2409
+ // "mark_iv": "0.71781855",
2410
+ // "delta": "-0.98726024",
2411
+ // "greeks": {
2412
+ // "delta": "-0.9872602390817709",
2413
+ // "gamma": "0.000004560958862297231",
2414
+ // "vega": "227.11344863639806",
2415
+ // "rho": "-302.0617972461581",
2416
+ // "vanna": "0.06609830491614832",
2417
+ // "volga": "925.9501532805552"
2418
+ // },
2419
+ // "last_traded_price": "10551.5",
2420
+ // "bid": "10794.9",
2421
+ // "bid_iv": "0.05",
2422
+ // "ask": "10887.3",
2423
+ // "ask_iv": "0.8783283",
2424
+ // "last_iv": "0.05",
2425
+ // "volume_24h": "0",
2426
+ // "total_volume": "195240.72672261014",
2427
+ // "created_at": 1747644009995,
2428
+ // "underlying_price": "103164.79162649",
2429
+ // "open_interest": "0",
2430
+ // "funding_rate": "0.000004464241170536191",
2431
+ // "price_change_rate_24h": "0.074915",
2432
+ // "future_funding_rate": "0.0001"
2433
+ // }
2434
+ //
2435
+ const marketId = this.safeString(greeks, 'symbol');
2436
+ market = this.safeMarket(marketId, market, undefined, 'option');
2437
+ const symbol = market['symbol'];
2438
+ const timestamp = this.safeInteger(greeks, 'created_at');
2439
+ const greeksData = this.safeDict(greeks, 'greeks', {});
2440
+ return {
2441
+ 'symbol': symbol,
2442
+ 'timestamp': timestamp,
2443
+ 'datetime': this.iso8601(timestamp),
2444
+ 'delta': this.safeNumber(greeksData, 'delta'),
2445
+ 'gamma': this.safeNumber(greeksData, 'gamma'),
2446
+ 'theta': undefined,
2447
+ 'vega': this.safeNumber(greeksData, 'vega'),
2448
+ 'rho': this.safeNumber(greeksData, 'rho'),
2449
+ 'vanna': this.safeNumber(greeksData, 'vanna'),
2450
+ 'volga': this.safeNumber(greeksData, 'volga'),
2451
+ 'bidSize': undefined,
2452
+ 'askSize': undefined,
2453
+ 'bidImpliedVolatility': this.safeNumber(greeks, 'bid_iv'),
2454
+ 'askImpliedVolatility': this.safeNumber(greeks, 'ask_iv'),
2455
+ 'markImpliedVolatility': this.safeNumber(greeks, 'mark_iv'),
2456
+ 'bidPrice': this.safeNumber(greeks, 'bid'),
2457
+ 'askPrice': this.safeNumber(greeks, 'ask'),
2458
+ 'markPrice': this.safeNumber(greeks, 'mark_price'),
2459
+ 'lastPrice': this.safeNumber(greeks, 'last_traded_price'),
2460
+ 'underlyingPrice': this.safeNumber(greeks, 'underlying_price'),
2461
+ 'info': greeks,
2462
+ };
2463
+ }
2348
2464
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2349
2465
  let url = this.implodeHostname(this.urls['api'][this.version]) + '/' + this.implodeParams(path, params);
2350
2466
  const query = this.omit(params, this.extractParams(path));
@@ -737,7 +737,7 @@ class binance extends binance$1 {
737
737
  * @method
738
738
  * @name binance#fetchOrderBookWs
739
739
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
740
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#order-book
740
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#order-book
741
741
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api/Order-Book
742
742
  * @param {string} symbol unified symbol of the market to fetch the order book for
743
743
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -900,10 +900,8 @@ class binance extends binance$1 {
900
900
  // ]
901
901
  // }
902
902
  //
903
- const isTestnetSpot = client.url.indexOf('testnet') > 0;
904
- const isSpotMainNet = client.url.indexOf('/stream.binance.') > 0;
905
- const isSpot = isTestnetSpot || isSpotMainNet;
906
- const marketType = isSpot ? 'spot' : 'contract';
903
+ const isSpot = (client.url.indexOf('/stream') > -1);
904
+ const marketType = (isSpot) ? 'spot' : 'contract';
907
905
  const marketId = this.safeString(message, 's');
908
906
  const market = this.safeMarket(marketId, undefined, undefined, marketType);
909
907
  const symbol = market['symbol'];
@@ -1040,8 +1038,8 @@ class binance extends binance$1 {
1040
1038
  * @method
1041
1039
  * @name binance#watchTradesForSymbols
1042
1040
  * @description get the list of most recent trades for a list of symbols
1043
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#aggregate-trades
1044
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#recent-trades
1041
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
1042
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
1045
1043
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1046
1044
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1047
1045
  * @param {string[]} symbols unified symbol of the market to fetch trades for
@@ -1103,8 +1101,8 @@ class binance extends binance$1 {
1103
1101
  * @method
1104
1102
  * @name binance#unWatchTradesForSymbols
1105
1103
  * @description unsubscribes from the trades channel
1106
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#aggregate-trades
1107
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#recent-trades
1104
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
1105
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
1108
1106
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1109
1107
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1110
1108
  * @param {string[]} symbols unified symbol of the market to fetch trades for
@@ -1165,8 +1163,8 @@ class binance extends binance$1 {
1165
1163
  * @method
1166
1164
  * @name binance#unWatchTrades
1167
1165
  * @description unsubscribes from the trades channel
1168
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#aggregate-trades
1169
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#recent-trades
1166
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
1167
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
1170
1168
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1171
1169
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1172
1170
  * @param {string} symbol unified symbol of the market to fetch trades for
@@ -1182,8 +1180,8 @@ class binance extends binance$1 {
1182
1180
  * @method
1183
1181
  * @name binance#watchTrades
1184
1182
  * @description get the list of most recent trades for a particular symbol
1185
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#aggregate-trades
1186
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#recent-trades
1183
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
1184
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
1187
1185
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1188
1186
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
1189
1187
  * @param {string} symbol unified symbol of the market to fetch trades for
@@ -1362,7 +1360,7 @@ class binance extends binance$1 {
1362
1360
  handleTrade(client, message) {
1363
1361
  // the trade streams push raw trade information in real-time
1364
1362
  // each trade has a unique buyer and seller
1365
- const isSpot = ((client.url.indexOf('wss://stream.binance.com') > -1) || (client.url.indexOf('/testnet.binance') > -1));
1363
+ const isSpot = (client.url.indexOf('/stream') > -1);
1366
1364
  const marketType = (isSpot) ? 'spot' : 'contract';
1367
1365
  const marketId = this.safeString(message, 's');
1368
1366
  const market = this.safeMarket(marketId, undefined, undefined, marketType);
@@ -1382,7 +1380,7 @@ class binance extends binance$1 {
1382
1380
  * @method
1383
1381
  * @name binance#watchOHLCV
1384
1382
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1385
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#klines
1383
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
1386
1384
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1387
1385
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1388
1386
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
@@ -1405,7 +1403,7 @@ class binance extends binance$1 {
1405
1403
  * @method
1406
1404
  * @name binance#watchOHLCVForSymbols
1407
1405
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1408
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#klines
1406
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
1409
1407
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1410
1408
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1411
1409
  * @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
@@ -1471,7 +1469,7 @@ class binance extends binance$1 {
1471
1469
  * @method
1472
1470
  * @name binance#unWatchOHLCVForSymbols
1473
1471
  * @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1474
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#klines
1472
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
1475
1473
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1476
1474
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1477
1475
  * @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
@@ -1538,7 +1536,7 @@ class binance extends binance$1 {
1538
1536
  * @method
1539
1537
  * @name binance#unWatchOHLCV
1540
1538
  * @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1541
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#klines
1539
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
1542
1540
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1543
1541
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
1544
1542
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
@@ -1604,7 +1602,7 @@ class binance extends binance$1 {
1604
1602
  this.safeFloat(kline, 'c'),
1605
1603
  this.safeFloat(kline, 'v'),
1606
1604
  ];
1607
- const isSpot = ((client.url.indexOf('/stream') > -1) || (client.url.indexOf('/testnet.binance') > -1));
1605
+ const isSpot = (client.url.indexOf('/stream') > -1);
1608
1606
  const marketType = (isSpot) ? 'spot' : 'contract';
1609
1607
  const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
1610
1608
  const messageHash = 'ohlcv::' + symbol + '::' + unifiedTimeframe;
@@ -1663,7 +1661,7 @@ class binance extends binance$1 {
1663
1661
  * @method
1664
1662
  * @name binance#fetchOHLCVWs
1665
1663
  * @description query historical candlestick data containing the open, high, low, and close price, and the volume of a market
1666
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#klines
1664
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
1667
1665
  * @param {string} symbol unified symbol of the market to query OHLCV data for
1668
1666
  * @param {string} timeframe the length of time each candle represents
1669
1667
  * @param {int} since timestamp in ms of the earliest candle to fetch
@@ -1946,7 +1944,7 @@ class binance extends binance$1 {
1946
1944
  * @method
1947
1945
  * @name binance#watchBidsAsks
1948
1946
  * @description watches best bid & ask for symbols
1949
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#symbol-order-book-ticker
1947
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#symbol-order-book-ticker
1950
1948
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/All-Book-Tickers-Stream
1951
1949
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Book-Tickers-Stream
1952
1950
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
@@ -2246,7 +2244,7 @@ class binance extends binance$1 {
2246
2244
  this.handleTickersAndBidsAsks(client, message, 'tickers');
2247
2245
  }
2248
2246
  handleTickersAndBidsAsks(client, message, methodType) {
2249
- const isSpot = ((client.url.indexOf('/stream') > -1) || (client.url.indexOf('/testnet.binance') > -1));
2247
+ const isSpot = (client.url.indexOf('/stream') > -1);
2250
2248
  const marketType = (isSpot) ? 'spot' : 'contract';
2251
2249
  const isBidAsk = (methodType === 'bidasks');
2252
2250
  let channelName = undefined;
@@ -2505,7 +2503,7 @@ class binance extends binance$1 {
2505
2503
  * @name binance#fetchBalanceWs
2506
2504
  * @description fetch balance and get the amount of funds available for trading or funds locked in orders
2507
2505
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
2508
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/account-requests#account-information-user_data
2506
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/account-requests#account-information-user_data
2509
2507
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api
2510
2508
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2511
2509
  * @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
@@ -2875,7 +2873,7 @@ class binance extends binance$1 {
2875
2873
  * @method
2876
2874
  * @name binance#createOrderWs
2877
2875
  * @description create a trade order
2878
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#place-new-order-trade
2876
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#place-new-order-trade
2879
2877
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
2880
2878
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
2881
2879
  * @param {string} symbol unified symbol of the market to create an order in
@@ -3024,7 +3022,7 @@ class binance extends binance$1 {
3024
3022
  * @method
3025
3023
  * @name binance#editOrderWs
3026
3024
  * @description edit a trade order
3027
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#cancel-and-replace-order-trade
3025
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-and-replace-order-trade
3028
3026
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
3029
3027
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Modify-Order
3030
3028
  * @param {string} id order id
@@ -3182,7 +3180,7 @@ class binance extends binance$1 {
3182
3180
  * @method
3183
3181
  * @name binance#cancelOrderWs
3184
3182
  * @description cancel multiple orders
3185
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#cancel-order-trade
3183
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-order-trade
3186
3184
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
3187
3185
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
3188
3186
  * @param {string} id order id
@@ -3229,7 +3227,7 @@ class binance extends binance$1 {
3229
3227
  * @method
3230
3228
  * @name binance#cancelAllOrdersWs
3231
3229
  * @description cancel all open orders in a market
3232
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#cancel-open-orders-trade
3230
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-open-orders-trade
3233
3231
  * @param {string} [symbol] unified market symbol of the market to cancel orders in
3234
3232
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3235
3233
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -3264,7 +3262,7 @@ class binance extends binance$1 {
3264
3262
  * @method
3265
3263
  * @name binance#fetchOrderWs
3266
3264
  * @description fetches information on an order made by the user
3267
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#query-order-user_data
3265
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#query-order-user_data
3268
3266
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
3269
3267
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Query-Order
3270
3268
  * @param {string} id order id
@@ -3312,7 +3310,7 @@ class binance extends binance$1 {
3312
3310
  * @method
3313
3311
  * @name binance#fetchOrdersWs
3314
3312
  * @description fetches information on multiple orders made by the user
3315
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#order-lists
3313
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#order-lists
3316
3314
  * @param {string} symbol unified market symbol of the market orders were made in
3317
3315
  * @param {int|undefined} [since] the earliest time in ms to fetch orders for
3318
3316
  * @param {int|undefined} [limit] the maximum number of order structures to retrieve
@@ -3357,7 +3355,7 @@ class binance extends binance$1 {
3357
3355
  * @method
3358
3356
  * @name binance#fetchClosedOrdersWs
3359
3357
  * @description fetch closed orders
3360
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#order-lists
3358
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#order-lists
3361
3359
  * @param {string} symbol unified market symbol
3362
3360
  * @param {int} [since] the earliest time in ms to fetch open orders for
3363
3361
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -3379,7 +3377,7 @@ class binance extends binance$1 {
3379
3377
  * @method
3380
3378
  * @name binance#fetchOpenOrdersWs
3381
3379
  * @description fetch all unfilled currently open orders
3382
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/trading-requests#current-open-orders-user_data
3380
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#current-open-orders-user_data
3383
3381
  * @param {string} symbol unified market symbol
3384
3382
  * @param {int|undefined} [since] the earliest time in ms to fetch open orders for
3385
3383
  * @param {int|undefined} [limit] the maximum number of open orders structures to retrieve
@@ -3942,7 +3940,7 @@ class binance extends binance$1 {
3942
3940
  * @method
3943
3941
  * @name binance#fetchMyTradesWs
3944
3942
  * @description fetch all trades made by the user
3945
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/account-requests#account-trade-history-user_data
3943
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/account-requests#account-trade-history-user_data
3946
3944
  * @param {string} symbol unified market symbol
3947
3945
  * @param {int|undefined} [since] the earliest time in ms to fetch trades for
3948
3946
  * @param {int|undefined} [limit] the maximum number of trades structures to retrieve
@@ -3995,7 +3993,7 @@ class binance extends binance$1 {
3995
3993
  * @method
3996
3994
  * @name binance#fetchTradesWs
3997
3995
  * @description fetch all trades made by the user
3998
- * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/market-data-requests#recent-trades
3996
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
3999
3997
  * @param {string} symbol unified market symbol
4000
3998
  * @param {int} [since] the earliest time in ms to fetch trades for
4001
3999
  * @param {int} [limit] the maximum number of trades structures to retrieve, default=500, max=1000
@@ -324,18 +324,20 @@ class bithumb extends bithumb$1 {
324
324
  // "contPrice" : "10579000",
325
325
  // "contQty" : "0.01",
326
326
  // "contAmt" : "105790.00",
327
- // "contDtm" : "2020-01-29 12:24:18.830039",
327
+ // "contDtm" : "2020-01-29 12:24:18.830038",
328
328
  // "updn" : "dn"
329
329
  // }
330
330
  //
331
331
  const marketId = this.safeString(trade, 'symbol');
332
332
  const datetime = this.safeString(trade, 'contDtm');
333
+ // that date is not UTC iso8601, but exchange's local time, -9hr difference
334
+ const timestamp = this.parse8601(datetime) - 32400000;
333
335
  const sideId = this.safeString(trade, 'buySellGb');
334
336
  return this.safeTrade({
335
337
  'id': undefined,
336
338
  'info': trade,
337
- 'timestamp': this.parse8601(datetime),
338
- 'datetime': datetime,
339
+ 'timestamp': timestamp,
340
+ 'datetime': this.iso8601(timestamp),
339
341
  'symbol': this.safeSymbol(marketId, market, '_'),
340
342
  'order': undefined,
341
343
  'type': undefined,