ccxt 4.2.15 → 4.2.17

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 (46) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +647 -168
  3. package/dist/ccxt.browser.min.js +2 -2
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/js/ccxt.js +3 -1
  6. package/dist/cjs/js/src/ascendex.js +11 -6
  7. package/dist/cjs/js/src/base/Exchange.js +12 -12
  8. package/dist/cjs/js/src/binance.js +1 -0
  9. package/dist/cjs/js/src/bingx.js +37 -3
  10. package/dist/cjs/js/src/bitmex.js +3 -6
  11. package/dist/cjs/js/src/coinlist.js +10 -2
  12. package/dist/cjs/js/src/coinone.js +1 -1
  13. package/dist/cjs/js/src/coinsph.js +2 -2
  14. package/dist/cjs/js/src/phemex.js +28 -25
  15. package/dist/cjs/js/src/pro/binance.js +2 -2
  16. package/dist/cjs/js/src/pro/coinone.js +411 -0
  17. package/dist/cjs/js/src/pro/hitbtc.js +5 -4
  18. package/dist/cjs/js/src/pro/krakenfutures.js +7 -1
  19. package/dist/cjs/js/src/pro/kucoin.js +3 -1
  20. package/dist/cjs/js/src/pro/poloniex.js +2 -2
  21. package/js/ccxt.d.ts +4 -1
  22. package/js/ccxt.js +3 -1
  23. package/js/src/abstract/binance.d.ts +1 -0
  24. package/js/src/abstract/binancecoinm.d.ts +1 -0
  25. package/js/src/abstract/binanceus.d.ts +1 -0
  26. package/js/src/abstract/binanceusdm.d.ts +1 -0
  27. package/js/src/abstract/coinlist.d.ts +8 -0
  28. package/js/src/ascendex.js +11 -6
  29. package/js/src/base/Exchange.js +12 -12
  30. package/js/src/binance.js +1 -0
  31. package/js/src/bingx.d.ts +1 -0
  32. package/js/src/bingx.js +38 -4
  33. package/js/src/bitmex.js +3 -6
  34. package/js/src/coinlist.js +10 -2
  35. package/js/src/coinone.js +1 -1
  36. package/js/src/coinsph.js +2 -2
  37. package/js/src/phemex.js +28 -25
  38. package/js/src/pro/binance.js +2 -2
  39. package/js/src/pro/coinone.d.ts +21 -0
  40. package/js/src/pro/coinone.js +412 -0
  41. package/js/src/pro/hitbtc.js +5 -4
  42. package/js/src/pro/krakenfutures.js +7 -1
  43. package/js/src/pro/kucoin.js +3 -1
  44. package/js/src/pro/poloniex.js +2 -2
  45. package/package.json +1 -1
  46. package/skip-tests.json +1 -0
@@ -0,0 +1,411 @@
1
+ 'use strict';
2
+
3
+ var coinone$1 = require('../coinone.js');
4
+ var errors = require('../base/errors.js');
5
+ var Cache = require('../base/ws/Cache.js');
6
+
7
+ // ---------------------------------------------------------------------------
8
+ // ---------------------------------------------------------------------------
9
+ class coinone extends coinone$1 {
10
+ describe() {
11
+ return this.deepExtend(super.describe(), {
12
+ 'has': {
13
+ 'ws': true,
14
+ 'watchOrderBook': true,
15
+ 'watchOrders': false,
16
+ 'watchTrades': true,
17
+ 'watchOHLCV': false,
18
+ 'watchTicker': true,
19
+ 'watchTickers': false,
20
+ },
21
+ 'urls': {
22
+ 'api': {
23
+ 'ws': 'wss://stream.coinone.co.kr',
24
+ },
25
+ },
26
+ 'options': {
27
+ 'expiresIn': '',
28
+ 'userId': '',
29
+ 'wsSessionToken': '',
30
+ 'watchOrderBook': {
31
+ 'snapshotDelay': 6,
32
+ 'snapshotMaxRetries': 3,
33
+ },
34
+ 'tradesLimit': 1000,
35
+ 'OHLCVLimit': 1000,
36
+ },
37
+ 'exceptions': {
38
+ 'exact': {
39
+ '4009': errors.AuthenticationError,
40
+ },
41
+ },
42
+ 'streaming': {
43
+ 'ping': this.ping,
44
+ 'keepAlive': 20000,
45
+ },
46
+ });
47
+ }
48
+ async watchOrderBook(symbol, limit = undefined, params = {}) {
49
+ /**
50
+ * @method
51
+ * @name coinone#watchOrderBook
52
+ * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
53
+ * @see https://docs.coinone.co.kr/reference/public-websocket-orderbook
54
+ * @param {string} symbol unified symbol of the market to fetch the order book for
55
+ * @param {int} [limit] the maximum amount of order book entries to return
56
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
57
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
58
+ */
59
+ await this.loadMarkets();
60
+ const market = this.market(symbol);
61
+ const messageHash = 'orderbook:' + market['symbol'];
62
+ const url = this.urls['api']['ws'];
63
+ const request = {
64
+ 'request_type': 'SUBSCRIBE',
65
+ 'channel': 'ORDERBOOK',
66
+ 'topic': {
67
+ 'quote_currency': market['quote'],
68
+ 'target_currency': market['base'],
69
+ },
70
+ };
71
+ const message = this.extend(request, params);
72
+ const orderbook = await this.watch(url, messageHash, message, messageHash);
73
+ return orderbook.limit();
74
+ }
75
+ handleOrderBook(client, message) {
76
+ //
77
+ // {
78
+ // "response_type": "DATA",
79
+ // "channel": "ORDERBOOK",
80
+ // "data": {
81
+ // "quote_currency": "KRW",
82
+ // "target_currency": "BTC",
83
+ // "timestamp": 1705288918649,
84
+ // "id": "1705288918649001",
85
+ // "asks": [
86
+ // {
87
+ // "price": "58412000",
88
+ // "qty": "0.59919807"
89
+ // }
90
+ // ],
91
+ // "bids": [
92
+ // {
93
+ // "price": "58292000",
94
+ // "qty": "0.1045"
95
+ // }
96
+ // ]
97
+ // }
98
+ // }
99
+ //
100
+ const data = this.safeValue(message, 'data', {});
101
+ const baseId = this.safeStringUpper(data, 'target_currency');
102
+ const quoteId = this.safeStringUpper(data, 'quote_currency');
103
+ const base = this.safeCurrencyCode(baseId);
104
+ const quote = this.safeCurrencyCode(quoteId);
105
+ const symbol = this.symbol(base + '/' + quote);
106
+ const timestamp = this.safeInteger(data, 'timestamp');
107
+ let orderbook = this.safeValue(this.orderbooks, symbol);
108
+ if (orderbook === undefined) {
109
+ orderbook = this.orderBook();
110
+ }
111
+ else {
112
+ orderbook.reset();
113
+ }
114
+ orderbook['symbol'] = symbol;
115
+ const asks = this.safeValue(data, 'asks', []);
116
+ const bids = this.safeValue(data, 'bids', []);
117
+ this.handleDeltas(orderbook['asks'], asks);
118
+ this.handleDeltas(orderbook['bids'], bids);
119
+ orderbook['timestamp'] = timestamp;
120
+ orderbook['datetime'] = this.iso8601(timestamp);
121
+ const messageHash = 'orderbook:' + symbol;
122
+ this.orderbooks[symbol] = orderbook;
123
+ client.resolve(orderbook, messageHash);
124
+ }
125
+ handleDelta(bookside, delta) {
126
+ const bidAsk = this.parseBidAsk(delta, 'price', 'qty');
127
+ bookside.storeArray(bidAsk);
128
+ }
129
+ async watchTicker(symbol, params = {}) {
130
+ /**
131
+ * @method
132
+ * @name coinone#watchTicker
133
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
134
+ * @see https://docs.coinone.co.kr/reference/public-websocket-ticker
135
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
136
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
137
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
138
+ */
139
+ await this.loadMarkets();
140
+ const market = this.market(symbol);
141
+ const messageHash = 'ticker:' + market['symbol'];
142
+ const url = this.urls['api']['ws'];
143
+ const request = {
144
+ 'request_type': 'SUBSCRIBE',
145
+ 'channel': 'TICKER',
146
+ 'topic': {
147
+ 'quote_currency': market['quote'],
148
+ 'target_currency': market['base'],
149
+ },
150
+ };
151
+ const message = this.extend(request, params);
152
+ return await this.watch(url, messageHash, message, messageHash);
153
+ }
154
+ handleTicker(client, message) {
155
+ //
156
+ // {
157
+ // "response_type": "DATA",
158
+ // "channel": "TICKER",
159
+ // "data": {
160
+ // "quote_currency": "KRW",
161
+ // "target_currency": "BTC",
162
+ // "timestamp": 1705301117198,
163
+ // "quote_volume": "19521465345.504",
164
+ // "target_volume": "334.81445168",
165
+ // "high": "58710000",
166
+ // "low": "57276000",
167
+ // "first": "57293000",
168
+ // "last": "58532000",
169
+ // "volume_power": "100",
170
+ // "ask_best_price": "58537000",
171
+ // "ask_best_qty": "0.1961",
172
+ // "bid_best_price": "58532000",
173
+ // "bid_best_qty": "0.00009258",
174
+ // "id": "1705301117198001",
175
+ // "yesterday_high": "59140000",
176
+ // "yesterday_low": "57273000",
177
+ // "yesterday_first": "58897000",
178
+ // "yesterday_last": "57301000",
179
+ // "yesterday_quote_volume": "12967227517.4262",
180
+ // "yesterday_target_volume": "220.09232233"
181
+ // }
182
+ // }
183
+ //
184
+ const data = this.safeValue(message, 'data', {});
185
+ const ticker = this.parseWsTicker(data);
186
+ const symbol = ticker['symbol'];
187
+ this.tickers[symbol] = ticker;
188
+ const messageHash = 'ticker:' + symbol;
189
+ client.resolve(this.tickers[symbol], messageHash);
190
+ }
191
+ parseWsTicker(ticker, market = undefined) {
192
+ //
193
+ // {
194
+ // "quote_currency": "KRW",
195
+ // "target_currency": "BTC",
196
+ // "timestamp": 1705301117198,
197
+ // "quote_volume": "19521465345.504",
198
+ // "target_volume": "334.81445168",
199
+ // "high": "58710000",
200
+ // "low": "57276000",
201
+ // "first": "57293000",
202
+ // "last": "58532000",
203
+ // "volume_power": "100",
204
+ // "ask_best_price": "58537000",
205
+ // "ask_best_qty": "0.1961",
206
+ // "bid_best_price": "58532000",
207
+ // "bid_best_qty": "0.00009258",
208
+ // "id": "1705301117198001",
209
+ // "yesterday_high": "59140000",
210
+ // "yesterday_low": "57273000",
211
+ // "yesterday_first": "58897000",
212
+ // "yesterday_last": "57301000",
213
+ // "yesterday_quote_volume": "12967227517.4262",
214
+ // "yesterday_target_volume": "220.09232233"
215
+ // }
216
+ //
217
+ const timestamp = this.safeInteger(ticker, 'timestamp');
218
+ const last = this.safeString(ticker, 'last');
219
+ const baseId = this.safeString(ticker, 'target_currency');
220
+ const quoteId = this.safeString(ticker, 'quote_currency');
221
+ const base = this.safeCurrencyCode(baseId);
222
+ const quote = this.safeCurrencyCode(quoteId);
223
+ const symbol = this.symbol(base + '/' + quote);
224
+ return this.safeTicker({
225
+ 'symbol': symbol,
226
+ 'timestamp': timestamp,
227
+ 'datetime': this.iso8601(timestamp),
228
+ 'high': this.safeString(ticker, 'high'),
229
+ 'low': this.safeString(ticker, 'low'),
230
+ 'bid': this.safeNumber(ticker, 'bid_best_price'),
231
+ 'bidVolume': this.safeNumber(ticker, 'bid_best_qty'),
232
+ 'ask': this.safeNumber(ticker, 'ask_best_price'),
233
+ 'askVolume': this.safeNumber(ticker, 'ask_best_qty'),
234
+ 'vwap': undefined,
235
+ 'open': this.safeString(ticker, 'first'),
236
+ 'close': last,
237
+ 'last': last,
238
+ 'previousClose': undefined,
239
+ 'change': undefined,
240
+ 'percentage': undefined,
241
+ 'average': undefined,
242
+ 'baseVolume': this.safeString(ticker, 'target_volume'),
243
+ 'quoteVolume': this.safeString(ticker, 'quote_volume'),
244
+ 'info': ticker,
245
+ }, market);
246
+ }
247
+ async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
248
+ /**
249
+ * @method
250
+ * @name coinone#watchTrades
251
+ * @description watches information on multiple trades made in a market
252
+ * @see https://docs.coinone.co.kr/reference/public-websocket-trade
253
+ * @param {string} symbol unified market symbol of the market trades were made in
254
+ * @param {int} [since] the earliest time in ms to fetch trades for
255
+ * @param {int} [limit] the maximum number of trade structures to retrieve
256
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
257
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
258
+ */
259
+ await this.loadMarkets();
260
+ const market = this.market(symbol);
261
+ const messageHash = 'trade:' + market['symbol'];
262
+ const url = this.urls['api']['ws'];
263
+ const request = {
264
+ 'request_type': 'SUBSCRIBE',
265
+ 'channel': 'TRADE',
266
+ 'topic': {
267
+ 'quote_currency': market['quote'],
268
+ 'target_currency': market['base'],
269
+ },
270
+ };
271
+ const message = this.extend(request, params);
272
+ const trades = await this.watch(url, messageHash, message, messageHash);
273
+ if (this.newUpdates) {
274
+ limit = trades.getLimit(market['symbol'], limit);
275
+ }
276
+ return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
277
+ }
278
+ handleTrades(client, message) {
279
+ //
280
+ // {
281
+ // "response_type": "DATA",
282
+ // "channel": "TRADE",
283
+ // "data": {
284
+ // "quote_currency": "KRW",
285
+ // "target_currency": "BTC",
286
+ // "id": "1705303667916001",
287
+ // "timestamp": 1705303667916,
288
+ // "price": "58490000",
289
+ // "qty": "0.0008",
290
+ // "is_seller_maker": false
291
+ // }
292
+ // }
293
+ //
294
+ const data = this.safeValue(message, 'data', {});
295
+ const trade = this.parseWsTrade(data);
296
+ const symbol = trade['symbol'];
297
+ let stored = this.safeValue(this.trades, symbol);
298
+ if (stored === undefined) {
299
+ const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
300
+ stored = new Cache.ArrayCache(limit);
301
+ this.trades[symbol] = stored;
302
+ }
303
+ stored.append(trade);
304
+ const messageHash = 'trade:' + symbol;
305
+ client.resolve(stored, messageHash);
306
+ }
307
+ parseWsTrade(trade, market = undefined) {
308
+ //
309
+ // {
310
+ // "quote_currency": "KRW",
311
+ // "target_currency": "BTC",
312
+ // "id": "1705303667916001",
313
+ // "timestamp": 1705303667916,
314
+ // "price": "58490000",
315
+ // "qty": "0.0008",
316
+ // "is_seller_maker": false
317
+ // }
318
+ //
319
+ const baseId = this.safeStringUpper(trade, 'target_currency');
320
+ const quoteId = this.safeStringUpper(trade, 'quote_currency');
321
+ const base = this.safeCurrencyCode(baseId);
322
+ const quote = this.safeCurrencyCode(quoteId);
323
+ const symbol = base + '/' + quote;
324
+ const timestamp = this.safeInteger(trade, 'timestamp');
325
+ market = this.safeMarket(symbol, market);
326
+ const isSellerMaker = this.safeValue(trade, 'is_seller_maker');
327
+ let side = undefined;
328
+ if (isSellerMaker !== undefined) {
329
+ side = isSellerMaker ? 'sell' : 'buy';
330
+ }
331
+ const priceString = this.safeString(trade, 'price');
332
+ const amountString = this.safeString(trade, 'qty');
333
+ return this.safeTrade({
334
+ 'id': this.safeString(trade, 'id'),
335
+ 'info': trade,
336
+ 'timestamp': timestamp,
337
+ 'datetime': this.iso8601(timestamp),
338
+ 'order': undefined,
339
+ 'symbol': market['symbol'],
340
+ 'type': undefined,
341
+ 'side': side,
342
+ 'takerOrMaker': undefined,
343
+ 'price': priceString,
344
+ 'amount': amountString,
345
+ 'cost': undefined,
346
+ 'fee': undefined,
347
+ }, market);
348
+ }
349
+ handleErrorMessage(client, message) {
350
+ //
351
+ // {
352
+ // "response_type": "ERROR",
353
+ // "error_code": 160012,
354
+ // "message": "Invalid Topic"
355
+ // }
356
+ //
357
+ const type = this.safeString(message, 'response_type', '');
358
+ if (type === 'ERROR') {
359
+ return true;
360
+ }
361
+ return false;
362
+ }
363
+ handleMessage(client, message) {
364
+ if (this.handleErrorMessage(client, message)) {
365
+ return;
366
+ }
367
+ const type = this.safeString(message, 'response_type');
368
+ if (type === 'PONG') {
369
+ this.handlePong(client, message);
370
+ return;
371
+ }
372
+ if (type === 'DATA') {
373
+ const topic = this.safeString(message, 'channel', '');
374
+ const methods = {
375
+ 'ORDERBOOK': this.handleOrderBook,
376
+ 'TICKER': this.handleTicker,
377
+ 'TRADE': this.handleTrades,
378
+ };
379
+ const exacMethod = this.safeValue(methods, topic);
380
+ if (exacMethod !== undefined) {
381
+ exacMethod.call(this, client, message);
382
+ return;
383
+ }
384
+ const keys = Object.keys(methods);
385
+ for (let i = 0; i < keys.length; i++) {
386
+ const key = keys[i];
387
+ if (topic.indexOf(keys[i]) >= 0) {
388
+ const method = methods[key];
389
+ method.call(this, client, message);
390
+ return;
391
+ }
392
+ }
393
+ }
394
+ }
395
+ ping(client) {
396
+ return {
397
+ 'request_type': 'PING',
398
+ };
399
+ }
400
+ handlePong(client, message) {
401
+ //
402
+ // {
403
+ // "response_type":"PONG"
404
+ // }
405
+ //
406
+ client.lastPong = this.milliseconds();
407
+ return message;
408
+ }
409
+ }
410
+
411
+ module.exports = coinone;
@@ -307,7 +307,8 @@ class hitbtc extends hitbtc$1 {
307
307
  'symbols': [market['id']],
308
308
  },
309
309
  };
310
- return await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
310
+ const result = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
311
+ return this.safeValue(result, symbol);
311
312
  }
312
313
  async watchTickers(symbols = undefined, params = {}) {
313
314
  /**
@@ -390,16 +391,16 @@ class hitbtc extends hitbtc$1 {
390
391
  const data = this.safeValue(message, 'data', {});
391
392
  const marketIds = Object.keys(data);
392
393
  const channel = this.safeString(message, 'ch');
393
- const newTickers = [];
394
+ const newTickers = {};
394
395
  for (let i = 0; i < marketIds.length; i++) {
395
396
  const marketId = marketIds[i];
396
397
  const market = this.safeMarket(marketId);
397
398
  const symbol = market['symbol'];
398
399
  const ticker = this.parseWsTicker(data[marketId], market);
399
400
  this.tickers[symbol] = ticker;
400
- newTickers.push(ticker);
401
+ newTickers[symbol] = ticker;
401
402
  const messageHash = channel + '::' + symbol;
402
- client.resolve(this.tickers[symbol], messageHash);
403
+ client.resolve(newTickers, messageHash);
403
404
  }
404
405
  const messageHashes = this.findMessageHashes(client, channel + '::');
405
406
  for (let i = 0; i < messageHashes.length; i++) {
@@ -178,7 +178,13 @@ class krakenfutures extends krakenfutures$1 {
178
178
  const name = this.safeString2(params, 'method', 'watchTickerMethod', method);
179
179
  params = this.omit(params, ['watchTickerMethod', 'method']);
180
180
  symbols = this.marketSymbols(symbols, undefined, false);
181
- return await this.subscribePublic(name, symbols, params);
181
+ const ticker = await this.subscribePublic(name, symbols, params);
182
+ if (this.newUpdates) {
183
+ const tickers = {};
184
+ tickers[ticker['symbol']] = ticker;
185
+ return tickers;
186
+ }
187
+ return this.filterByArray(this.tickers, 'symbol', symbols);
182
188
  }
183
189
  async watchTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
184
190
  /**
@@ -258,7 +258,9 @@ class kucoin extends kucoin$1 {
258
258
  const messageHash = 'ticker:' + symbol;
259
259
  client.resolve(ticker, messageHash);
260
260
  // watchTickers
261
- client.resolve(ticker, 'tickers');
261
+ const allTickers = {};
262
+ allTickers[symbol] = ticker;
263
+ client.resolve(allTickers, 'tickers');
262
264
  const messageHashes = this.findMessageHashes(client, 'tickers::');
263
265
  for (let i = 0; i < messageHashes.length; i++) {
264
266
  const currentMessageHash = messageHashes[i];
@@ -940,7 +940,7 @@ class poloniex extends poloniex$1 {
940
940
  // }
941
941
  //
942
942
  const data = this.safeValue(message, 'data', []);
943
- const newTickers = [];
943
+ const newTickers = {};
944
944
  for (let i = 0; i < data.length; i++) {
945
945
  const item = data[i];
946
946
  const marketId = this.safeString(item, 'symbol');
@@ -948,7 +948,7 @@ class poloniex extends poloniex$1 {
948
948
  const ticker = this.parseTicker(item);
949
949
  const symbol = ticker['symbol'];
950
950
  this.tickers[symbol] = ticker;
951
- newTickers.push(ticker);
951
+ newTickers[symbol] = ticker;
952
952
  }
953
953
  }
954
954
  const messageHashes = this.findMessageHashes(client, 'ticker::');
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.14";
7
+ declare const version = "4.2.16";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -128,6 +128,7 @@ import cexPro from './src/pro/cex.js';
128
128
  import coinbasePro from './src/pro/coinbase.js';
129
129
  import coinbaseproPro from './src/pro/coinbasepro.js';
130
130
  import coinexPro from './src/pro/coinex.js';
131
+ import coinonePro from './src/pro/coinone.js';
131
132
  import cryptocomPro from './src/pro/cryptocom.js';
132
133
  import currencycomPro from './src/pro/currencycom.js';
133
134
  import deribitPro from './src/pro/deribit.js';
@@ -285,6 +286,7 @@ declare const pro: {
285
286
  coinbase: typeof coinbasePro;
286
287
  coinbasepro: typeof coinbaseproPro;
287
288
  coinex: typeof coinexPro;
289
+ coinone: typeof coinonePro;
288
290
  cryptocom: typeof cryptocomPro;
289
291
  currencycom: typeof currencycomPro;
290
292
  deribit: typeof deribitPro;
@@ -348,6 +350,7 @@ declare const ccxt: {
348
350
  coinbase: typeof coinbasePro;
349
351
  coinbasepro: typeof coinbaseproPro;
350
352
  coinex: typeof coinexPro;
353
+ coinone: typeof coinonePro;
351
354
  cryptocom: typeof cryptocomPro;
352
355
  currencycom: typeof currencycomPro;
353
356
  deribit: typeof deribitPro;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.15';
41
+ const version = '4.2.17';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -165,6 +165,7 @@ import cexPro from './src/pro/cex.js';
165
165
  import coinbasePro from './src/pro/coinbase.js';
166
166
  import coinbaseproPro from './src/pro/coinbasepro.js';
167
167
  import coinexPro from './src/pro/coinex.js';
168
+ import coinonePro from './src/pro/coinone.js';
168
169
  import cryptocomPro from './src/pro/cryptocom.js';
169
170
  import currencycomPro from './src/pro/currencycom.js';
170
171
  import deribitPro from './src/pro/deribit.js';
@@ -322,6 +323,7 @@ const pro = {
322
323
  'coinbase': coinbasePro,
323
324
  'coinbasepro': coinbaseproPro,
324
325
  'coinex': coinexPro,
326
+ 'coinone': coinonePro,
325
327
  'cryptocom': cryptocomPro,
326
328
  'currencycom': currencycomPro,
327
329
  'deribit': deribitPro,
@@ -8,6 +8,7 @@ interface Exchange {
8
8
  sapiGetMarginAllAssets(params?: {}): Promise<implicitReturnType>;
9
9
  sapiGetMarginAllPairs(params?: {}): Promise<implicitReturnType>;
10
10
  sapiGetMarginPriceIndex(params?: {}): Promise<implicitReturnType>;
11
+ sapiGetSpotDelistSchedule(params?: {}): Promise<implicitReturnType>;
11
12
  sapiGetAssetAssetDividend(params?: {}): Promise<implicitReturnType>;
12
13
  sapiGetAssetDribblet(params?: {}): Promise<implicitReturnType>;
13
14
  sapiGetAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -8,6 +8,7 @@ interface binance {
8
8
  sapiGetMarginAllAssets(params?: {}): Promise<implicitReturnType>;
9
9
  sapiGetMarginAllPairs(params?: {}): Promise<implicitReturnType>;
10
10
  sapiGetMarginPriceIndex(params?: {}): Promise<implicitReturnType>;
11
+ sapiGetSpotDelistSchedule(params?: {}): Promise<implicitReturnType>;
11
12
  sapiGetAssetAssetDividend(params?: {}): Promise<implicitReturnType>;
12
13
  sapiGetAssetDribblet(params?: {}): Promise<implicitReturnType>;
13
14
  sapiGetAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -8,6 +8,7 @@ interface binance {
8
8
  sapiGetMarginAllAssets(params?: {}): Promise<implicitReturnType>;
9
9
  sapiGetMarginAllPairs(params?: {}): Promise<implicitReturnType>;
10
10
  sapiGetMarginPriceIndex(params?: {}): Promise<implicitReturnType>;
11
+ sapiGetSpotDelistSchedule(params?: {}): Promise<implicitReturnType>;
11
12
  sapiGetAssetAssetDividend(params?: {}): Promise<implicitReturnType>;
12
13
  sapiGetAssetDribblet(params?: {}): Promise<implicitReturnType>;
13
14
  sapiGetAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -8,6 +8,7 @@ interface binance {
8
8
  sapiGetMarginAllAssets(params?: {}): Promise<implicitReturnType>;
9
9
  sapiGetMarginAllPairs(params?: {}): Promise<implicitReturnType>;
10
10
  sapiGetMarginPriceIndex(params?: {}): Promise<implicitReturnType>;
11
+ sapiGetSpotDelistSchedule(params?: {}): Promise<implicitReturnType>;
11
12
  sapiGetAssetAssetDividend(params?: {}): Promise<implicitReturnType>;
12
13
  sapiGetAssetDribblet(params?: {}): Promise<implicitReturnType>;
13
14
  sapiGetAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -12,9 +12,13 @@ interface Exchange {
12
12
  publicGetV1SymbolsSymbolAuctionsAuctionCode(params?: {}): Promise<implicitReturnType>;
13
13
  publicGetV1Time(params?: {}): Promise<implicitReturnType>;
14
14
  publicGetV1Assets(params?: {}): Promise<implicitReturnType>;
15
+ publicGetV1Leaderboard(params?: {}): Promise<implicitReturnType>;
16
+ publicGetV1AffiliateCompetitionCode(params?: {}): Promise<implicitReturnType>;
17
+ publicGetV1CompetitionCompetitionId(params?: {}): Promise<implicitReturnType>;
15
18
  privateGetV1Fees(params?: {}): Promise<implicitReturnType>;
16
19
  privateGetV1Accounts(params?: {}): Promise<implicitReturnType>;
17
20
  privateGetV1AccountsTraderId(params?: {}): Promise<implicitReturnType>;
21
+ privateGetV1AccountsTraderIdAlias(params?: {}): Promise<implicitReturnType>;
18
22
  privateGetV1AccountsTraderIdLedger(params?: {}): Promise<implicitReturnType>;
19
23
  privateGetV1AccountsTraderIdWallets(params?: {}): Promise<implicitReturnType>;
20
24
  privateGetV1AccountsTraderIdWalletLedger(params?: {}): Promise<implicitReturnType>;
@@ -28,6 +32,8 @@ interface Exchange {
28
32
  privateGetV1Transfers(params?: {}): Promise<implicitReturnType>;
29
33
  privateGetV1User(params?: {}): Promise<implicitReturnType>;
30
34
  privateGetV1Credits(params?: {}): Promise<implicitReturnType>;
35
+ privateGetV1Positions(params?: {}): Promise<implicitReturnType>;
36
+ privateGetV1AccountsTraderIdCompetitions(params?: {}): Promise<implicitReturnType>;
31
37
  privatePostV1Keys(params?: {}): Promise<implicitReturnType>;
32
38
  privatePostV1Orders(params?: {}): Promise<implicitReturnType>;
33
39
  privatePostV1OrdersCancelAllAfter(params?: {}): Promise<implicitReturnType>;
@@ -37,6 +43,8 @@ interface Exchange {
37
43
  privatePostV1TransfersInternalTransfer(params?: {}): Promise<implicitReturnType>;
38
44
  privatePostV1TransfersWithdrawalRequest(params?: {}): Promise<implicitReturnType>;
39
45
  privatePostV1OrdersBulk(params?: {}): Promise<implicitReturnType>;
46
+ privatePostV1AccountsTraderIdCompetitions(params?: {}): Promise<implicitReturnType>;
47
+ privatePostV1AccountsTraderIdCreateCompetition(params?: {}): Promise<implicitReturnType>;
40
48
  privatePatchV1OrdersOrderId(params?: {}): Promise<implicitReturnType>;
41
49
  privatePatchV1OrdersBulk(params?: {}): Promise<implicitReturnType>;
42
50
  privateDeleteV1KeysKey(params?: {}): Promise<implicitReturnType>;
@@ -811,12 +811,14 @@ export default class ascendex extends Exchange {
811
811
  */
812
812
  await this.loadMarkets();
813
813
  await this.loadAccounts();
814
- let query = undefined;
815
814
  let marketType = undefined;
816
- [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
815
+ let marginMode = undefined;
816
+ [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
817
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
817
818
  const isMargin = this.safeValue(params, 'margin', false);
818
- marketType = isMargin ? 'margin' : marketType;
819
- query = this.omit(query, 'margin');
819
+ const isCross = marginMode === 'cross';
820
+ marketType = (isMargin || isCross) ? 'margin' : marketType;
821
+ params = this.omit(params, 'margin');
820
822
  const accountsByType = this.safeValue(this.options, 'accountsByType', {});
821
823
  const accountCategory = this.safeString(accountsByType, marketType, 'cash');
822
824
  const account = this.safeValue(this.accounts, 0, {});
@@ -824,15 +826,18 @@ export default class ascendex extends Exchange {
824
826
  const request = {
825
827
  'account-group': accountGroup,
826
828
  };
829
+ if ((marginMode === 'isolated') && (marketType !== 'swap')) {
830
+ throw new BadRequest(this.id + ' does not supported isolated margin trading');
831
+ }
827
832
  if ((accountCategory === 'cash') || (accountCategory === 'margin')) {
828
833
  request['account-category'] = accountCategory;
829
834
  }
830
835
  let response = undefined;
831
836
  if ((marketType === 'spot') || (marketType === 'margin')) {
832
- response = await this.v1PrivateAccountCategoryGetBalance(this.extend(request, query));
837
+ response = await this.v1PrivateAccountCategoryGetBalance(this.extend(request, params));
833
838
  }
834
839
  else if (marketType === 'swap') {
835
- response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, query));
840
+ response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, params));
836
841
  }
837
842
  else {
838
843
  throw new NotSupported(this.id + ' fetchBalance() is not currently supported for ' + marketType + ' markets');