ccxt 4.3.21 → 4.3.23

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/phemex.js CHANGED
@@ -1707,6 +1707,26 @@ export default class phemex extends Exchange {
1707
1707
  // "execId": "8718cae",
1708
1708
  // "execStatus": 6
1709
1709
  // }
1710
+ // spot with fees paid using PT token
1711
+ // "createdAt": "1714990724076",
1712
+ // "symbol": "BTCUSDT",
1713
+ // "currency": "USDT",
1714
+ // "action": "1",
1715
+ // "tradeType": "1",
1716
+ // "execQtyRq": "0.003",
1717
+ // "execPriceRp": "64935",
1718
+ // "side": "2",
1719
+ // "orderQtyRq": "0.003",
1720
+ // "priceRp": "51600",
1721
+ // "execValueRv": "194.805",
1722
+ // "feeRateRr": "0.000495",
1723
+ // "execFeeRv": "0",
1724
+ // "ordType": "3",
1725
+ // "execId": "XXXXXX",
1726
+ // "execStatus": "7",
1727
+ // "posSide": "1",
1728
+ // "ptFeeRv": "0.110012249248",
1729
+ // "ptPriceRp": "0.876524893"
1710
1730
  //
1711
1731
  let priceString;
1712
1732
  let amountString;
@@ -1763,10 +1783,19 @@ export default class phemex extends Exchange {
1763
1783
  priceString = this.safeString(trade, 'execPriceRp');
1764
1784
  amountString = this.safeString(trade, 'execQtyRq');
1765
1785
  costString = this.safeString(trade, 'execValueRv');
1766
- feeCostString = this.safeString(trade, 'execFeeRv');
1786
+ feeCostString = this.omitZero(this.safeString(trade, 'execFeeRv'));
1767
1787
  feeRateString = this.safeString(trade, 'feeRateRr');
1768
- const currencyId = this.safeString(trade, 'currency');
1769
- feeCurrencyCode = this.safeCurrencyCode(currencyId);
1788
+ if (feeCostString !== undefined) {
1789
+ const currencyId = this.safeString(trade, 'currency');
1790
+ feeCurrencyCode = this.safeCurrencyCode(currencyId);
1791
+ }
1792
+ else {
1793
+ const ptFeeRv = this.omitZero(this.safeString(trade, 'ptFeeRv'));
1794
+ if (ptFeeRv !== undefined) {
1795
+ feeCostString = ptFeeRv;
1796
+ feeCurrencyCode = 'PT';
1797
+ }
1798
+ }
1770
1799
  }
1771
1800
  else {
1772
1801
  side = this.safeStringLower(trade, 'side');
@@ -1779,7 +1808,7 @@ export default class phemex extends Exchange {
1779
1808
  amountString = this.fromEv(this.safeString(trade, 'execBaseQtyEv'), market);
1780
1809
  amountString = this.safeString(trade, 'execQty', amountString);
1781
1810
  costString = this.fromEr(this.safeString2(trade, 'execQuoteQtyEv', 'execValueEv'), market);
1782
- feeCostString = this.fromEr(this.safeString(trade, 'execFeeEv'), market);
1811
+ feeCostString = this.fromEr(this.omitZero(this.safeString(trade, 'execFeeEv')), market);
1783
1812
  if (feeCostString !== undefined) {
1784
1813
  feeRateString = this.fromEr(this.safeString(trade, 'feeRateEr'), market);
1785
1814
  if (market['spot']) {
@@ -1793,6 +1822,12 @@ export default class phemex extends Exchange {
1793
1822
  }
1794
1823
  }
1795
1824
  }
1825
+ else {
1826
+ feeCostString = this.safeString(trade, 'ptFeeRv');
1827
+ if (feeCostString !== undefined) {
1828
+ feeCurrencyCode = 'PT';
1829
+ }
1830
+ }
1796
1831
  }
1797
1832
  fee = {
1798
1833
  'cost': feeCostString,
@@ -3875,7 +3910,8 @@ export default class phemex extends Exchange {
3875
3910
  request['limit'] = limit;
3876
3911
  }
3877
3912
  let response = undefined;
3878
- if (market['settle'] === 'USDT') {
3913
+ const isUsdt = market['settle'] === 'USDT';
3914
+ if (isUsdt) {
3879
3915
  response = await this.privateGetApiDataGFuturesFundingFees(this.extend(request, params));
3880
3916
  }
3881
3917
  else {
@@ -3890,13 +3926,13 @@ export default class phemex extends Exchange {
3890
3926
  // {
3891
3927
  // "symbol": "BTCUSD",
3892
3928
  // "currency": "BTC",
3893
- // "execQty": 18,
3929
+ // "execQty": 18, // "execQty" regular, but "execQtyRq" in hedge
3894
3930
  // "side": "Buy",
3895
- // "execPriceEp": 360086455,
3896
- // "execValueEv": 49987,
3897
- // "fundingRateEr": 10000,
3898
- // "feeRateEr": 10000,
3899
- // "execFeeEv": 5,
3931
+ // "execPriceEp": 360086455, // "execPriceEp" regular, but "execPriceRp" in hedge
3932
+ // "execValueEv": 49987, // "execValueEv" regular, but "execValueRv" in hedge
3933
+ // "fundingRateEr": 10000, // "fundingRateEr" regular, but "fundingRateRr" in hedge
3934
+ // "feeRateEr": 10000, // "feeRateEr" regular, but "feeRateRr" in hedge
3935
+ // "execFeeEv": 5, // "execFeeEv" regular, but "execFeeRv" in hedge
3900
3936
  // "createTime": 1651881600000
3901
3937
  // }
3902
3938
  // ]
@@ -3909,18 +3945,34 @@ export default class phemex extends Exchange {
3909
3945
  for (let i = 0; i < rows.length; i++) {
3910
3946
  const entry = rows[i];
3911
3947
  const timestamp = this.safeInteger(entry, 'createTime');
3948
+ const execFee = this.safeString2(entry, 'execFeeEv', 'execFeeRv');
3949
+ const currencyCode = this.safeCurrencyCode(this.safeString(entry, 'currency'));
3912
3950
  result.push({
3913
3951
  'info': entry,
3914
3952
  'symbol': this.safeString(entry, 'symbol'),
3915
- 'code': this.safeCurrencyCode(this.safeString(entry, 'currency')),
3953
+ 'code': currencyCode,
3916
3954
  'timestamp': timestamp,
3917
3955
  'datetime': this.iso8601(timestamp),
3918
3956
  'id': undefined,
3919
- 'amount': this.fromEv(this.safeString(entry, 'execFeeEv'), market),
3957
+ 'amount': this.parseFundingFeeToPrecision(execFee, market, currencyCode),
3920
3958
  });
3921
3959
  }
3922
3960
  return result;
3923
3961
  }
3962
+ parseFundingFeeToPrecision(value, market = undefined, currencyCode = undefined) {
3963
+ if (value === undefined || currencyCode === undefined) {
3964
+ return value;
3965
+ }
3966
+ // it was confirmed by phemex support, that USDT contracts use direct amounts in funding fees, while USD & INVERSE needs 'valueScale'
3967
+ const isUsdt = market['settle'] === 'USDT';
3968
+ if (!isUsdt) {
3969
+ const currency = this.safeCurrency(currencyCode);
3970
+ const scale = this.safeString(currency['info'], 'valueScale');
3971
+ const tickPrecision = this.parsePrecision(scale);
3972
+ value = Precise.stringMul(value, tickPrecision);
3973
+ }
3974
+ return value;
3975
+ }
3924
3976
  async fetchFundingRate(symbol, params = {}) {
3925
3977
  /**
3926
3978
  * @method
@@ -846,31 +846,36 @@ export default class poloniexfutures extends poloniexfuturesRest {
846
846
  handleDelta(orderbook, delta) {
847
847
  //
848
848
  // {
849
- // "sequence": 18, // Sequence number which is used to judge the continuity of pushed messages
850
- // "change": "5000.0,sell,83" // Price, side, quantity
851
- // "timestamp": 1551770400000
852
- // }
849
+ // sequence: 123677914,
850
+ // lastSequence: 123677913,
851
+ // change: '80.36,buy,4924',
852
+ // changes: [ '80.19,buy,0',"80.15,buy,10794" ],
853
+ // timestamp: 1715643483528
854
+ // },
853
855
  //
854
856
  const sequence = this.safeInteger(delta, 'sequence');
857
+ const lastSequence = this.safeInteger(delta, 'lastSequence');
855
858
  const nonce = this.safeInteger(orderbook, 'nonce');
856
- if (nonce !== sequence - 1) {
857
- const checksum = this.safeBool(this.options, 'checksum', true);
858
- if (checksum) {
859
- // todo: client.reject from handleOrderBookMessage properly
860
- throw new InvalidNonce(this.id + ' watchOrderBook received an out-of-order nonce');
861
- }
859
+ if (nonce > sequence) {
860
+ return;
861
+ }
862
+ if (nonce !== lastSequence) {
863
+ throw new InvalidNonce(this.id + ' watchOrderBook received an out-of-order nonce');
864
+ }
865
+ const changes = this.safeList(delta, 'changes');
866
+ for (let i = 0; i < changes.length; i++) {
867
+ const change = changes[i];
868
+ const splitChange = change.split(',');
869
+ const price = this.safeNumber(splitChange, 0);
870
+ const side = this.safeString(splitChange, 1);
871
+ const size = this.safeNumber(splitChange, 2);
872
+ const orderBookSide = (side === 'buy') ? orderbook['bids'] : orderbook['asks'];
873
+ orderBookSide.store(price, size);
862
874
  }
863
- const change = this.safeString(delta, 'change');
864
- const splitChange = change.split(',');
865
- const price = this.safeNumber(splitChange, 0);
866
- const side = this.safeString(splitChange, 1);
867
- const size = this.safeNumber(splitChange, 2);
868
875
  const timestamp = this.safeInteger(delta, 'timestamp');
869
876
  orderbook['timestamp'] = timestamp;
870
877
  orderbook['datetime'] = this.iso8601(timestamp);
871
878
  orderbook['nonce'] = sequence;
872
- const orderBookSide = (side === 'buy') ? orderbook['bids'] : orderbook['asks'];
873
- orderBookSide.store(price, size);
874
879
  }
875
880
  handleBalance(client, message) {
876
881
  //
package/js/src/probit.js CHANGED
@@ -208,41 +208,22 @@ export default class probit extends Exchange {
208
208
  },
209
209
  },
210
210
  'commonCurrencies': {
211
- 'AUTO': 'Cube',
212
- 'AZU': 'Azultec',
213
- 'BCC': 'BCC',
214
- 'BDP': 'BidiPass',
215
- 'BIRD': 'Birdchain',
216
- 'BTCBEAR': 'BEAR',
217
- 'BTCBULL': 'BULL',
211
+ 'BB': 'Baby Bali',
218
212
  'CBC': 'CryptoBharatCoin',
219
- 'CHE': 'Chellit',
220
- 'CLR': 'Color Platform',
221
213
  'CTK': 'Cryptyk',
222
214
  'CTT': 'Castweet',
223
- 'DIP': 'Dipper',
224
215
  'DKT': 'DAKOTA',
225
216
  'EGC': 'EcoG9coin',
226
217
  'EPS': 'Epanus',
227
218
  'FX': 'Fanzy',
228
- 'GDT': 'Gorilla Diamond',
229
219
  'GM': 'GM Holding',
230
220
  'GOGOL': 'GOL',
231
221
  'GOL': 'Goldofir',
232
- 'GRB': 'Global Reward Bank',
233
- 'HBC': 'Hybrid Bank Cash',
234
222
  'HUSL': 'The Hustle App',
235
223
  'LAND': 'Landbox',
236
- 'LBK': 'Legal Block',
237
- 'ORC': 'Oracle System',
238
- 'PXP': 'PIXSHOP COIN',
239
- 'PYE': 'CreamPYE',
240
- 'ROOK': 'Reckoon',
241
- 'SOC': 'Soda Coin',
242
224
  'SST': 'SocialSwap',
243
225
  'TCT': 'Top Coin Token',
244
226
  'TOR': 'Torex',
245
- 'TPAY': 'Tetra Pay',
246
227
  'UNI': 'UNICORN Token',
247
228
  'UNISWAP': 'UNI',
248
229
  },
@@ -235,6 +235,15 @@ export default class whitebit extends Exchange {
235
235
  'convert/estimate',
236
236
  'convert/confirm',
237
237
  'convert/history',
238
+ 'sub-account/create',
239
+ 'sub-account/delete',
240
+ 'sub-account/edit',
241
+ 'sub-account/list',
242
+ 'sub-account/transfer',
243
+ 'sub-account/block',
244
+ 'sub-account/unblock',
245
+ 'sub-account/balances',
246
+ 'sub-account/transfer/history',
238
247
  ],
239
248
  },
240
249
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.21",
3
+ "version": "4.3.23",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",