ccxt 4.2.25 → 4.2.27

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/dist/cjs/ccxt.js CHANGED
@@ -56,6 +56,7 @@ var coincheck = require('./src/coincheck.js');
56
56
  var coinex = require('./src/coinex.js');
57
57
  var coinlist = require('./src/coinlist.js');
58
58
  var coinmate = require('./src/coinmate.js');
59
+ var coinmetro = require('./src/coinmetro.js');
59
60
  var coinone = require('./src/coinone.js');
60
61
  var coinsph = require('./src/coinsph.js');
61
62
  var coinspot = require('./src/coinspot.js');
@@ -174,7 +175,7 @@ var woo$1 = require('./src/pro/woo.js');
174
175
 
175
176
  //-----------------------------------------------------------------------------
176
177
  // this is updated by vss.js when building
177
- const version = '4.2.25';
178
+ const version = '4.2.27';
178
179
  Exchange["default"].ccxtVersion = version;
179
180
  const exchanges = {
180
181
  'ace': ace,
@@ -221,6 +222,7 @@ const exchanges = {
221
222
  'coinex': coinex,
222
223
  'coinlist': coinlist,
223
224
  'coinmate': coinmate,
225
+ 'coinmetro': coinmetro,
224
226
  'coinone': coinone,
225
227
  'coinsph': coinsph,
226
228
  'coinspot': coinspot,
@@ -424,6 +426,7 @@ exports.coincheck = coincheck;
424
426
  exports.coinex = coinex;
425
427
  exports.coinlist = coinlist;
426
428
  exports.coinmate = coinmate;
429
+ exports.coinmetro = coinmetro;
427
430
  exports.coinone = coinone;
428
431
  exports.coinsph = coinsph;
429
432
  exports.coinspot = coinspot;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Exchange$1 = require('../base/Exchange.js');
4
+
5
+ // -------------------------------------------------------------------------------
6
+ class Exchange extends Exchange$1["default"] {
7
+ }
8
+
9
+ module.exports = Exchange;
@@ -1252,15 +1252,13 @@ class Exchange {
1252
1252
  client.throttle(cost).then(() => {
1253
1253
  client.send(message);
1254
1254
  }).catch((e) => {
1255
- delete client.subscriptions[subscribeHash];
1256
- future.reject(e);
1255
+ client.onError(e);
1257
1256
  });
1258
1257
  }
1259
1258
  else {
1260
1259
  client.send(message)
1261
1260
  .catch((e) => {
1262
- delete client.subscriptions[subscribeHash];
1263
- future.reject(e);
1261
+ client.onError(e);
1264
1262
  });
1265
1263
  }
1266
1264
  }
@@ -4080,6 +4078,9 @@ class Exchange {
4080
4078
  return this.cancelOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
4081
4079
  }
4082
4080
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4081
+ if (this.has['fetchOpenOrders'] && this.has['fetchClosedOrders']) {
4082
+ throw new errors.NotSupported(this.id + ' fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() instead');
4083
+ }
4083
4084
  throw new errors.NotSupported(this.id + ' fetchOrders() is not supported yet');
4084
4085
  }
4085
4086
  async fetchOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -145,7 +145,10 @@ class Client {
145
145
  }
146
146
  else {
147
147
  if (this.ping) {
148
- this.send(this.ping(this));
148
+ this.send(this.ping(this))
149
+ .catch((error) => {
150
+ this.onError(error);
151
+ });
149
152
  }
150
153
  else if (platform.isNode) {
151
154
  // can't do this inside browser
@@ -55,6 +55,7 @@ class bingx extends bingx$1 {
55
55
  'fetchLeverage': true,
56
56
  'fetchLiquidations': false,
57
57
  'fetchMarkets': true,
58
+ 'fetchMarkOHLCV': true,
58
59
  'fetchMyLiquidations': true,
59
60
  'fetchOHLCV': true,
60
61
  'fetchOpenInterest': true,
@@ -159,6 +160,7 @@ class bingx extends bingx$1 {
159
160
  'private': {
160
161
  'get': {
161
162
  'positionSide/dual': 1,
163
+ 'market/markPriceKlines': 1,
162
164
  },
163
165
  'post': {
164
166
  'positionSide/dual': 1,
@@ -684,6 +686,7 @@ class bingx extends bingx$1 {
684
686
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
685
687
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
686
688
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
689
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
687
690
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
688
691
  * @param {string} timeframe the length of time each candle represents
689
692
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -720,7 +723,14 @@ class bingx extends bingx$1 {
720
723
  response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
721
724
  }
722
725
  else {
723
- response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
726
+ const price = this.safeString(params, 'price');
727
+ params = this.omit(params, 'price');
728
+ if (price === 'mark') {
729
+ response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
730
+ }
731
+ else {
732
+ response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
733
+ }
724
734
  }
725
735
  //
726
736
  // {
@@ -739,6 +749,24 @@ class bingx extends bingx$1 {
739
749
  // ]
740
750
  // }
741
751
  //
752
+ // fetchMarkOHLCV
753
+ //
754
+ // {
755
+ // "code": 0,
756
+ // "msg": "",
757
+ // "data": [
758
+ // {
759
+ // "open": "42191.7",
760
+ // "close": "42189.5",
761
+ // "high": "42196.5",
762
+ // "low": "42189.5",
763
+ // "volume": "0.00",
764
+ // "openTime": 1706508840000,
765
+ // "closeTime": 1706508840000
766
+ // }
767
+ // ]
768
+ // }
769
+ //
742
770
  let ohlcvs = this.safeValue(response, 'data', []);
743
771
  if (!Array.isArray(ohlcvs)) {
744
772
  ohlcvs = [ohlcvs];
@@ -755,6 +783,18 @@ class bingx extends bingx$1 {
755
783
  // "volume": "167.44",
756
784
  // "time": 1666584000000
757
785
  // }
786
+ //
787
+ // fetchMarkOHLCV
788
+ //
789
+ // {
790
+ // "open": "42191.7",
791
+ // "close": "42189.5",
792
+ // "high": "42196.5",
793
+ // "low": "42189.5",
794
+ // "volume": "0.00",
795
+ // "openTime": 1706508840000,
796
+ // "closeTime": 1706508840000
797
+ // }
758
798
  // spot
759
799
  // [
760
800
  // 1691402580000,
@@ -778,7 +818,7 @@ class bingx extends bingx$1 {
778
818
  ];
779
819
  }
780
820
  return [
781
- this.safeInteger(ohlcv, 'time'),
821
+ this.safeInteger2(ohlcv, 'time', 'closeTime'),
782
822
  this.safeNumber(ohlcv, 'open'),
783
823
  this.safeNumber(ohlcv, 'high'),
784
824
  this.safeNumber(ohlcv, 'low'),
@@ -2235,10 +2275,10 @@ class bingx extends bingx$1 {
2235
2275
  const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
2236
2276
  let stopLoss = this.safeValue(order, 'stopLoss');
2237
2277
  let stopLossPrice = undefined;
2238
- if (stopLoss !== undefined) {
2278
+ if ((stopLoss !== undefined) && (stopLoss !== '')) {
2239
2279
  stopLossPrice = this.safeNumber(stopLoss, 'stopLoss');
2240
2280
  }
2241
- if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
2281
+ if ((stopLoss !== undefined) && (typeof stopLoss !== 'number') && (stopLoss !== '')) {
2242
2282
  // stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
2243
2283
  if (typeof stopLoss === 'string') {
2244
2284
  stopLoss = this.parseJson(stopLoss);
@@ -2247,10 +2287,10 @@ class bingx extends bingx$1 {
2247
2287
  }
2248
2288
  let takeProfit = this.safeValue(order, 'takeProfit');
2249
2289
  let takeProfitPrice = undefined;
2250
- if (takeProfit !== undefined) {
2290
+ if (takeProfit !== undefined && (takeProfit !== '')) {
2251
2291
  takeProfitPrice = this.safeNumber(takeProfit, 'takeProfit');
2252
2292
  }
2253
- if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
2293
+ if ((takeProfit !== undefined) && (typeof takeProfit !== 'number') && (takeProfit !== '')) {
2254
2294
  // takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
2255
2295
  if (typeof takeProfit === 'string') {
2256
2296
  takeProfit = this.parseJson(takeProfit);
@@ -3337,11 +3337,16 @@ class coinbase extends coinbase$1 {
3337
3337
  'Content-Type': 'application/json',
3338
3338
  };
3339
3339
  }
3340
- else if (this.token) {
3340
+ else if (this.token && !this.checkRequiredCredentials(false)) {
3341
3341
  headers = {
3342
3342
  'Authorization': 'Bearer ' + this.token,
3343
3343
  'Content-Type': 'application/json',
3344
3344
  };
3345
+ if (method !== 'GET') {
3346
+ if (Object.keys(query).length) {
3347
+ body = this.json(query);
3348
+ }
3349
+ }
3345
3350
  }
3346
3351
  else {
3347
3352
  this.checkRequiredCredentials();