ccxt 4.2.15 → 4.2.16
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/README.md +3 -3
- package/dist/ccxt.browser.js +622 -155
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/js/ccxt.js +3 -1
- package/dist/cjs/js/src/ascendex.js +11 -6
- package/dist/cjs/js/src/base/Exchange.js +12 -12
- package/dist/cjs/js/src/bingx.js +37 -3
- package/dist/cjs/js/src/bitmex.js +3 -6
- package/dist/cjs/js/src/coinone.js +1 -1
- package/dist/cjs/js/src/phemex.js +28 -25
- package/dist/cjs/js/src/pro/coinone.js +411 -0
- package/dist/cjs/js/src/pro/krakenfutures.js +7 -1
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/ascendex.js +11 -6
- package/js/src/base/Exchange.js +12 -12
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +38 -4
- package/js/src/bitmex.js +3 -6
- package/js/src/coinone.js +1 -1
- package/js/src/phemex.js +28 -25
- package/js/src/pro/coinone.d.ts +21 -0
- package/js/src/pro/coinone.js +412 -0
- package/js/src/pro/krakenfutures.js +7 -1
- package/package.json +1 -1
- 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;
|
|
@@ -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
|
-
|
|
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
|
/**
|
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.
|
|
7
|
+
declare const version = "4.2.15";
|
|
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.
|
|
41
|
+
const version = '4.2.16';
|
|
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,
|
package/js/src/ascendex.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
819
|
-
|
|
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,
|
|
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,
|
|
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');
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1448,11 +1448,11 @@ export default class Exchange {
|
|
|
1448
1448
|
let httpsProxy = undefined;
|
|
1449
1449
|
let socksProxy = undefined;
|
|
1450
1450
|
// httpProxy
|
|
1451
|
-
if (this.httpProxy
|
|
1451
|
+
if (this.valueIsDefined(this.httpProxy)) {
|
|
1452
1452
|
usedProxies.push('httpProxy');
|
|
1453
1453
|
httpProxy = this.httpProxy;
|
|
1454
1454
|
}
|
|
1455
|
-
if (this.http_proxy
|
|
1455
|
+
if (this.valueIsDefined(this.http_proxy)) {
|
|
1456
1456
|
usedProxies.push('http_proxy');
|
|
1457
1457
|
httpProxy = this.http_proxy;
|
|
1458
1458
|
}
|
|
@@ -1465,11 +1465,11 @@ export default class Exchange {
|
|
|
1465
1465
|
httpProxy = this.http_proxy_callback(url, method, headers, body);
|
|
1466
1466
|
}
|
|
1467
1467
|
// httpsProxy
|
|
1468
|
-
if (this.httpsProxy
|
|
1468
|
+
if (this.valueIsDefined(this.httpsProxy)) {
|
|
1469
1469
|
usedProxies.push('httpsProxy');
|
|
1470
1470
|
httpsProxy = this.httpsProxy;
|
|
1471
1471
|
}
|
|
1472
|
-
if (this.https_proxy
|
|
1472
|
+
if (this.valueIsDefined(this.https_proxy)) {
|
|
1473
1473
|
usedProxies.push('https_proxy');
|
|
1474
1474
|
httpsProxy = this.https_proxy;
|
|
1475
1475
|
}
|
|
@@ -1482,11 +1482,11 @@ export default class Exchange {
|
|
|
1482
1482
|
httpsProxy = this.https_proxy_callback(url, method, headers, body);
|
|
1483
1483
|
}
|
|
1484
1484
|
// socksProxy
|
|
1485
|
-
if (this.socksProxy
|
|
1485
|
+
if (this.valueIsDefined(this.socksProxy)) {
|
|
1486
1486
|
usedProxies.push('socksProxy');
|
|
1487
1487
|
socksProxy = this.socksProxy;
|
|
1488
1488
|
}
|
|
1489
|
-
if (this.socks_proxy
|
|
1489
|
+
if (this.valueIsDefined(this.socks_proxy)) {
|
|
1490
1490
|
usedProxies.push('socks_proxy');
|
|
1491
1491
|
socksProxy = this.socks_proxy;
|
|
1492
1492
|
}
|
|
@@ -1512,29 +1512,29 @@ export default class Exchange {
|
|
|
1512
1512
|
let wssProxy = undefined;
|
|
1513
1513
|
let wsSocksProxy = undefined;
|
|
1514
1514
|
// ws proxy
|
|
1515
|
-
if (this.wsProxy
|
|
1515
|
+
if (this.valueIsDefined(this.wsProxy)) {
|
|
1516
1516
|
usedProxies.push('wsProxy');
|
|
1517
1517
|
wsProxy = this.wsProxy;
|
|
1518
1518
|
}
|
|
1519
|
-
if (this.ws_proxy
|
|
1519
|
+
if (this.valueIsDefined(this.ws_proxy)) {
|
|
1520
1520
|
usedProxies.push('ws_proxy');
|
|
1521
1521
|
wsProxy = this.ws_proxy;
|
|
1522
1522
|
}
|
|
1523
1523
|
// wss proxy
|
|
1524
|
-
if (this.wssProxy
|
|
1524
|
+
if (this.valueIsDefined(this.wssProxy)) {
|
|
1525
1525
|
usedProxies.push('wssProxy');
|
|
1526
1526
|
wssProxy = this.wssProxy;
|
|
1527
1527
|
}
|
|
1528
|
-
if (this.wss_proxy
|
|
1528
|
+
if (this.valueIsDefined(this.wss_proxy)) {
|
|
1529
1529
|
usedProxies.push('wss_proxy');
|
|
1530
1530
|
wssProxy = this.wss_proxy;
|
|
1531
1531
|
}
|
|
1532
1532
|
// ws socks proxy
|
|
1533
|
-
if (this.wsSocksProxy
|
|
1533
|
+
if (this.valueIsDefined(this.wsSocksProxy)) {
|
|
1534
1534
|
usedProxies.push('wsSocksProxy');
|
|
1535
1535
|
wsSocksProxy = this.wsSocksProxy;
|
|
1536
1536
|
}
|
|
1537
|
-
if (this.ws_socks_proxy
|
|
1537
|
+
if (this.valueIsDefined(this.ws_socks_proxy)) {
|
|
1538
1538
|
usedProxies.push('ws_socks_proxy');
|
|
1539
1539
|
wsSocksProxy = this.ws_socks_proxy;
|
|
1540
1540
|
}
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -143,5 +143,6 @@ export default class bingx extends Exchange {
|
|
|
143
143
|
headers: any;
|
|
144
144
|
};
|
|
145
145
|
nonce(): number;
|
|
146
|
+
setSandboxMode(enable: any): void;
|
|
146
147
|
handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
147
148
|
}
|