ccxt 4.5.17 → 4.5.18

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 (44) hide show
  1. package/README.md +8 -5
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/deepcoin.js +11 -0
  5. package/dist/cjs/src/apex.js +33 -15
  6. package/dist/cjs/src/base/Exchange.js +3 -3
  7. package/dist/cjs/src/base/ws/Client.js +8 -7
  8. package/dist/cjs/src/bigone.js +20 -0
  9. package/dist/cjs/src/binanceus.js +31 -1
  10. package/dist/cjs/src/blofin.js +4 -1
  11. package/dist/cjs/src/bybit.js +3 -0
  12. package/dist/cjs/src/deepcoin.js +3024 -0
  13. package/dist/cjs/src/pro/ascendex.js +2 -2
  14. package/dist/cjs/src/pro/binance.js +100 -3
  15. package/dist/cjs/src/pro/binanceus.js +19 -0
  16. package/dist/cjs/src/pro/blofin.js +11 -2
  17. package/dist/cjs/src/pro/deepcoin.js +1225 -0
  18. package/dist/cjs/src/pro/kraken.js +5 -1
  19. package/js/ccxt.d.ts +8 -2
  20. package/js/ccxt.js +6 -2
  21. package/js/src/abstract/bybit.d.ts +3 -0
  22. package/js/src/abstract/deepcoin.d.ts +60 -0
  23. package/js/src/abstract/deepcoin.js +11 -0
  24. package/js/src/apex.d.ts +2 -0
  25. package/js/src/apex.js +33 -15
  26. package/js/src/base/Exchange.js +3 -3
  27. package/js/src/base/ws/Client.js +8 -7
  28. package/js/src/bigone.js +20 -0
  29. package/js/src/binanceus.js +31 -1
  30. package/js/src/blofin.js +4 -1
  31. package/js/src/bybit.js +3 -0
  32. package/js/src/deepcoin.d.ts +498 -0
  33. package/js/src/deepcoin.js +3022 -0
  34. package/js/src/pro/ascendex.d.ts +1 -1
  35. package/js/src/pro/ascendex.js +2 -2
  36. package/js/src/pro/binance.d.ts +35 -1
  37. package/js/src/pro/binance.js +97 -3
  38. package/js/src/pro/binanceus.js +19 -0
  39. package/js/src/pro/blofin.d.ts +5 -0
  40. package/js/src/pro/blofin.js +11 -2
  41. package/js/src/pro/deepcoin.d.ts +169 -0
  42. package/js/src/pro/deepcoin.js +1224 -0
  43. package/js/src/pro/kraken.js +5 -1
  44. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -56,6 +56,7 @@ var coinsph = require('./src/coinsph.js');
56
56
  var coinspot = require('./src/coinspot.js');
57
57
  var cryptocom = require('./src/cryptocom.js');
58
58
  var cryptomus = require('./src/cryptomus.js');
59
+ var deepcoin = require('./src/deepcoin.js');
59
60
  var defx = require('./src/defx.js');
60
61
  var delta = require('./src/delta.js');
61
62
  var deribit = require('./src/deribit.js');
@@ -146,6 +147,7 @@ var coincheck$1 = require('./src/pro/coincheck.js');
146
147
  var coinex$1 = require('./src/pro/coinex.js');
147
148
  var coinone$1 = require('./src/pro/coinone.js');
148
149
  var cryptocom$1 = require('./src/pro/cryptocom.js');
150
+ var deepcoin$1 = require('./src/pro/deepcoin.js');
149
151
  var defx$1 = require('./src/pro/defx.js');
150
152
  var deribit$1 = require('./src/pro/deribit.js');
151
153
  var derive$1 = require('./src/pro/derive.js');
@@ -189,7 +191,7 @@ var xt$1 = require('./src/pro/xt.js');
189
191
  // ----------------------------------------------------------------------------
190
192
  //-----------------------------------------------------------------------------
191
193
  // this is updated by vss.js when building
192
- const version = '4.5.17';
194
+ const version = '4.5.18';
193
195
  Exchange["default"].ccxtVersion = version;
194
196
  const exchanges = {
195
197
  'alpaca': alpaca["default"],
@@ -242,6 +244,7 @@ const exchanges = {
242
244
  'coinspot': coinspot["default"],
243
245
  'cryptocom': cryptocom["default"],
244
246
  'cryptomus': cryptomus["default"],
247
+ 'deepcoin': deepcoin["default"],
245
248
  'defx': defx["default"],
246
249
  'delta': delta["default"],
247
250
  'deribit': deribit["default"],
@@ -334,6 +337,7 @@ const pro = {
334
337
  'coinex': coinex$1["default"],
335
338
  'coinone': coinone$1["default"],
336
339
  'cryptocom': cryptocom$1["default"],
340
+ 'deepcoin': deepcoin$1["default"],
337
341
  'defx': defx$1["default"],
338
342
  'deribit': deribit$1["default"],
339
343
  'derive': derive$1["default"],
@@ -475,6 +479,7 @@ exports.coinsph = coinsph["default"];
475
479
  exports.coinspot = coinspot["default"];
476
480
  exports.cryptocom = cryptocom["default"];
477
481
  exports.cryptomus = cryptomus["default"];
482
+ exports.deepcoin = deepcoin["default"];
478
483
  exports.defx = defx["default"];
479
484
  exports.delta = delta["default"];
480
485
  exports.deribit = deribit["default"];
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange$1 = require('../base/Exchange.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ class Exchange extends Exchange$1["default"] {
9
+ }
10
+
11
+ exports["default"] = Exchange;
@@ -1229,14 +1229,14 @@ class apex extends apex$1["default"] {
1229
1229
  }
1230
1230
  parseOrderType(type) {
1231
1231
  const types = {
1232
- 'LIMIT': 'LIMIT',
1233
- 'MARKET': 'MARKET',
1234
- 'STOP_LIMIT': 'STOP_LIMIT',
1235
- 'STOP_MARKET': 'STOP_MARKET',
1236
- 'TAKE_PROFIT_LIMIT': 'TAKE_PROFIT_LIMIT',
1237
- 'TAKE_PROFIT_MARKET': 'TAKE_PROFIT_MARKET',
1232
+ 'LIMIT': 'limit',
1233
+ 'MARKET': 'market',
1234
+ 'STOP_LIMIT': 'limit',
1235
+ 'STOP_MARKET': 'market',
1236
+ 'TAKE_PROFIT_LIMIT': 'limit',
1237
+ 'TAKE_PROFIT_MARKET': 'market',
1238
1238
  };
1239
- return this.safeStringUpper(types, type, type);
1239
+ return this.safeString(types, type, type);
1240
1240
  }
1241
1241
  safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
1242
1242
  if (market === undefined && marketId !== undefined) {
@@ -1301,6 +1301,8 @@ class apex extends apex$1["default"] {
1301
1301
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1302
1302
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1303
1303
  * @param {float} [params.triggerPrice] The price a trigger order is triggered at
1304
+ * @param {float} [params.stopLossPrice] The price a stop loss order is triggered at
1305
+ * @param {float} [params.takeProfitPrice] The price a take profit order is triggered at
1304
1306
  * @param {string} [params.timeInForce] "GTC", "IOC", or "POST_ONLY"
1305
1307
  * @param {bool} [params.postOnly] true or false
1306
1308
  * @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
@@ -1310,7 +1312,7 @@ class apex extends apex$1["default"] {
1310
1312
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1311
1313
  await this.loadMarkets();
1312
1314
  const market = this.market(symbol);
1313
- const orderType = type.toUpperCase();
1315
+ let orderType = type.toUpperCase();
1314
1316
  const orderSide = side.toUpperCase();
1315
1317
  const orderSize = this.amountToPrecision(symbol, amount);
1316
1318
  let orderPrice = '0';
@@ -1318,11 +1320,21 @@ class apex extends apex$1["default"] {
1318
1320
  orderPrice = this.priceToPrecision(symbol, price);
1319
1321
  }
1320
1322
  const fees = this.safeDict(this.fees, 'swap', {});
1321
- const taker = this.safeNumber(fees, 'taker', 0.0005);
1322
- const maker = this.safeNumber(fees, 'maker', 0.0002);
1323
- const limitFee = this.decimalToPrecision(Precise["default"].stringAdd(Precise["default"].stringMul(Precise["default"].stringMul(orderPrice, orderSize), taker.toString()), market['precision']['price'].toString()), number.TRUNCATE, market['precision']['price'], this.precisionMode, this.paddingMode);
1323
+ const taker = this.safeString(fees, 'taker', '0.0005');
1324
+ const maker = this.safeString(fees, 'maker', '0.0002');
1325
+ const limitFee = this.decimalToPrecision(Precise["default"].stringAdd(Precise["default"].stringMul(Precise["default"].stringMul(orderPrice, orderSize), taker), this.numberToString(market['precision']['price'])), number.TRUNCATE, market['precision']['price'], this.precisionMode, this.paddingMode);
1324
1326
  const timeNow = this.milliseconds();
1325
- // const triggerPrice = this.safeString2 (params, 'triggerPrice', 'stopPrice');
1327
+ let triggerPrice = this.safeString(params, 'triggerPrice');
1328
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
1329
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
1330
+ if (stopLossPrice !== undefined) {
1331
+ orderType = (orderType === 'MARKET') ? 'STOP_MARKET' : 'STOP_LIMIT';
1332
+ triggerPrice = stopLossPrice;
1333
+ }
1334
+ else if (takeProfitPrice !== undefined) {
1335
+ orderType = (orderType === 'MARKET') ? 'TAKE_PROFIT_MARKET' : 'TAKE_PROFIT_LIMIT';
1336
+ triggerPrice = takeProfitPrice;
1337
+ }
1326
1338
  const isMarket = orderType === 'MARKET';
1327
1339
  if (isMarket && (price === undefined)) {
1328
1340
  throw new errors.ArgumentsRequired(this.id + ' createOrder() requires a price argument for market orders');
@@ -1347,7 +1359,7 @@ class apex extends apex$1["default"] {
1347
1359
  if (clientOrderId === undefined) {
1348
1360
  clientOrderId = this.generateRandomClientIdOmni(accountId);
1349
1361
  }
1350
- params = this.omit(params, ['clientId', 'clientOrderId', 'client_order_id']);
1362
+ params = this.omit(params, ['clientId', 'clientOrderId', 'client_order_id', 'stopLossPrice', 'takeProfitPrice', 'triggerPrice']);
1351
1363
  const orderToSign = {
1352
1364
  'accountId': accountId,
1353
1365
  'slotId': clientOrderId,
@@ -1356,9 +1368,12 @@ class apex extends apex$1["default"] {
1356
1368
  'size': orderSize,
1357
1369
  'price': orderPrice,
1358
1370
  'direction': orderSide,
1359
- 'makerFeeRate': maker.toString(),
1360
- 'takerFeeRate': taker.toString(),
1371
+ 'makerFeeRate': maker,
1372
+ 'takerFeeRate': taker,
1361
1373
  };
1374
+ if (triggerPrice !== undefined) {
1375
+ orderToSign['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
1376
+ }
1362
1377
  const signature = await this.getZKContractSignatureObj(this.remove0xPrefix(this.getSeeds()), orderToSign);
1363
1378
  const request = {
1364
1379
  'symbol': market['id'],
@@ -1372,6 +1387,9 @@ class apex extends apex$1["default"] {
1372
1387
  'clientId': clientOrderId,
1373
1388
  'brokerId': this.safeString(this.options, 'brokerId', '6956'),
1374
1389
  };
1390
+ if (triggerPrice !== undefined) {
1391
+ request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
1392
+ }
1375
1393
  request['signature'] = signature;
1376
1394
  const response = await this.privatePostV3Order(this.extend(request, params));
1377
1395
  const data = this.safeDict(response, 'data', {});
@@ -1877,7 +1877,7 @@ class Exchange {
1877
1877
  }
1878
1878
  }
1879
1879
  getCacheIndex(orderbook, deltas) {
1880
- // return the first index of the cache that can be applied to the orderbook or -1 if not possible
1880
+ // return the first index of the cache that can be applied to the orderbook or -1 if not possible.
1881
1881
  return -1;
1882
1882
  }
1883
1883
  arraysConcat(arraysOfArrays) {
@@ -3654,7 +3654,7 @@ class Exchange {
3654
3654
  fee = this.parseFeeNumeric(fee);
3655
3655
  }
3656
3656
  if (!feesDefined) {
3657
- // just set it directly, no further processing needed
3657
+ // just set it directly, no further processing needed.
3658
3658
  fees = [fee];
3659
3659
  }
3660
3660
  // 'fees' were set, so reparse them
@@ -7802,7 +7802,7 @@ class Exchange {
7802
7802
  }
7803
7803
  }
7804
7804
  }
7805
- else if (topic === 'ticker' && (this.tickers !== undefined)) {
7805
+ else if ((topic === 'ticker' || topic === 'markPrice') && (this.tickers !== undefined)) {
7806
7806
  const tickerSymbols = Object.keys(this.tickers);
7807
7807
  for (let i = 0; i < tickerSymbols.length; i++) {
7808
7808
  const tickerSymbol = tickerSymbols[i];
@@ -157,6 +157,7 @@ class Client {
157
157
  if (this.ping) {
158
158
  message = this.ping(this);
159
159
  }
160
+ this.log(new Date(), 'OnPingInterval', this.url);
160
161
  if (message) {
161
162
  this.send(message).catch((error) => {
162
163
  this.onError(error);
@@ -179,7 +180,7 @@ class Client {
179
180
  }
180
181
  onOpen() {
181
182
  if (this.verbose) {
182
- this.log(new Date(), 'onOpen');
183
+ this.log(new Date(), 'onOpen', '|', this.url);
183
184
  }
184
185
  this.connectionEstablished = time.milliseconds();
185
186
  this.isConnected = true;
@@ -194,18 +195,18 @@ class Client {
194
195
  // however, some devs may want to track connection states in their app
195
196
  onPing() {
196
197
  if (this.verbose) {
197
- this.log(new Date(), 'onPing');
198
+ this.log(new Date(), 'onPing', '|', this.url);
198
199
  }
199
200
  }
200
201
  onPong() {
201
202
  this.lastPong = time.milliseconds();
202
203
  if (this.verbose) {
203
- this.log(new Date(), 'onPong');
204
+ this.log(new Date(), 'onPong', '|', this.url);
204
205
  }
205
206
  }
206
207
  onError(error) {
207
208
  if (this.verbose) {
208
- this.log(new Date(), 'onError', error.message);
209
+ this.log(new Date(), 'onError', error.message, '|', this.url);
209
210
  }
210
211
  if (!(error instanceof errors.BaseError)) {
211
212
  // in case of ErrorEvent from node_modules/ws/lib/event-target.js
@@ -218,7 +219,7 @@ class Client {
218
219
  /* eslint-disable no-shadow */
219
220
  onClose(event) {
220
221
  if (this.verbose) {
221
- this.log(new Date(), 'onClose', event);
222
+ this.log(new Date(), 'onClose', event, '|', this.url);
222
223
  }
223
224
  if (!this.error) {
224
225
  // todo: exception types for server-side disconnects
@@ -236,7 +237,7 @@ class Client {
236
237
  // but may be used to read protocol-level data like cookies, headers, etc
237
238
  onUpgrade(message) {
238
239
  if (this.verbose) {
239
- this.log(new Date(), 'onUpgrade');
240
+ this.log(new Date(), 'onUpgrade', '|', this.url);
240
241
  }
241
242
  }
242
243
  async send(message) {
@@ -302,7 +303,7 @@ class Client {
302
303
  }
303
304
  }
304
305
  catch (e) {
305
- this.log(new Date(), 'onMessage JSON.parse', e);
306
+ this.log(new Date(), 'onMessage JSON.parse', e, '|', this.url);
306
307
  // reset with a json encoding error ?
307
308
  }
308
309
  try {
@@ -30,6 +30,9 @@ class bigone extends bigone$1["default"] {
30
30
  'swap': true,
31
31
  'future': undefined,
32
32
  'option': false,
33
+ 'borrowCrossMargin': false,
34
+ 'borrowIsolatedMargin': false,
35
+ 'borrowMargin': false,
33
36
  'cancelAllOrders': true,
34
37
  'cancelOrder': true,
35
38
  'createMarketBuyOrderWithCost': true,
@@ -40,8 +43,17 @@ class bigone extends bigone$1["default"] {
40
43
  'createStopLimitOrder': true,
41
44
  'createStopMarketOrder': true,
42
45
  'createStopOrder': true,
46
+ 'fetchAllGreeks': false,
43
47
  'fetchBalance': true,
48
+ 'fetchBorrowInterest': false,
49
+ 'fetchBorrowRate': false,
50
+ 'fetchBorrowRateHistories': false,
51
+ 'fetchBorrowRateHistory': false,
52
+ 'fetchBorrowRates': false,
53
+ 'fetchBorrowRatesPerSymbol': false,
44
54
  'fetchClosedOrders': true,
55
+ 'fetchCrossBorrowRate': false,
56
+ 'fetchCrossBorrowRates': false,
45
57
  'fetchCurrencies': true,
46
58
  'fetchDepositAddress': true,
47
59
  'fetchDepositAddresses': false,
@@ -51,10 +63,15 @@ class bigone extends bigone$1["default"] {
51
63
  'fetchFundingRate': false,
52
64
  'fetchFundingRateHistory': false,
53
65
  'fetchFundingRates': false,
66
+ 'fetchGreeks': false,
67
+ 'fetchIsolatedBorrowRate': false,
68
+ 'fetchIsolatedBorrowRates': false,
54
69
  'fetchMarkets': true,
55
70
  'fetchMyTrades': true,
56
71
  'fetchOHLCV': true,
57
72
  'fetchOpenOrders': true,
73
+ 'fetchOption': false,
74
+ 'fetchOptionChain': false,
58
75
  'fetchOrder': true,
59
76
  'fetchOrderBook': true,
60
77
  'fetchOrders': true,
@@ -65,7 +82,10 @@ class bigone extends bigone$1["default"] {
65
82
  'fetchTradingFee': false,
66
83
  'fetchTradingFees': false,
67
84
  'fetchTransactionFees': false,
85
+ 'fetchVolatilityHistory': false,
68
86
  'fetchWithdrawals': true,
87
+ 'repayCrossMargin': false,
88
+ 'repayIsolatedMargin': false,
69
89
  'transfer': true,
70
90
  'withdraw': true,
71
91
  },
@@ -52,34 +52,64 @@ class binanceus extends binance["default"] {
52
52
  'spot': true,
53
53
  'margin': false,
54
54
  'swap': false,
55
- 'future': undefined,
55
+ 'future': false,
56
56
  'option': false,
57
57
  'addMargin': false,
58
+ 'borrowCrossMargin': false,
59
+ 'borrowIsolatedMargin': false,
60
+ 'borrowMargin': false,
58
61
  'closeAllPositions': false,
59
62
  'closePosition': false,
60
63
  'createReduceOnlyOrder': false,
64
+ 'createStopLossOrder': false,
65
+ 'createTakeProfitOrder': false,
66
+ 'fetchAllGreeks': false,
61
67
  'fetchBorrowInterest': false,
62
68
  'fetchBorrowRate': false,
63
69
  'fetchBorrowRateHistories': false,
64
70
  'fetchBorrowRateHistory': false,
65
71
  'fetchBorrowRates': false,
66
72
  'fetchBorrowRatesPerSymbol': false,
73
+ 'fetchCrossBorrowRate': false,
74
+ 'fetchCrossBorrowRates': false,
67
75
  'fetchFundingHistory': false,
76
+ 'fetchFundingInterval': false,
77
+ 'fetchFundingIntervals': false,
68
78
  'fetchFundingRate': false,
69
79
  'fetchFundingRateHistory': false,
70
80
  'fetchFundingRates': false,
81
+ 'fetchGreeks': false,
71
82
  'fetchIndexOHLCV': false,
83
+ 'fetchIsolatedBorrowRate': false,
84
+ 'fetchIsolatedBorrowRates': false,
72
85
  'fetchIsolatedPositions': false,
73
86
  'fetchLeverage': false,
74
87
  'fetchLeverageTiers': false,
88
+ 'fetchLongShortRatio': false,
89
+ 'fetchLongShortRatioHistory': false,
75
90
  'fetchMarketLeverageTiers': false,
76
91
  'fetchMarkOHLCV': false,
92
+ 'fetchMarkPrice': false,
93
+ 'fetchMarkPrices': false,
94
+ 'fetchMySettlementHistory': false,
77
95
  'fetchOpenInterestHistory': false,
96
+ 'fetchOpenInterests': false,
97
+ 'fetchOption': false,
98
+ 'fetchOptionChain': false,
78
99
  'fetchPosition': false,
100
+ 'fetchPositionHistory': false,
101
+ 'fetchPositionMode': false,
79
102
  'fetchPositions': false,
103
+ 'fetchPositionsForSymbol': false,
104
+ 'fetchPositionsHistory': false,
80
105
  'fetchPositionsRisk': false,
81
106
  'fetchPremiumIndexOHLCV': false,
107
+ 'fetchSettlementHistory': false,
108
+ 'fetchUnderlyingAssets': false,
109
+ 'fetchVolatilityHistory': false,
82
110
  'reduceMargin': false,
111
+ 'repayCrossMargin': false,
112
+ 'repayIsolatedMargin': false,
83
113
  'setLeverage': false,
84
114
  'setMargin': false,
85
115
  'setMarginMode': false,
@@ -1283,11 +1283,14 @@ class blofin extends blofin$1["default"] {
1283
1283
  timeInForce = 'IOC';
1284
1284
  type = 'limit';
1285
1285
  }
1286
+ else if (type === 'conditional') {
1287
+ type = 'trigger';
1288
+ }
1286
1289
  const marketId = this.safeString(order, 'instId');
1287
1290
  market = this.safeMarket(marketId, market);
1288
1291
  const symbol = this.safeSymbol(marketId, market, '-');
1289
1292
  const filled = this.safeString(order, 'filledSize');
1290
- const price = this.safeString2(order, 'px', 'price');
1293
+ const price = this.safeStringN(order, ['px', 'price', 'orderPrice']);
1291
1294
  const average = this.safeString(order, 'averagePrice');
1292
1295
  const status = this.parseOrderStatus(this.safeString(order, 'state'));
1293
1296
  const feeCostString = this.safeString(order, 'fee');
@@ -419,8 +419,11 @@ class bybit extends bybit$1["default"] {
419
419
  'v5/broker/account-info': 5,
420
420
  'v5/broker/asset/query-sub-member-deposit-record': 10,
421
421
  // earn
422
+ 'v5/earn/product': 5,
422
423
  'v5/earn/order': 5,
423
424
  'v5/earn/position': 5,
425
+ 'v5/earn/yield': 5,
426
+ 'v5/earn/hourly-yield': 5,
424
427
  },
425
428
  'post': {
426
429
  // spot