ccxt 4.2.95 → 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 +51 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +746 -148
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +18 -3
- package/dist/cjs/src/base/functions/crypto.js +15 -2
- package/dist/cjs/src/base/functions/rsa.js +2 -2
- package/dist/cjs/src/binance.js +11 -12
- package/dist/cjs/src/coinbase.js +621 -102
- package/dist/cjs/src/deribit.js +8 -3
- package/dist/cjs/src/gemini.js +29 -11
- package/dist/cjs/src/okx.js +2 -2
- package/dist/cjs/src/poloniexfutures.js +4 -1
- package/dist/cjs/src/pro/binance.js +10 -4
- package/dist/cjs/src/pro/coinbase.js +19 -4
- package/dist/cjs/src/pro/poloniexfutures.js +5 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinbase.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +18 -3
- package/js/src/base/functions/crypto.d.ts +1 -1
- package/js/src/base/functions/crypto.js +15 -2
- package/js/src/base/functions/rsa.js +2 -2
- package/js/src/base/types.d.ts +1 -0
- package/js/src/base/ws/OrderBook.d.ts +1 -0
- package/js/src/base/ws/OrderBookSide.d.ts +2 -2
- package/js/src/binance.js +11 -12
- package/js/src/coinbase.d.ts +8 -1
- package/js/src/coinbase.js +622 -103
- package/js/src/deribit.js +8 -3
- package/js/src/gemini.js +29 -11
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +2 -2
- package/js/src/poloniexfutures.js +4 -1
- package/js/src/pro/binance.js +11 -5
- package/js/src/pro/coinbase.js +19 -4
- package/js/src/pro/poloniexfutures.js +6 -2
- package/package.json +1 -1
- package/skip-tests.json +163 -31
package/js/src/deribit.js
CHANGED
|
@@ -1215,13 +1215,18 @@ export default class deribit extends Exchange {
|
|
|
1215
1215
|
* @name deribit#fetchTickers
|
|
1216
1216
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1217
1217
|
* @see https://docs.deribit.com/#public-get_book_summary_by_currency
|
|
1218
|
-
* @param {string[]
|
|
1218
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1219
1219
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1220
|
+
* @param {string} [params.code] *required* the currency code to fetch the tickers for, eg. 'BTC', 'ETH'
|
|
1220
1221
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1221
1222
|
*/
|
|
1222
1223
|
await this.loadMarkets();
|
|
1223
1224
|
symbols = this.marketSymbols(symbols);
|
|
1224
|
-
const code = this.
|
|
1225
|
+
const code = this.safeString2(params, 'code', 'currency');
|
|
1226
|
+
params = this.omit(params, ['code']);
|
|
1227
|
+
if (code === undefined) {
|
|
1228
|
+
throw new ArgumentsRequired(this.id + ' fetchTickers requires a currency/code (eg: BTC/ETH/USDT) parameter to fetch tickers for');
|
|
1229
|
+
}
|
|
1225
1230
|
const currency = this.currency(code);
|
|
1226
1231
|
const request = {
|
|
1227
1232
|
'currency': currency['id'],
|
|
@@ -1257,7 +1262,7 @@ export default class deribit extends Exchange {
|
|
|
1257
1262
|
// "testnet": false
|
|
1258
1263
|
// }
|
|
1259
1264
|
//
|
|
1260
|
-
const result = this.
|
|
1265
|
+
const result = this.safeList(response, 'result', []);
|
|
1261
1266
|
const tickers = {};
|
|
1262
1267
|
for (let i = 0; i < result.length; i++) {
|
|
1263
1268
|
const ticker = this.parseTicker(result[i]);
|
package/js/src/gemini.js
CHANGED
|
@@ -288,7 +288,13 @@ export default class gemini extends Exchange {
|
|
|
288
288
|
'ATOM': 'cosmos',
|
|
289
289
|
'DOT': 'polkadot',
|
|
290
290
|
},
|
|
291
|
-
'nonce': 'milliseconds',
|
|
291
|
+
'nonce': 'milliseconds',
|
|
292
|
+
'conflictingMarkets': {
|
|
293
|
+
'paxgusd': {
|
|
294
|
+
'base': 'PAXG',
|
|
295
|
+
'quote': 'USD',
|
|
296
|
+
},
|
|
297
|
+
},
|
|
292
298
|
},
|
|
293
299
|
});
|
|
294
300
|
}
|
|
@@ -682,17 +688,29 @@ export default class gemini extends Exchange {
|
|
|
682
688
|
const marketIdUpper = marketId.toUpperCase();
|
|
683
689
|
const isPerp = (marketIdUpper.indexOf('PERP') >= 0);
|
|
684
690
|
const marketIdWithoutPerp = marketIdUpper.replace('PERP', '');
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
691
|
+
const conflictingMarkets = this.safeDict(this.options, 'conflictingMarkets', {});
|
|
692
|
+
const lowerCaseId = marketIdWithoutPerp.toLowerCase();
|
|
693
|
+
if (lowerCaseId in conflictingMarkets) {
|
|
694
|
+
const conflictingMarket = conflictingMarkets[lowerCaseId];
|
|
695
|
+
baseId = conflictingMarket['base'];
|
|
696
|
+
quoteId = conflictingMarket['quote'];
|
|
697
|
+
if (isPerp) {
|
|
698
|
+
settleId = conflictingMarket['quote'];
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
const quoteCurrencies = this.handleOption('fetchMarketsFromAPI', 'quoteCurrencies', []);
|
|
703
|
+
for (let i = 0; i < quoteCurrencies.length; i++) {
|
|
704
|
+
const quoteCurrency = quoteCurrencies[i];
|
|
705
|
+
if (marketIdWithoutPerp.endsWith(quoteCurrency)) {
|
|
706
|
+
const quoteLength = this.parseToInt(-1 * quoteCurrency.length);
|
|
707
|
+
baseId = marketIdWithoutPerp.slice(0, quoteLength);
|
|
708
|
+
quoteId = quoteCurrency;
|
|
709
|
+
if (isPerp) {
|
|
710
|
+
settleId = quoteCurrency; // always same
|
|
711
|
+
}
|
|
712
|
+
break;
|
|
694
713
|
}
|
|
695
|
-
break;
|
|
696
714
|
}
|
|
697
715
|
}
|
|
698
716
|
}
|
package/js/src/okx.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, Fun
|
|
|
6
6
|
*/
|
|
7
7
|
export default class okx extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
-
handleMarketTypeAndParams(methodName:
|
|
9
|
+
handleMarketTypeAndParams(methodName: string, market?: Market, params?: {}, defaultValue?: any): any;
|
|
10
10
|
convertToInstrumentType(type: any): string;
|
|
11
11
|
createExpiredOptionMarket(symbol: string): MarketInterface;
|
|
12
12
|
safeMarket(marketId?: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
|
package/js/src/okx.js
CHANGED
|
@@ -1110,14 +1110,14 @@ export default class okx extends Exchange {
|
|
|
1110
1110
|
},
|
|
1111
1111
|
});
|
|
1112
1112
|
}
|
|
1113
|
-
handleMarketTypeAndParams(methodName, market = undefined, params = {}) {
|
|
1113
|
+
handleMarketTypeAndParams(methodName, market = undefined, params = {}, defaultValue = undefined) {
|
|
1114
1114
|
const instType = this.safeString(params, 'instType');
|
|
1115
1115
|
params = this.omit(params, 'instType');
|
|
1116
1116
|
const type = this.safeString(params, 'type');
|
|
1117
1117
|
if ((type === undefined) && (instType !== undefined)) {
|
|
1118
1118
|
params['type'] = instType;
|
|
1119
1119
|
}
|
|
1120
|
-
return super.handleMarketTypeAndParams(methodName, market, params);
|
|
1120
|
+
return super.handleMarketTypeAndParams(methodName, market, params, defaultValue);
|
|
1121
1121
|
}
|
|
1122
1122
|
convertToInstrumentType(type) {
|
|
1123
1123
|
const exchangeTypes = this.safeDict(this.options, 'exchangeType', {});
|
|
@@ -375,7 +375,10 @@ export default class poloniexfutures extends Exchange {
|
|
|
375
375
|
//
|
|
376
376
|
const marketId = this.safeString(ticker, 'symbol');
|
|
377
377
|
const symbol = this.safeSymbol(marketId, market);
|
|
378
|
-
const
|
|
378
|
+
const timestampString = this.safeString(ticker, 'ts');
|
|
379
|
+
// check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011
|
|
380
|
+
const multiplier = (timestampString.length === 18) ? 0.00001 : 0.000001;
|
|
381
|
+
const timestamp = this.safeIntegerProduct(ticker, 'ts', multiplier);
|
|
379
382
|
const last = this.safeString2(ticker, 'price', 'lastPrice');
|
|
380
383
|
const percentage = Precise.stringMul(this.safeString(ticker, 'priceChgPct'), '100');
|
|
381
384
|
return this.safeTicker({
|
package/js/src/pro/binance.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
8
|
import binanceRest from '../binance.js';
|
|
9
9
|
import { Precise } from '../base/Precise.js';
|
|
10
|
-
import {
|
|
10
|
+
import { InvalidNonce, ArgumentsRequired, BadRequest, NotSupported } from '../base/errors.js';
|
|
11
11
|
import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide } from '../base/ws/Cache.js';
|
|
12
12
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
import { rsa } from '../base/functions/rsa.js';
|
|
@@ -425,8 +425,11 @@ export default class binance extends binanceRest {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
else {
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
429
|
+
if (checksum) {
|
|
430
|
+
// todo: client.reject from handleOrderBookMessage properly
|
|
431
|
+
throw new InvalidNonce(this.id + ' handleOrderBook received an out-of-order nonce');
|
|
432
|
+
}
|
|
430
433
|
}
|
|
431
434
|
}
|
|
432
435
|
}
|
|
@@ -443,8 +446,11 @@ export default class binance extends binanceRest {
|
|
|
443
446
|
}
|
|
444
447
|
}
|
|
445
448
|
else {
|
|
446
|
-
|
|
447
|
-
|
|
449
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
450
|
+
if (checksum) {
|
|
451
|
+
// todo: client.reject from handleOrderBookMessage properly
|
|
452
|
+
throw new InvalidNonce(this.id + ' handleOrderBook received an out-of-order nonce');
|
|
453
|
+
}
|
|
448
454
|
}
|
|
449
455
|
}
|
|
450
456
|
}
|
package/js/src/pro/coinbase.js
CHANGED
|
@@ -143,6 +143,11 @@ export default class coinbase extends coinbaseRest {
|
|
|
143
143
|
// "low_52_w": "15460",
|
|
144
144
|
// "high_52_w": "48240",
|
|
145
145
|
// "price_percent_chg_24_h": "-4.15775596190603"
|
|
146
|
+
// new as of 2024-04-12
|
|
147
|
+
// "best_bid":"21835.29",
|
|
148
|
+
// "best_bid_quantity": "0.02000000",
|
|
149
|
+
// "best_ask":"23011.18",
|
|
150
|
+
// "best_ask_quantity": "0.01500000"
|
|
146
151
|
// }
|
|
147
152
|
// ]
|
|
148
153
|
// }
|
|
@@ -168,6 +173,11 @@ export default class coinbase extends coinbaseRest {
|
|
|
168
173
|
// "low_52_w": "0.04908",
|
|
169
174
|
// "high_52_w": "0.1801",
|
|
170
175
|
// "price_percent_chg_24_h": "0.50177456859626"
|
|
176
|
+
// new as of 2024-04-12
|
|
177
|
+
// "best_bid":"0.07989",
|
|
178
|
+
// "best_bid_quantity": "500.0",
|
|
179
|
+
// "best_ask":"0.08308",
|
|
180
|
+
// "best_ask_quantity": "300.0"
|
|
171
181
|
// }
|
|
172
182
|
// ]
|
|
173
183
|
// }
|
|
@@ -222,6 +232,11 @@ export default class coinbase extends coinbaseRest {
|
|
|
222
232
|
// "low_52_w": "0.04908",
|
|
223
233
|
// "high_52_w": "0.1801",
|
|
224
234
|
// "price_percent_chg_24_h": "0.50177456859626"
|
|
235
|
+
// new as of 2024-04-12
|
|
236
|
+
// "best_bid":"0.07989",
|
|
237
|
+
// "best_bid_quantity": "500.0",
|
|
238
|
+
// "best_ask":"0.08308",
|
|
239
|
+
// "best_ask_quantity": "300.0"
|
|
225
240
|
// }
|
|
226
241
|
//
|
|
227
242
|
const marketId = this.safeString(ticker, 'product_id');
|
|
@@ -234,10 +249,10 @@ export default class coinbase extends coinbaseRest {
|
|
|
234
249
|
'datetime': this.iso8601(timestamp),
|
|
235
250
|
'high': this.safeString(ticker, 'high_24_h'),
|
|
236
251
|
'low': this.safeString(ticker, 'low_24_h'),
|
|
237
|
-
'bid':
|
|
238
|
-
'bidVolume':
|
|
239
|
-
'ask':
|
|
240
|
-
'askVolume':
|
|
252
|
+
'bid': this.safeString(ticker, 'best_bid'),
|
|
253
|
+
'bidVolume': this.safeString(ticker, 'best_bid_quantity'),
|
|
254
|
+
'ask': this.safeString(ticker, 'best_ask'),
|
|
255
|
+
'askVolume': this.safeString(ticker, 'best_ask_quantity'),
|
|
241
256
|
'vwap': undefined,
|
|
242
257
|
'open': undefined,
|
|
243
258
|
'close': last,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import poloniexfuturesRest from '../poloniexfutures.js';
|
|
9
|
-
import { AuthenticationError, BadRequest,
|
|
9
|
+
import { AuthenticationError, BadRequest, InvalidNonce } from '../base/errors.js';
|
|
10
10
|
import { ArrayCache, ArrayCacheBySymbolById } from '../base/ws/Cache.js';
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
export default class poloniexfutures extends poloniexfuturesRest {
|
|
@@ -854,7 +854,11 @@ export default class poloniexfutures extends poloniexfuturesRest {
|
|
|
854
854
|
const sequence = this.safeInteger(delta, 'sequence');
|
|
855
855
|
const nonce = this.safeInteger(orderbook, 'nonce');
|
|
856
856
|
if (nonce !== sequence - 1) {
|
|
857
|
-
|
|
857
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
858
|
+
if (checksum) {
|
|
859
|
+
// todo: client.reject from handleOrderBookMessage properly
|
|
860
|
+
throw new InvalidNonce(this.id + ' watchOrderBook received an out-of-order nonce');
|
|
861
|
+
}
|
|
858
862
|
}
|
|
859
863
|
const change = this.safeString(delta, 'change');
|
|
860
864
|
const splitChange = change.split(',');
|
package/package.json
CHANGED