ccxt 4.2.96 → 4.2.97

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/CHANGELOG.md CHANGED
@@ -1,3 +1,54 @@
1
+ ## 4.2.95 (2024-04-11)
2
+
3
+ * coinex: fetchOrderBook v2 (#22116) [c4ba8f0e6e](https://github.com/ccxt/ccxt/commits/c4ba8f0e6e71560ed18d9b34ac1fa5e162703f0e)
4
+ * fix(coinbasePro): handle alias (#22120) [c564ea56bb](https://github.com/ccxt/ccxt/commits/c564ea56bb18d3f3be1d539fe1ab0ee58180634d)
5
+ * Added support for CSPR, VCHF, VEUR (#22119) [52a2024186](https://github.com/ccxt/ccxt/commits/52a20241861297cd1181a0510633c1f3b486cde3)
6
+ * fix(gemini): parseMarket was parsing 'USDCUSD' as CUSD/USD. (#22112) [3b70b13513](https://github.com/ccxt/ccxt/commits/3b70b135132f404382fed546eb7ceb6cfda68b5d)
7
+ * fix(OrderBook.ts): add asks/bids/datetime/nonce/timestamp prop (#22122) [b9666e7f9a](https://github.com/ccxt/ccxt/commits/b9666e7f9ada6765038df422ea845cf066b1b3a0)
8
+ * errors autogeneration (#22013) [47adb25b9e](https://github.com/ccxt/ccxt/commits/47adb25b9ef7c5b82afe68481aba8565a27dfc51)
9
+ * Okx replacing safeValue (#22078) [6c39b84f1c](https://github.com/ccxt/ccxt/commits/6c39b84f1c676583e1e09fe4fc87b4df6d93d65d)
10
+ * 4.2.95 [b9a93b236d](https://github.com/ccxt/ccxt/commits/b9a93b236decd8a0562cf34652693554f5101036)
11
+
12
+
13
+ ## 4.2.94 (2024-04-10)
14
+
15
+ * new method: fetchConvertQuote (#22055) [2af4fb101f](https://github.com/ccxt/ccxt/commits/2af4fb101f37fe493002c86c340663b09ff4c5c0)
16
+ * fix(Kucoin): watchTickers topic should not be all if symbols passed (#22106) [a1beeed2cc](https://github.com/ccxt/ccxt/commits/a1beeed2ccd24ba20bdf637fdc3ea00d99539d4d)
17
+ * fix(cli): read pem secrets properly (#22108) [99928fb124](https://github.com/ccxt/ccxt/commits/99928fb124aa946a17d959fb1a737d156a7b60f1)
18
+ * binance: fix fetchIndexOHLCV inverse pair parameter (#22107) [aea845c5ba](https://github.com/ccxt/ccxt/commits/aea845c5ba0997bc06781be0e1a250de4840367b)
19
+ * binance: add POST /api/v3/orderList/oco (#22035) [e854ba4def](https://github.com/ccxt/ccxt/commits/e854ba4defeb9343390bef360869531433c42be9)
20
+ * new method: fetchConvertCurrencies (#22047) [3749d70367](https://github.com/ccxt/ccxt/commits/3749d70367abc898d5bb5f771280c6f0bfd71a83)
21
+ * fix(Kucoin): read watchTicker's method from config (#22109) [ae043f2e4e](https://github.com/ccxt/ccxt/commits/ae043f2e4e39591ab057492cae7f1f9b1debfa92)
22
+ * 4.2.94 [bc924c9772](https://github.com/ccxt/ccxt/commits/bc924c97729954d31c639f9da6806c9f1587e000)
23
+
24
+
25
+ ## 4.2.93 (2024-04-09)
26
+
27
+ * feat(probit): fetchDepositsWithdrawals (#22096) [e04ea38a75](https://github.com/ccxt/ccxt/commits/e04ea38a75dc9fc2f8b8b938f763f3493582268b)
28
+ * encode types (#22097) [473789a53e](https://github.com/ccxt/ccxt/commits/473789a53e08e379d4b93b5770a51204b1f1a2cc)
29
+ * refactor(exchange): parseLeverageTiers accepts either a dictionary or an array (#22099) [440bc4e2ad](https://github.com/ccxt/ccxt/commits/440bc4e2ad4f343e55484f5f1164b859b13b2e3a)
30
+ * 4.2.93 [d14da7def7](https://github.com/ccxt/ccxt/commits/d14da7def776ce180976a67d98a0e59e17bfd9a9)
31
+
32
+
33
+ ## 4.2.92 (2024-04-08)
34
+
35
+ * fix(php): remove define_rest_api (#22089) [805e7dc2ff](https://github.com/ccxt/ccxt/commits/805e7dc2ff78132f256e2bc56d10caa448934fae)
36
+ * bybit: add broker api (#22090) [756d124cfe](https://github.com/ccxt/ccxt/commits/756d124cfe96ffcd49574a5e8aaf8fd61584f89c)
37
+ * fix(kraken): parse fetchPositions (#22091) [6d3dbd2543](https://github.com/ccxt/ccxt/commits/6d3dbd25435022c3bc040e550959849f5a5969d7)
38
+ * 4.2.92 [e371291066](https://github.com/ccxt/ccxt/commits/e37129106693682cf012fac6bf8e2c58a1a25ff7)
39
+
40
+
41
+ ## 4.2.91 (2024-04-07)
42
+
43
+ * fix(gemini): replace * when fetch market from web (#22068) [d65f0dbabc](https://github.com/ccxt/ccxt/commits/d65f0dbabc4467fd6738767380e1bb7d6306884d)
44
+ * feat(coinbase): add clientorderid prefix (#22071) [530b32845f](https://github.com/ccxt/ccxt/commits/530b32845f39013287d5871a0b9ce305a78fe51f)
45
+ * Okx replacing safeValue to safeBool/Dict/List (#22052) [6628f54c1c](https://github.com/ccxt/ccxt/commits/6628f54c1c3abee7965d2ae2ac9aa5b408eb0f59)
46
+ * fix(Exchange): parseToInt string conversion and Crc32 fix (#22082) [2ed6dc9dfb](https://github.com/ccxt/ccxt/commits/2ed6dc9dfbc7bfcb3da7fee9fbf4f4c33de93e41)
47
+ * feat(bimex): add watchTradesForSymbols (#22080) [6c411a82cd](https://github.com/ccxt/ccxt/commits/6c411a82cd4c63524a60519c0ff8940a9c4e313f)
48
+ * revert commonCurrencyCode & fix fDWF currencies (#22079) [0586480358](https://github.com/ccxt/ccxt/commits/0586480358699f9311ed6752d79b183d8e894c22)
49
+ * 4.2.91 [ea4cff3544](https://github.com/ccxt/ccxt/commits/ea4cff3544ddc9167ef35d3ab4753e89e5b137c2)
50
+
51
+
1
52
  ## 4.2.90 (2024-04-05)
2
53
 
3
54
  * bingx: update apis (#22049) [2add1e7c23](https://github.com/ccxt/ccxt/commits/2add1e7c23c48cf920de6ca2c05883b72d19eabb)
package/README.md CHANGED
@@ -212,13 +212,13 @@ console.log(version, Object.keys(exchanges));
212
212
 
213
213
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
214
214
 
215
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.96/dist/ccxt.browser.js
216
- * unpkg: https://unpkg.com/ccxt@4.2.96/dist/ccxt.browser.js
215
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.97/dist/ccxt.browser.js
216
+ * unpkg: https://unpkg.com/ccxt@4.2.97/dist/ccxt.browser.js
217
217
 
218
218
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
219
219
 
220
220
  ```HTML
221
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.96/dist/ccxt.browser.js"></script>
221
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.97/dist/ccxt.browser.js"></script>
222
222
  ```
223
223
 
224
224
  Creates a global `ccxt` object:
@@ -11282,11 +11282,26 @@ class Exchange {
11282
11282
  const [result, empty] = this.handleOptionAndParams({}, methodName, optionName, defaultValue);
11283
11283
  return result;
11284
11284
  }
11285
- handleMarketTypeAndParams(methodName, market = undefined, params = {}) {
11285
+ handleMarketTypeAndParams(methodName, market = undefined, params = {}, defaultValue = undefined) {
11286
+ /**
11287
+ * @ignore
11288
+ * @method
11289
+ * @name exchange#handleMarketTypeAndParams
11290
+ * @param methodName the method calling handleMarketTypeAndParams
11291
+ * @param {Market} market
11292
+ * @param {object} params
11293
+ * @param {string} [params.type] type assigned by user
11294
+ * @param {string} [params.defaultType] same as params.type
11295
+ * @param {string} [defaultValue] assigned programatically in the method calling handleMarketTypeAndParams
11296
+ * @returns {[string, object]} the market type and params with type and defaultType omitted
11297
+ */
11286
11298
  const defaultType = this.safeString2(this.options, 'defaultType', 'type', 'spot');
11299
+ if (defaultValue === undefined) { // defaultValue takes precendence over exchange wide defaultType
11300
+ defaultValue = defaultType;
11301
+ }
11287
11302
  const methodOptions = this.safeDict(this.options, methodName);
11288
- let methodType = defaultType;
11289
- if (methodOptions !== undefined) {
11303
+ let methodType = defaultValue;
11304
+ if (methodOptions !== undefined) { // user defined methodType takes precedence over defaultValue
11290
11305
  if (typeof methodOptions === 'string') {
11291
11306
  methodType = methodOptions;
11292
11307
  }
@@ -24463,7 +24478,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24463
24478
  response = await this.dapiPrivatePostOrder(request);
24464
24479
  }
24465
24480
  }
24466
- else if (marketType === 'margin' || marginMode !== undefined) {
24481
+ else if (marketType === 'margin' || marginMode !== undefined || isPortfolioMargin) {
24467
24482
  if (isPortfolioMargin) {
24468
24483
  response = await this.papiPostMarginOrder(request);
24469
24484
  }
@@ -24565,15 +24580,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24565
24580
  uppercaseType = market['contract'] ? 'TAKE_PROFIT' : 'TAKE_PROFIT_LIMIT';
24566
24581
  }
24567
24582
  }
24568
- if ((marketType === 'spot') || (marketType === 'margin')) {
24569
- request['newOrderRespType'] = this.safeString(this.options['newOrderRespType'], type, 'RESULT'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
24570
- }
24571
- else {
24572
- // swap, futures and options
24573
- if (!isPortfolioMargin) {
24574
- request['newOrderRespType'] = 'RESULT'; // "ACK", "RESULT", default "ACK"
24575
- }
24576
- }
24577
24583
  if (market['option']) {
24578
24584
  if (type === 'market') {
24579
24585
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' ' + type + ' is not a valid order type for the ' + symbol + ' market');
@@ -24613,6 +24619,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24613
24619
  }
24614
24620
  }
24615
24621
  }
24622
+ // handle newOrderRespType response type
24623
+ if (((marketType === 'spot') || (marketType === 'margin')) && !isPortfolioMargin) {
24624
+ request['newOrderRespType'] = this.safeString(this.options['newOrderRespType'], type, 'FULL'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
24625
+ }
24626
+ else {
24627
+ // swap, futures and options
24628
+ request['newOrderRespType'] = 'RESULT'; // "ACK", "RESULT", default "ACK"
24629
+ }
24616
24630
  const typeRequest = isPortfolioMarginConditional ? 'strategyType' : 'type';
24617
24631
  request[typeRequest] = uppercaseType;
24618
24632
  // additional required fields depending on the order type
@@ -25266,7 +25280,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25266
25280
  response = await this.dapiPrivateGetOpenOrders(this.extend(request, params));
25267
25281
  }
25268
25282
  }
25269
- else if (type === 'margin' || marginMode !== undefined) {
25283
+ else if (type === 'margin' || marginMode !== undefined || isPortfolioMargin) {
25270
25284
  if (isPortfolioMargin) {
25271
25285
  response = await this.papiGetMarginOpenOrders(this.extend(request, params));
25272
25286
  }
@@ -25767,7 +25781,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25767
25781
  response = await this.dapiPrivateDeleteAllOpenOrders(this.extend(request, params));
25768
25782
  }
25769
25783
  }
25770
- else if ((type === 'margin') || (marginMode !== undefined)) {
25784
+ else if ((type === 'margin') || (marginMode !== undefined) || isPortfolioMargin) {
25771
25785
  if (isPortfolioMargin) {
25772
25786
  response = await this.papiDeleteMarginAllOpenOrders(this.extend(request, params));
25773
25787
  }
@@ -95840,12 +95854,18 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
95840
95854
  this.v3PrivateGetBrokerageProducts(params),
95841
95855
  this.v3PrivateGetBrokerageTransactionSummary(params),
95842
95856
  ];
95843
- const unresolvedContractPromises = [
95844
- this.v3PrivateGetBrokerageProducts(this.extend(params, { 'product_type': 'FUTURE' })),
95845
- this.v3PrivateGetBrokerageProducts(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
95846
- this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE' })),
95847
- this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
95848
- ];
95857
+ let unresolvedContractPromises = [];
95858
+ try {
95859
+ unresolvedContractPromises = [
95860
+ this.v3PrivateGetBrokerageProducts(this.extend(params, { 'product_type': 'FUTURE' })),
95861
+ this.v3PrivateGetBrokerageProducts(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
95862
+ this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE' })),
95863
+ this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
95864
+ ];
95865
+ }
95866
+ catch (e) {
95867
+ unresolvedContractPromises = []; // the sync version of ccxt won't have the promise.all line so the request is made here
95868
+ }
95849
95869
  const promises = await Promise.all(spotUnresolvedPromises);
95850
95870
  let contractPromises = undefined;
95851
95871
  try {
@@ -128679,13 +128699,18 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
128679
128699
  * @name deribit#fetchTickers
128680
128700
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
128681
128701
  * @see https://docs.deribit.com/#public-get_book_summary_by_currency
128682
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
128702
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
128683
128703
  * @param {object} [params] extra parameters specific to the exchange API endpoint
128704
+ * @param {string} [params.code] *required* the currency code to fetch the tickers for, eg. 'BTC', 'ETH'
128684
128705
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
128685
128706
  */
128686
128707
  await this.loadMarkets();
128687
128708
  symbols = this.marketSymbols(symbols);
128688
- const code = this.codeFromOptions('fetchTickers', params);
128709
+ const code = this.safeString2(params, 'code', 'currency');
128710
+ params = this.omit(params, ['code']);
128711
+ if (code === undefined) {
128712
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchTickers requires a currency/code (eg: BTC/ETH/USDT) parameter to fetch tickers for');
128713
+ }
128689
128714
  const currency = this.currency(code);
128690
128715
  const request = {
128691
128716
  'currency': currency['id'],
@@ -128721,7 +128746,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
128721
128746
  // "testnet": false
128722
128747
  // }
128723
128748
  //
128724
- const result = this.safeValue(response, 'result', []);
128749
+ const result = this.safeList(response, 'result', []);
128725
128750
  const tickers = {};
128726
128751
  for (let i = 0; i < result.length; i++) {
128727
128752
  const ticker = this.parseTicker(result[i]);
@@ -208766,14 +208791,14 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
208766
208791
  },
208767
208792
  });
208768
208793
  }
208769
- handleMarketTypeAndParams(methodName, market = undefined, params = {}) {
208794
+ handleMarketTypeAndParams(methodName, market = undefined, params = {}, defaultValue = undefined) {
208770
208795
  const instType = this.safeString(params, 'instType');
208771
208796
  params = this.omit(params, 'instType');
208772
208797
  const type = this.safeString(params, 'type');
208773
208798
  if ((type === undefined) && (instType !== undefined)) {
208774
208799
  params['type'] = instType;
208775
208800
  }
208776
- return super.handleMarketTypeAndParams(methodName, market, params);
208801
+ return super.handleMarketTypeAndParams(methodName, market, params, defaultValue);
208777
208802
  }
208778
208803
  convertToInstrumentType(type) {
208779
208804
  const exchangeTypes = this.safeDict(this.options, 'exchangeType', {});
@@ -226941,7 +226966,10 @@ class poloniexfutures extends _abstract_poloniexfutures_js__WEBPACK_IMPORTED_MOD
226941
226966
  //
226942
226967
  const marketId = this.safeString(ticker, 'symbol');
226943
226968
  const symbol = this.safeSymbol(marketId, market);
226944
- const timestamp = this.safeIntegerProduct(ticker, 'ts', 0.000001);
226969
+ const timestampString = this.safeString(ticker, 'ts');
226970
+ // check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011
226971
+ const multiplier = (timestampString.length === 18) ? 0.00001 : 0.000001;
226972
+ const timestamp = this.safeIntegerProduct(ticker, 'ts', multiplier);
226945
226973
  const last = this.safeString2(ticker, 'price', 'lastPrice');
226946
226974
  const percentage = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(this.safeString(ticker, 'priceChgPct'), '100');
226947
226975
  return this.safeTicker({
@@ -230559,8 +230587,11 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
230559
230587
  }
230560
230588
  }
230561
230589
  else {
230562
- // todo: client.reject from handleOrderBookMessage properly
230563
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' handleOrderBook received an out-of-order nonce');
230590
+ const checksum = this.safeBool(this.options, 'checksum', true);
230591
+ if (checksum) {
230592
+ // todo: client.reject from handleOrderBookMessage properly
230593
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidNonce(this.id + ' handleOrderBook received an out-of-order nonce');
230594
+ }
230564
230595
  }
230565
230596
  }
230566
230597
  }
@@ -230577,8 +230608,11 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
230577
230608
  }
230578
230609
  }
230579
230610
  else {
230580
- // todo: client.reject from handleOrderBookMessage properly
230581
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' handleOrderBook received an out-of-order nonce');
230611
+ const checksum = this.safeBool(this.options, 'checksum', true);
230612
+ if (checksum) {
230613
+ // todo: client.reject from handleOrderBookMessage properly
230614
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidNonce(this.id + ' handleOrderBook received an out-of-order nonce');
230615
+ }
230582
230616
  }
230583
230617
  }
230584
230618
  }
@@ -281105,7 +281139,11 @@ class poloniexfutures extends _poloniexfutures_js__WEBPACK_IMPORTED_MODULE_0__/*
281105
281139
  const sequence = this.safeInteger(delta, 'sequence');
281106
281140
  const nonce = this.safeInteger(orderbook, 'nonce');
281107
281141
  if (nonce !== sequence - 1) {
281108
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' watchOrderBook received an out-of-order nonce');
281142
+ const checksum = this.safeBool(this.options, 'checksum', true);
281143
+ if (checksum) {
281144
+ // todo: client.reject from handleOrderBookMessage properly
281145
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidNonce(this.id + ' watchOrderBook received an out-of-order nonce');
281146
+ }
281109
281147
  }
281110
281148
  const change = this.safeString(delta, 'change');
281111
281149
  const splitChange = change.split(',');
@@ -326802,7 +326840,7 @@ SOFTWARE.
326802
326840
 
326803
326841
  //-----------------------------------------------------------------------------
326804
326842
  // this is updated by vss.js when building
326805
- const version = '4.2.96';
326843
+ const version = '4.2.97';
326806
326844
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
326807
326845
  //-----------------------------------------------------------------------------
326808
326846