ccxt 4.0.78 → 4.0.80

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 (50) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +189 -169
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/binance.js +78 -67
  6. package/dist/cjs/src/bithumb.js +1 -1
  7. package/dist/cjs/src/bitmex.js +2 -2
  8. package/dist/cjs/src/bybit.js +4 -2
  9. package/dist/cjs/src/coinsph.js +2 -2
  10. package/dist/cjs/src/krakenfutures.js +2 -2
  11. package/dist/cjs/src/mexc.js +1 -0
  12. package/dist/cjs/src/okcoin.js +2 -2
  13. package/dist/cjs/src/okx.js +1 -1
  14. package/dist/cjs/src/phemex.js +8 -3
  15. package/dist/cjs/src/poloniex.js +54 -74
  16. package/dist/cjs/src/pro/bitget.js +18 -2
  17. package/dist/cjs/src/pro/gate.js +5 -3
  18. package/dist/cjs/src/pro/kraken.js +2 -2
  19. package/dist/cjs/src/probit.js +2 -2
  20. package/dist/cjs/src/upbit.js +1 -1
  21. package/dist/cjs/src/wavesexchange.js +4 -2
  22. package/dist/cjs/src/wazirx.js +1 -0
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/binance.d.ts +12 -1
  26. package/js/src/abstract/binancecoinm.d.ts +12 -1
  27. package/js/src/abstract/binanceus.d.ts +12 -1
  28. package/js/src/abstract/binanceusdm.d.ts +12 -1
  29. package/js/src/abstract/bybit.d.ts +1 -0
  30. package/js/src/abstract/mexc.d.ts +1 -0
  31. package/js/src/abstract/mexc3.d.ts +1 -0
  32. package/js/src/binance.js +78 -67
  33. package/js/src/bithumb.js +1 -1
  34. package/js/src/bitmex.js +2 -2
  35. package/js/src/bybit.js +4 -2
  36. package/js/src/coinsph.js +2 -2
  37. package/js/src/krakenfutures.js +2 -2
  38. package/js/src/mexc.js +1 -0
  39. package/js/src/okcoin.js +2 -2
  40. package/js/src/okx.js +1 -1
  41. package/js/src/phemex.js +8 -3
  42. package/js/src/poloniex.js +54 -74
  43. package/js/src/pro/bitget.js +19 -3
  44. package/js/src/pro/gate.js +5 -3
  45. package/js/src/pro/kraken.js +2 -2
  46. package/js/src/probit.js +2 -2
  47. package/js/src/upbit.js +1 -1
  48. package/js/src/wavesexchange.js +4 -2
  49. package/js/src/wazirx.js +1 -0
  50. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.0.78';
183
+ const version = '4.0.80';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -186,12 +186,11 @@ class binance extends binance$1 {
186
186
  'api': {
187
187
  // the API structure below will need 3-layer apidefs
188
188
  'sapi': {
189
- // IP (api) = 1200 per minute => (rateLimit = 50)
190
189
  // IP (sapi) request rate limit of 12 000 per minute
191
- // 1 IP (sapi) => cost = 0.1
190
+ // 1 IP (sapi) => cost = 0.1 => (1000 / (50 * 0.1)) * 60 = 12000
192
191
  // 10 IP (sapi) => cost = 1
193
192
  // UID (sapi) request rate limit of 180 000 per minute
194
- // 1 UID (sapi) => cost = 1200 / 180 000 = 0.006667
193
+ // 1 UID (sapi) => cost = 0.006667 => (1000 / (50 * 0.006667)) * 60 = 180000
195
194
  'get': {
196
195
  'system/status': 0.1,
197
196
  // these endpoints require this.apiKey
@@ -207,7 +206,7 @@ class binance extends binance$1 {
207
206
  'asset/transfer': 0.1,
208
207
  'asset/assetDetail': 0.1,
209
208
  'asset/tradeFee': 0.1,
210
- 'asset/ledger-transfer/cloud-mining/queryByPage': 4,
209
+ 'asset/ledger-transfer/cloud-mining/queryByPage': 4.0002,
211
210
  'asset/convert-transfer/queryByPage': 0.033335,
212
211
  'margin/loan': 1,
213
212
  'margin/repay': 1,
@@ -236,15 +235,16 @@ class binance extends binance$1 {
236
235
  'margin/isolatedMarginTier': 0.1,
237
236
  'margin/rateLimit/order': 2,
238
237
  'margin/dribblet': 0.1,
239
- 'margin/dust': 20,
238
+ 'margin/dust': 20.001,
240
239
  'margin/crossMarginCollateralRatio': 10,
241
240
  'margin/exchange-small-liability': 0.6667,
242
241
  'margin/exchange-small-liability-history': 0.6667,
243
242
  'margin/next-hourly-interest-rate': 0.6667,
243
+ 'margin/delist-schedule': 0.6667,
244
244
  'loan/vip/loanable/data': 40,
245
245
  'loan/vip/collateral/data': 40,
246
- 'loan/vip/request/data': 40,
247
- 'loan/income': 40,
246
+ 'loan/vip/request/data': 2.6668,
247
+ 'loan/income': 40.002,
248
248
  'loan/ongoing/orders': 40,
249
249
  'loan/ltv/adjustment/history': 40,
250
250
  'loan/borrow/history': 40,
@@ -263,7 +263,7 @@ class binance extends binance$1 {
263
263
  'futures/loan/wallet': 1,
264
264
  'futures/loan/adjustCollateral/history': 1,
265
265
  'futures/loan/liquidationHistory': 1,
266
- 'rebate/taxQuery': 20.001,
266
+ 'rebate/taxQuery': 80.004,
267
267
  // https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
268
268
  'capital/config/getall': 1,
269
269
  'capital/deposit/address': 1,
@@ -272,7 +272,7 @@ class binance extends binance$1 {
272
272
  'capital/deposit/subHisrec': 0.1,
273
273
  'capital/withdraw/history': 0.1,
274
274
  'capital/contract/convertible-coins': 4.0002,
275
- 'convert/tradeFlow': 20.0001,
275
+ 'convert/tradeFlow': 20.001,
276
276
  'convert/exchangeInfo': 50,
277
277
  'convert/assetInfo': 10,
278
278
  'convert/orderStatus': 0.6667,
@@ -280,7 +280,6 @@ class binance extends binance$1 {
280
280
  'account/apiTradingStatus': 0.1,
281
281
  'account/apiRestrictions/ipRestriction': 0.1,
282
282
  'bnbBurn': 0.1,
283
- // 'sub-account/assets': 1, (v3 endpoint)
284
283
  'sub-account/futures/account': 1,
285
284
  'sub-account/futures/accountSummary': 0.1,
286
285
  'sub-account/futures/positionRisk': 1,
@@ -294,15 +293,16 @@ class binance extends binance$1 {
294
293
  'sub-account/transfer/subUserHistory': 0.1,
295
294
  'sub-account/universalTransfer': 0.1,
296
295
  'sub-account/apiRestrictions/ipRestriction/thirdPartyList': 1,
297
- 'sub-account/transaction-tatistics': 0.4,
296
+ 'sub-account/transaction-statistics': 0.40002,
297
+ 'sub-account/subAccountApi/ipRestriction': 20.001,
298
298
  'managed-subaccount/asset': 0.1,
299
299
  'managed-subaccount/accountSnapshot': 240,
300
300
  'managed-subaccount/queryTransLogForInvestor': 0.1,
301
- 'managed-subaccount/queryTransLogForTradeParent': 0.1,
302
- 'managed-subaccount/fetch-future-asset': 0.1,
301
+ 'managed-subaccount/queryTransLogForTradeParent': 0.40002,
302
+ 'managed-subaccount/fetch-future-asset': 0.40002,
303
303
  'managed-subaccount/marginAsset': 0.1,
304
- 'managed-subaccount/info': 0.4,
305
- 'managed-subaccount/deposit/address': 0.1,
304
+ 'managed-subaccount/info': 0.40002,
305
+ 'managed-subaccount/deposit/address': 0.006667,
306
306
  'managed-subaccount/query-trans-log': 0.40002,
307
307
  // lending endpoints
308
308
  'lending/daily/product/list': 0.1,
@@ -380,6 +380,9 @@ class binance extends binance$1 {
380
380
  'giftcard/verify': 0.1,
381
381
  'giftcard/cryptography/rsa-public-key': 0.1,
382
382
  'giftcard/buyCode/token-limit': 0.1,
383
+ 'algo/spot/openOrders': 0.1,
384
+ 'algo/spot/historicalOrders': 0.1,
385
+ 'algo/spot/subOrders': 0.1,
383
386
  'algo/futures/openOrders': 0.1,
384
387
  'algo/futures/historicalOrders': 0.1,
385
388
  'algo/futures/subOrders': 0.1,
@@ -421,9 +424,9 @@ class binance extends binance$1 {
421
424
  'simple-earn/flexible/history/collateralRecord': 0.1,
422
425
  },
423
426
  'post': {
424
- 'asset/dust': 1,
427
+ 'asset/dust': 0.06667,
425
428
  'asset/dust-btc': 0.1,
426
- 'asset/transfer': 0.1,
429
+ 'asset/transfer': 6.0003,
427
430
  'asset/get-funding-asset': 0.1,
428
431
  'asset/convert-transfer': 0.033335,
429
432
  'account/disableFastWithdrawSwitch': 0.1,
@@ -433,12 +436,12 @@ class binance extends binance$1 {
433
436
  'capital/withdraw/apply': 4.0002,
434
437
  'capital/contract/convertible-coins': 4.0002,
435
438
  'capital/deposit/credit-apply': 0.1,
436
- 'margin/transfer': 1,
439
+ 'margin/transfer': 4.0002,
437
440
  'margin/loan': 20.001,
438
441
  'margin/repay': 20.001,
439
442
  'margin/order': 0.040002,
440
443
  'margin/order/oco': 0.040002,
441
- 'margin/dust': 20,
444
+ 'margin/dust': 20.001,
442
445
  'margin/exchange-small-liability': 20.001,
443
446
  // 'margin/isolated/create': 1, discontinued
444
447
  'margin/isolated/transfer': 4.0002,
@@ -455,8 +458,6 @@ class binance extends binance$1 {
455
458
  'sub-account/transfer/subToMaster': 0.1,
456
459
  'sub-account/universalTransfer': 0.1,
457
460
  'sub-account/options/enable': 0.1,
458
- // v2 not supported yet
459
- // 'sub-account/subAccountApi/ipRestriction': 20,
460
461
  'managed-subaccount/deposit': 0.1,
461
462
  'managed-subaccount/withdraw': 0.1,
462
463
  'userDataStream': 0.1,
@@ -502,6 +503,7 @@ class binance extends binance$1 {
502
503
  'giftcard/createCode': 0.1,
503
504
  'giftcard/redeemCode': 0.1,
504
505
  'giftcard/buyCode': 0.1,
506
+ 'algo/spot/newOrderTwap': 20.001,
505
507
  'algo/futures/newOrderVp': 20.001,
506
508
  'algo/futures/newOrderTwap': 20.001,
507
509
  // staking
@@ -509,14 +511,14 @@ class binance extends binance$1 {
509
511
  'staking/redeem': 0.1,
510
512
  'staking/setAutoStaking': 0.1,
511
513
  'portfolio/repay': 20.001,
512
- 'loan/vip/renew': 40,
513
- 'loan/vip/borrow': 40,
514
- 'loan/borrow': 40,
515
- 'loan/repay': 40,
516
- 'loan/adjust/ltv': 40,
517
- 'loan/customize/margin_call': 40,
518
- 'loan/vip/repay': 40,
519
- 'convert/getQuote': 20.001,
514
+ 'loan/vip/renew': 40.002,
515
+ 'loan/vip/borrow': 40.002,
516
+ 'loan/borrow': 40.002,
517
+ 'loan/repay': 40.002,
518
+ 'loan/adjust/ltv': 40.002,
519
+ 'loan/customize/margin_call': 40.002,
520
+ 'loan/vip/repay': 40.002,
521
+ 'convert/getQuote': 1.3334,
520
522
  'convert/acceptQuote': 3.3335,
521
523
  'portfolio/auto-collection': 150,
522
524
  'portfolio/asset-collection': 6,
@@ -541,15 +543,17 @@ class binance extends binance$1 {
541
543
  'delete': {
542
544
  // 'account/apiRestrictions/ipRestriction/ipList': 1, discontinued
543
545
  'margin/openOrders': 0.1,
544
- 'margin/order': 0.0066667,
545
- 'margin/orderList': 0.0066667,
546
+ 'margin/order': 0.006667,
547
+ 'margin/orderList': 0.006667,
546
548
  'margin/isolated/account': 2.0001,
547
549
  'userDataStream': 0.1,
548
550
  'userDataStream/isolated': 0.1,
549
551
  // brokerage API TODO NO MENTION OF RATELIMIT IN BROKERAGE DOCS
550
552
  'broker/subAccountApi': 1,
551
553
  'broker/subAccountApi/ipRestriction/ipList': 1,
554
+ 'algo/spot/order': 0.1,
552
555
  'algo/futures/order': 0.1,
556
+ 'sub-account/subAccountApi/ipRestriction/ipList': 20.001, // Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
553
557
  },
554
558
  },
555
559
  'sapiV2': {
@@ -557,10 +561,13 @@ class binance extends binance$1 {
557
561
  'sub-account/futures/account': 0.1,
558
562
  'sub-account/futures/positionRisk': 0.1,
559
563
  },
564
+ 'post': {
565
+ 'sub-account/subAccountApi/ipRestriction': 20.001, // Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
566
+ },
560
567
  },
561
568
  'sapiV3': {
562
569
  'get': {
563
- 'sub-account/assets': 1,
570
+ 'sub-account/assets': 0.40002, // Weight(UID): 60 => cost = 0.006667 * 60 = 0.40002
564
571
  },
565
572
  'post': {
566
573
  'asset/getUserAsset': 0.5,
@@ -568,7 +575,7 @@ class binance extends binance$1 {
568
575
  },
569
576
  'sapiV4': {
570
577
  'get': {
571
- 'sub-account/assets': 1,
578
+ 'sub-account/assets': 0.40002, // Weight(UID): 60 => cost = 0.006667 * 60 = 0.40002
572
579
  },
573
580
  },
574
581
  // deprecated
@@ -823,55 +830,59 @@ class binance extends binance$1 {
823
830
  },
824
831
  },
825
832
  'public': {
833
+ // IP (api) request rate limit of 6000 per minute
834
+ // 1 IP (api) => cost = 0.2 => (1000 / (50 * 0.2)) * 60 = 6000
826
835
  'get': {
827
- 'ping': 1,
828
- 'time': 1,
829
- 'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]] },
830
- 'trades': 1,
831
- 'aggTrades': 1,
832
- 'historicalTrades': 5,
833
- 'klines': 1,
834
- 'ticker/24hr': { 'cost': 1, 'noSymbol': 40 },
835
- 'ticker/price': { 'cost': 1, 'noSymbol': 2 },
836
- 'ticker/bookTicker': { 'cost': 1, 'noSymbol': 2 },
837
- 'exchangeInfo': 10,
836
+ 'ping': 0.2,
837
+ 'time': 0.2,
838
+ 'depth': { 'cost': 0.4, 'byLimit': [[100, 0.4], [500, 2], [1000, 4], [5000, 20]] },
839
+ 'trades': 0.4,
840
+ 'aggTrades': 0.4,
841
+ 'historicalTrades': 2,
842
+ 'klines': 0.4,
843
+ 'uiKlines': 0.4,
844
+ 'ticker/24hr': { 'cost': 0.4, 'noSymbol': 16 },
845
+ 'ticker/price': { 'cost': 0.4, 'noSymbol': 0.8 },
846
+ 'ticker/bookTicker': { 'cost': 0.4, 'noSymbol': 0.8 },
847
+ 'exchangeInfo': 4,
848
+ 'avgPrice': 0.4,
838
849
  },
839
850
  'put': {
840
- 'userDataStream': 1,
851
+ 'userDataStream': 0.4,
841
852
  },
842
853
  'post': {
843
- 'userDataStream': 1,
854
+ 'userDataStream': 0.4,
844
855
  },
845
856
  'delete': {
846
- 'userDataStream': 1,
857
+ 'userDataStream': 0.4,
847
858
  },
848
859
  },
849
860
  'private': {
850
861
  'get': {
851
- 'allOrderList': 10,
852
- 'openOrderList': 3,
853
- 'orderList': 2,
854
- 'order': 2,
855
- 'openOrders': { 'cost': 3, 'noSymbol': 40 },
856
- 'allOrders': 10,
857
- 'account': 10,
858
- 'myTrades': 10,
859
- 'rateLimit/order': 20,
860
- 'myPreventedMatches': 1,
861
- 'myAllocations': 10,
862
+ 'allOrderList': 4,
863
+ 'openOrderList': 1.2,
864
+ 'orderList': 0.8,
865
+ 'order': 0.8,
866
+ 'openOrders': { 'cost': 1.2, 'noSymbol': 16 },
867
+ 'allOrders': 4,
868
+ 'account': 4,
869
+ 'myTrades': 4,
870
+ 'rateLimit/order': 8,
871
+ 'myPreventedMatches': 4,
872
+ 'myAllocations': 4,
862
873
  },
863
874
  'post': {
864
- 'order/oco': 1,
865
- 'sor/order': 1,
866
- 'sor/order/test': 1,
867
- 'order': 1,
868
- 'order/cancelReplace': 1,
869
- 'order/test': 1,
875
+ 'order/oco': 0.2,
876
+ 'sor/order': 0.2,
877
+ 'sor/order/test': 0.2,
878
+ 'order': 0.2,
879
+ 'order/cancelReplace': 0.2,
880
+ 'order/test': 0.2,
870
881
  },
871
882
  'delete': {
872
- 'openOrders': 1,
873
- 'orderList': 1,
874
- 'order': 1,
883
+ 'openOrders': 0.2,
884
+ 'orderList': 0.2,
885
+ 'order': 0.2,
875
886
  },
876
887
  },
877
888
  'papi': {
@@ -633,7 +633,7 @@ class bithumb extends bithumb$1 {
633
633
  await this.loadMarkets();
634
634
  const market = this.market(symbol);
635
635
  const request = {
636
- 'currency': market['base'],
636
+ 'currency': market['base'] + '_' + market['quote'],
637
637
  };
638
638
  if (limit !== undefined) {
639
639
  request['count'] = limit; // default 20, max 100
@@ -1351,8 +1351,8 @@ class bitmex extends bitmex$1 {
1351
1351
  'change': undefined,
1352
1352
  'percentage': undefined,
1353
1353
  'average': undefined,
1354
- 'baseVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'homeNotional24h')),
1355
- 'quoteVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'foreignNotional24h')),
1354
+ 'baseVolume': this.safeString(ticker, 'homeNotional24h'),
1355
+ 'quoteVolume': this.safeString(ticker, 'foreignNotional24h'),
1356
1356
  'info': ticker,
1357
1357
  }, market);
1358
1358
  }
@@ -248,6 +248,7 @@ class bybit extends bybit$1 {
248
248
  'v5/spot-lever-token/info': 2.5,
249
249
  'v5/spot-lever-token/reference': 2.5,
250
250
  // spot margin trade
251
+ 'v5/spot-margin-trade/data': 2.5,
251
252
  'v5/spot-cross-margin-trade/data': 2.5,
252
253
  'v5/spot-cross-margin-trade/pledge-token': 2.5,
253
254
  'v5/spot-cross-margin-trade/borrow-token': 2.5,
@@ -2527,7 +2528,8 @@ class bybit extends bybit$1 {
2527
2528
  if (symbols !== undefined) {
2528
2529
  symbols = this.marketSymbols(symbols);
2529
2530
  market = this.market(symbols[0]);
2530
- if (symbols.length === 1) {
2531
+ const symbolsLength = symbols.length;
2532
+ if (symbolsLength === 1) {
2531
2533
  request['symbol'] = market['id'];
2532
2534
  }
2533
2535
  }
@@ -3911,7 +3913,7 @@ class bybit extends bybit$1 {
3911
3913
  const cost = this.safeNumber(params, 'cost');
3912
3914
  params = this.omit(params, 'cost');
3913
3915
  if (price === undefined && cost === undefined) {
3914
- throw new errors.InvalidOrder(this.id + " createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false to supply the cost in the amount argument (the exchange-specific behaviour)");
3916
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
3915
3917
  }
3916
3918
  else {
3917
3919
  const amountString = this.numberToString(amount);
@@ -1865,9 +1865,9 @@ class coinsph extends coinsph$1 {
1865
1865
  if (i !== 0) {
1866
1866
  encodedArrayParams += '&';
1867
1867
  }
1868
- const array = query[key];
1868
+ const innerArray = query[key];
1869
1869
  query = this.omit(query, key);
1870
- const encodedArrayParam = this.parseArrayParam(array, key);
1870
+ const encodedArrayParam = this.parseArrayParam(innerArray, key);
1871
1871
  encodedArrayParams += encodedArrayParam;
1872
1872
  }
1873
1873
  }
@@ -1217,7 +1217,7 @@ class krakenfutures extends krakenfutures$1 {
1217
1217
  let statusId = undefined;
1218
1218
  let price = undefined;
1219
1219
  let trades = [];
1220
- if (orderEvents.length > 0) {
1220
+ if (orderEvents.length) {
1221
1221
  const executions = [];
1222
1222
  for (let i = 0; i < orderEvents.length; i++) {
1223
1223
  const item = orderEvents[i];
@@ -1265,7 +1265,7 @@ class krakenfutures extends krakenfutures$1 {
1265
1265
  let remaining = this.safeString(details, 'unfilledSize');
1266
1266
  let average = undefined;
1267
1267
  let filled2 = '0.0';
1268
- if (trades.length > 0) {
1268
+ if (trades.length) {
1269
1269
  let vwapSum = '0.0';
1270
1270
  for (let i = 0; i < trades.length; i++) {
1271
1271
  const trade = trades[i];
@@ -192,6 +192,7 @@ class mexc extends mexc$1 {
192
192
  'rebate/detail': 1,
193
193
  'rebate/detail/kickback': 1,
194
194
  'rebate/referCode': 1,
195
+ 'rebate/affiliate/commission': 1,
195
196
  'mxDeduct/enable': 1,
196
197
  'userDataStream': 1,
197
198
  },
@@ -2010,7 +2010,7 @@ class okcoin extends okcoin$1 {
2010
2010
  }
2011
2011
  }
2012
2012
  else if (notional === undefined) {
2013
- throw new errors.InvalidOrder(this.id + " createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false and supply the total cost value in the 'amount' argument or in the 'notional' extra parameter (the exchange-specific behaviour)");
2013
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false and supply the total cost value in the "amount" argument or in the "notional" extra parameter (the exchange-specific behaviour)');
2014
2014
  }
2015
2015
  }
2016
2016
  else {
@@ -3487,7 +3487,7 @@ class okcoin extends okcoin$1 {
3487
3487
  let currency = undefined;
3488
3488
  if (type === 'spot') {
3489
3489
  if (code === undefined) {
3490
- throw new errors.ArgumentsRequired(this.id + " fetchLedger() requires a currency code argument for '" + type + "' markets");
3490
+ throw new errors.ArgumentsRequired(this.id + ' fetchLedger() requires a currency code argument for "' + type + '" markets');
3491
3491
  }
3492
3492
  argument = 'Currency';
3493
3493
  currency = this.currency(code);
@@ -4315,7 +4315,7 @@ class okx extends okx$1 {
4315
4315
  const targetNetwork = this.safeValue(currency['networks'], this.networkIdToCode(network), {});
4316
4316
  fee = this.safeString(targetNetwork, 'fee');
4317
4317
  if (fee === undefined) {
4318
- throw new errors.ArgumentsRequired(this.id + " withdraw() requires a 'fee' string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set '0'. Withdrawing to external digital asset address requires network transaction fee.");
4318
+ throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a "fee" string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set "0". Withdrawing to external digital asset address requires network transaction fee.');
4319
4319
  }
4320
4320
  }
4321
4321
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
@@ -1607,8 +1607,13 @@ class phemex extends phemex$1 {
1607
1607
  id = this.safeString2(trade, 'execId', 'execID');
1608
1608
  orderId = this.safeString(trade, 'orderID');
1609
1609
  if (market['settle'] === 'USDT') {
1610
- const sideId = this.safeString(trade, 'side');
1611
- side = (sideId === '1') ? 'buy' : 'sell';
1610
+ const sideId = this.safeStringLower(trade, 'side');
1611
+ if ((sideId === 'buy') || (sideId === 'sell')) {
1612
+ side = sideId;
1613
+ }
1614
+ else if (sideId !== undefined) {
1615
+ side = (sideId === '1') ? 'buy' : 'sell';
1616
+ }
1612
1617
  const ordType = this.safeString(trade, 'ordType');
1613
1618
  if (ordType === '1') {
1614
1619
  type = 'market';
@@ -1616,7 +1621,7 @@ class phemex extends phemex$1 {
1616
1621
  else if (ordType === '2') {
1617
1622
  type = 'limit';
1618
1623
  }
1619
- priceString = this.safeString(trade, 'priceRp');
1624
+ priceString = this.safeString(trade, 'execPriceRp');
1620
1625
  amountString = this.safeString(trade, 'execQtyRq');
1621
1626
  costString = this.safeString(trade, 'execValueRv');
1622
1627
  feeCostString = this.safeString(trade, 'execFeeRv');