ccxt 4.2.49 → 4.2.51
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/build.sh +1 -1
- package/dist/ccxt.browser.js +235 -24
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +5 -0
- package/dist/cjs/src/binance.js +9 -1
- package/dist/cjs/src/bl3p.js +47 -0
- package/dist/cjs/src/mexc.js +2 -1
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/pro/bequant.js +3 -4
- package/dist/cjs/src/pro/binance.js +29 -2
- package/dist/cjs/src/pro/bitcoincom.js +4 -5
- package/dist/cjs/src/pro/gemini.js +89 -1
- package/dist/cjs/src/pro/whitebit.js +9 -8
- package/dist/cjs/src/timex.js +35 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +5 -0
- package/js/src/abstract/binancecoinm.d.ts +5 -0
- package/js/src/abstract/binanceus.d.ts +5 -0
- package/js/src/abstract/binanceusdm.d.ts +5 -0
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +5 -0
- package/js/src/binance.js +9 -1
- package/js/src/bl3p.d.ts +15 -1
- package/js/src/bl3p.js +47 -0
- package/js/src/mexc.js +2 -1
- package/js/src/okx.js +1 -1
- package/js/src/pro/bequant.js +3 -4
- package/js/src/pro/binance.d.ts +1 -0
- package/js/src/pro/binance.js +29 -2
- package/js/src/pro/bitcoincom.js +4 -5
- package/js/src/pro/gemini.d.ts +3 -1
- package/js/src/pro/gemini.js +89 -1
- package/js/src/pro/whitebit.js +9 -8
- package/js/src/timex.d.ts +1 -0
- package/js/src/timex.js +35 -1
- package/package.json +2 -2
- package/skip-tests.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
177
177
|
|
|
178
178
|
//-----------------------------------------------------------------------------
|
|
179
179
|
// this is updated by vss.js when building
|
|
180
|
-
const version = '4.2.
|
|
180
|
+
const version = '4.2.51';
|
|
181
181
|
Exchange["default"].ccxtVersion = version;
|
|
182
182
|
const exchanges = {
|
|
183
183
|
'ace': ace,
|
|
@@ -2263,6 +2263,11 @@ class Exchange {
|
|
|
2263
2263
|
this.codes = Object.keys(currenciesSortedByCode);
|
|
2264
2264
|
return this.markets;
|
|
2265
2265
|
}
|
|
2266
|
+
getDescribeForExtendedWsExchange(currentRestInstance, parentRestInstance, wsBaseDescribe) {
|
|
2267
|
+
const extendedRestDescribe = this.deepExtend(parentRestInstance.describe(), currentRestInstance.describe());
|
|
2268
|
+
const superWithRestDescribe = this.deepExtend(extendedRestDescribe, wsBaseDescribe);
|
|
2269
|
+
return superWithRestDescribe;
|
|
2270
|
+
}
|
|
2266
2271
|
safeBalance(balance) {
|
|
2267
2272
|
const balances = this.omit(balance, ['info', 'timestamp', 'datetime', 'free', 'used', 'total']);
|
|
2268
2273
|
const codes = Object.keys(balances);
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -46,6 +46,7 @@ class binance extends binance$1 {
|
|
|
46
46
|
'createMarketSellOrderWithCost': true,
|
|
47
47
|
'createOrder': true,
|
|
48
48
|
'createOrders': true,
|
|
49
|
+
'createOrderWithTakeProfitAndStopLoss': true,
|
|
49
50
|
'createPostOnlyOrder': true,
|
|
50
51
|
'createReduceOnlyOrder': true,
|
|
51
52
|
'createStopLimitOrder': true,
|
|
@@ -119,7 +120,7 @@ class binance extends binance$1 {
|
|
|
119
120
|
'fetchTradingFee': true,
|
|
120
121
|
'fetchTradingFees': true,
|
|
121
122
|
'fetchTradingLimits': undefined,
|
|
122
|
-
'fetchTransactionFee':
|
|
123
|
+
'fetchTransactionFee': 'emulated',
|
|
123
124
|
'fetchTransactionFees': true,
|
|
124
125
|
'fetchTransactions': false,
|
|
125
126
|
'fetchTransfers': true,
|
|
@@ -471,6 +472,10 @@ class binance extends binance$1 {
|
|
|
471
472
|
'simple-earn/flexible/history/rewardsRecord': 15,
|
|
472
473
|
'simple-earn/locked/history/rewardsRecord': 15,
|
|
473
474
|
'simple-earn/flexible/history/collateralRecord': 0.1,
|
|
475
|
+
// Convert
|
|
476
|
+
'dci/product/list': 0.1,
|
|
477
|
+
'dci/product/positions': 0.1,
|
|
478
|
+
'dci/product/accounts': 0.1,
|
|
474
479
|
},
|
|
475
480
|
'post': {
|
|
476
481
|
'asset/dust': 0.06667,
|
|
@@ -599,6 +604,9 @@ class binance extends binance$1 {
|
|
|
599
604
|
'simple-earn/locked/redeem': 0.1,
|
|
600
605
|
'simple-earn/flexible/setAutoSubscribe': 15,
|
|
601
606
|
'simple-earn/locked/setAutoSubscribe': 15,
|
|
607
|
+
// convert
|
|
608
|
+
'dci/product/subscribe': 0.1,
|
|
609
|
+
'dci/product/auto_compound/edit': 0.1,
|
|
602
610
|
},
|
|
603
611
|
'put': {
|
|
604
612
|
'userDataStream': 0.1,
|
package/dist/cjs/src/bl3p.js
CHANGED
|
@@ -32,6 +32,7 @@ class bl3p extends bl3p$1 {
|
|
|
32
32
|
'cancelOrder': true,
|
|
33
33
|
'closeAllPositions': false,
|
|
34
34
|
'closePosition': false,
|
|
35
|
+
'createDepositAddress': true,
|
|
35
36
|
'createOrder': true,
|
|
36
37
|
'createReduceOnlyOrder': false,
|
|
37
38
|
'createStopLimitOrder': false,
|
|
@@ -42,6 +43,9 @@ class bl3p extends bl3p$1 {
|
|
|
42
43
|
'fetchBorrowRateHistory': false,
|
|
43
44
|
'fetchCrossBorrowRate': false,
|
|
44
45
|
'fetchCrossBorrowRates': false,
|
|
46
|
+
'fetchDepositAddress': false,
|
|
47
|
+
'fetchDepositAddresses': false,
|
|
48
|
+
'fetchDepositAddressesByNetwork': false,
|
|
45
49
|
'fetchFundingHistory': false,
|
|
46
50
|
'fetchFundingRate': false,
|
|
47
51
|
'fetchFundingRateHistory': false,
|
|
@@ -423,6 +427,49 @@ class bl3p extends bl3p$1 {
|
|
|
423
427
|
};
|
|
424
428
|
return await this.privatePostMarketMoneyOrderCancel(this.extend(request, params));
|
|
425
429
|
}
|
|
430
|
+
async createDepositAddress(code, params = {}) {
|
|
431
|
+
/**
|
|
432
|
+
* @method
|
|
433
|
+
* @name bl3p#createDepositAddress
|
|
434
|
+
* @description create a currency deposit address
|
|
435
|
+
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#32---create-a-new-deposit-address
|
|
436
|
+
* @param {string} code unified currency code of the currency for the deposit address
|
|
437
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
438
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
439
|
+
*/
|
|
440
|
+
await this.loadMarkets();
|
|
441
|
+
const currency = this.currency(code);
|
|
442
|
+
const request = {
|
|
443
|
+
'currency': currency['id'],
|
|
444
|
+
};
|
|
445
|
+
const response = await this.privatePostGENMKTMoneyNewDepositAddress(this.extend(request, params));
|
|
446
|
+
//
|
|
447
|
+
// {
|
|
448
|
+
// "result": "success",
|
|
449
|
+
// "data": {
|
|
450
|
+
// "address": "36Udu9zi1uYicpXcJpoKfv3bewZeok5tpk"
|
|
451
|
+
// }
|
|
452
|
+
// }
|
|
453
|
+
//
|
|
454
|
+
const data = this.safeDict(response, 'data');
|
|
455
|
+
return this.parseDepositAddress(data, currency);
|
|
456
|
+
}
|
|
457
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
458
|
+
//
|
|
459
|
+
// {
|
|
460
|
+
// "address": "36Udu9zi1uYicpXcJpoKfv3bewZeok5tpk"
|
|
461
|
+
// }
|
|
462
|
+
//
|
|
463
|
+
const address = this.safeString(depositAddress, 'address');
|
|
464
|
+
this.checkAddress(address);
|
|
465
|
+
return {
|
|
466
|
+
'info': depositAddress,
|
|
467
|
+
'currency': this.safeString(currency, 'code'),
|
|
468
|
+
'address': address,
|
|
469
|
+
'tag': undefined,
|
|
470
|
+
'network': undefined,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
426
473
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
427
474
|
const request = this.implodeParams(path, params);
|
|
428
475
|
let url = this.urls['api']['rest'] + '/' + this.version + '/' + request;
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -889,6 +889,7 @@ class mexc extends mexc$1 {
|
|
|
889
889
|
'700006': errors.BadRequest,
|
|
890
890
|
'700007': errors.AuthenticationError,
|
|
891
891
|
'700008': errors.BadRequest,
|
|
892
|
+
'700013': errors.AuthenticationError,
|
|
892
893
|
'730001': errors.BadRequest,
|
|
893
894
|
'730002': errors.BadRequest,
|
|
894
895
|
'730000': errors.ExchangeError,
|
|
@@ -5420,7 +5421,7 @@ class mexc extends mexc$1 {
|
|
|
5420
5421
|
'source': this.safeString(this.options, 'broker', 'CCXT'),
|
|
5421
5422
|
};
|
|
5422
5423
|
}
|
|
5423
|
-
if (method === 'POST') {
|
|
5424
|
+
if ((method === 'POST') || (method === 'PUT')) {
|
|
5424
5425
|
headers['Content-Type'] = 'application/json';
|
|
5425
5426
|
}
|
|
5426
5427
|
}
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -5468,7 +5468,7 @@ class okx extends okx$1 {
|
|
|
5468
5468
|
const liquidationPrice = this.safeNumber(position, 'liqPx');
|
|
5469
5469
|
const percentageString = this.safeString(position, 'uplRatio');
|
|
5470
5470
|
const percentage = this.parseNumber(Precise["default"].stringMul(percentageString, '100'));
|
|
5471
|
-
const timestamp = this.safeInteger(position, '
|
|
5471
|
+
const timestamp = this.safeInteger(position, 'cTime');
|
|
5472
5472
|
const marginRatio = this.parseNumber(Precise["default"].stringDiv(maintenanceMarginString, collateralString, 4));
|
|
5473
5473
|
return this.safePosition({
|
|
5474
5474
|
'info': position,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var hitbtc = require('./hitbtc.js');
|
|
4
|
+
var hitbtc$1 = require('../hitbtc.js');
|
|
4
5
|
var bequant$1 = require('../bequant.js');
|
|
5
6
|
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
@@ -8,10 +9,8 @@ var bequant$1 = require('../bequant.js');
|
|
|
8
9
|
class bequant extends hitbtc {
|
|
9
10
|
describe() {
|
|
10
11
|
// eslint-disable-next-line new-cap
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
14
|
-
return this.deepExtend(extended, {
|
|
12
|
+
const describeExtended = this.getDescribeForExtendedWsExchange(new bequant$1(), new hitbtc$1(), super.describe());
|
|
13
|
+
return this.deepExtend(describeExtended, {
|
|
15
14
|
'id': 'bequant',
|
|
16
15
|
'name': 'Bequant',
|
|
17
16
|
'countries': ['MT'],
|
|
@@ -34,10 +34,15 @@ class binance extends binance$1 {
|
|
|
34
34
|
'cancelOrderWs': true,
|
|
35
35
|
'cancelOrdersWs': false,
|
|
36
36
|
'cancelAllOrdersWs': true,
|
|
37
|
-
'fetchOrderWs': true,
|
|
38
|
-
'fetchOrdersWs': true,
|
|
39
37
|
'fetchBalanceWs': true,
|
|
38
|
+
'fetchDepositsWs': false,
|
|
39
|
+
'fetchMarketsWs': false,
|
|
40
40
|
'fetchMyTradesWs': true,
|
|
41
|
+
'fetchOpenOrdersWs': true,
|
|
42
|
+
'fetchOrderWs': true,
|
|
43
|
+
'fetchOrdersWs': true,
|
|
44
|
+
'fetchTradingFeesWs': false,
|
|
45
|
+
'fetchWithdrawalsWs': false,
|
|
41
46
|
},
|
|
42
47
|
'urls': {
|
|
43
48
|
'test': {
|
|
@@ -1938,6 +1943,28 @@ class binance extends binance$1 {
|
|
|
1938
1943
|
const orders = await this.watch(url, messageHash, message, messageHash, subscription);
|
|
1939
1944
|
return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
|
|
1940
1945
|
}
|
|
1946
|
+
async fetchClosedOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1947
|
+
/**
|
|
1948
|
+
* @method
|
|
1949
|
+
* @name binance#fetchClosedOrdersWs
|
|
1950
|
+
* @see https://binance-docs.github.io/apidocs/websocket_api/en/#account-order-history-user_data
|
|
1951
|
+
* @description fetch closed orders
|
|
1952
|
+
* @param {string} symbol unified market symbol
|
|
1953
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1954
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
1955
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1956
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1957
|
+
*/
|
|
1958
|
+
const orders = await this.fetchOrdersWs(symbol, since, limit, params);
|
|
1959
|
+
const closedOrders = [];
|
|
1960
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1961
|
+
const order = orders[i];
|
|
1962
|
+
if (order['status'] === 'closed') {
|
|
1963
|
+
closedOrders.push(order);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
return closedOrders;
|
|
1967
|
+
}
|
|
1941
1968
|
async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1942
1969
|
/**
|
|
1943
1970
|
* @method
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var hitbtc = require('./hitbtc.js');
|
|
4
|
-
var
|
|
4
|
+
var hitbtc$1 = require('../hitbtc.js');
|
|
5
|
+
var bitcoincom$1 = require('../bitcoincom.js');
|
|
5
6
|
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
7
8
|
// ---------------------------------------------------------------------------
|
|
8
9
|
class bitcoincom extends hitbtc {
|
|
9
10
|
describe() {
|
|
10
11
|
// eslint-disable-next-line new-cap
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
14
|
-
return this.deepExtend(extended, {
|
|
12
|
+
const describeExtended = this.getDescribeForExtendedWsExchange(new bitcoincom$1(), new hitbtc$1(), super.describe());
|
|
13
|
+
return this.deepExtend(describeExtended, {
|
|
15
14
|
'id': 'bitcoincom',
|
|
16
15
|
'name': 'bitcoin.com',
|
|
17
16
|
'countries': ['KN'],
|
|
@@ -15,6 +15,7 @@ class gemini extends gemini$1 {
|
|
|
15
15
|
'watchBalance': false,
|
|
16
16
|
'watchTicker': false,
|
|
17
17
|
'watchTickers': false,
|
|
18
|
+
'watchBidsAsks': true,
|
|
18
19
|
'watchTrades': true,
|
|
19
20
|
'watchTradesForSymbols': true,
|
|
20
21
|
'watchMyTrades': false,
|
|
@@ -414,6 +415,79 @@ class gemini extends gemini$1 {
|
|
|
414
415
|
const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
|
|
415
416
|
return orderbook.limit();
|
|
416
417
|
}
|
|
418
|
+
async watchBidsAsks(symbols, limit = undefined, params = {}) {
|
|
419
|
+
/**
|
|
420
|
+
* @method
|
|
421
|
+
* @name gemini#watchBidsAsks
|
|
422
|
+
* @description watches best bid & ask for symbols
|
|
423
|
+
* @see https://docs.gemini.com/websocket-api/#multi-market-data
|
|
424
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
425
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
426
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
427
|
+
*/
|
|
428
|
+
return await this.helperForWatchMultipleConstruct('bidsasks', symbols, params);
|
|
429
|
+
}
|
|
430
|
+
handleBidsAsksForMultidata(client, rawBidAskChanges, timestamp, nonce) {
|
|
431
|
+
//
|
|
432
|
+
// {
|
|
433
|
+
// eventId: '1683002916916153',
|
|
434
|
+
// events: [
|
|
435
|
+
// {
|
|
436
|
+
// price: '50945.37',
|
|
437
|
+
// reason: 'top-of-book',
|
|
438
|
+
// remaining: '0.0',
|
|
439
|
+
// side: 'bid',
|
|
440
|
+
// symbol: 'BTCUSDT',
|
|
441
|
+
// type: 'change'
|
|
442
|
+
// },
|
|
443
|
+
// {
|
|
444
|
+
// price: '50947.75',
|
|
445
|
+
// reason: 'top-of-book',
|
|
446
|
+
// remaining: '0.11725',
|
|
447
|
+
// side: 'bid',
|
|
448
|
+
// symbol: 'BTCUSDT',
|
|
449
|
+
// type: 'change'
|
|
450
|
+
// }
|
|
451
|
+
// ],
|
|
452
|
+
// socket_sequence: 322,
|
|
453
|
+
// timestamp: 1708674495,
|
|
454
|
+
// timestampms: 1708674495174,
|
|
455
|
+
// type: 'update'
|
|
456
|
+
// }
|
|
457
|
+
//
|
|
458
|
+
const marketId = rawBidAskChanges[0]['symbol'];
|
|
459
|
+
const market = this.safeMarket(marketId.toLowerCase());
|
|
460
|
+
const symbol = market['symbol'];
|
|
461
|
+
if (!(symbol in this.bidsasks)) {
|
|
462
|
+
this.bidsasks[symbol] = this.parseTicker({});
|
|
463
|
+
this.bidsasks[symbol]['symbol'] = symbol;
|
|
464
|
+
}
|
|
465
|
+
const currentBidAsk = this.bidsasks[symbol];
|
|
466
|
+
const messageHash = 'bidsasks:' + symbol;
|
|
467
|
+
// last update always overwrites the previous state and is the latest state
|
|
468
|
+
for (let i = 0; i < rawBidAskChanges.length; i++) {
|
|
469
|
+
const entry = rawBidAskChanges[i];
|
|
470
|
+
const rawSide = this.safeString(entry, 'side');
|
|
471
|
+
const price = this.safeNumber(entry, 'price');
|
|
472
|
+
const size = this.safeNumber(entry, 'remaining');
|
|
473
|
+
if (size === 0) {
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
if (rawSide === 'bid') {
|
|
477
|
+
currentBidAsk['bid'] = price;
|
|
478
|
+
currentBidAsk['bidVolume'] = size;
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
currentBidAsk['ask'] = price;
|
|
482
|
+
currentBidAsk['askVolume'] = size;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
currentBidAsk['timestamp'] = timestamp;
|
|
486
|
+
currentBidAsk['datetime'] = this.iso8601(timestamp);
|
|
487
|
+
currentBidAsk['info'] = rawBidAskChanges;
|
|
488
|
+
this.bidsasks[symbol] = currentBidAsk;
|
|
489
|
+
client.resolve(currentBidAsk, messageHash);
|
|
490
|
+
}
|
|
417
491
|
async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
|
|
418
492
|
await this.loadMarkets();
|
|
419
493
|
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
@@ -435,6 +509,9 @@ class gemini extends gemini$1 {
|
|
|
435
509
|
if (itemHashName === 'orderbook') {
|
|
436
510
|
url += 'trades=false&bids=true&offers=true';
|
|
437
511
|
}
|
|
512
|
+
else if (itemHashName === 'bidsasks') {
|
|
513
|
+
url += 'trades=false&bids=true&offers=true&top_of_book=true';
|
|
514
|
+
}
|
|
438
515
|
else if (itemHashName === 'trades') {
|
|
439
516
|
url += 'trades=true&bids=false&offers=false';
|
|
440
517
|
}
|
|
@@ -777,18 +854,29 @@ class gemini extends gemini$1 {
|
|
|
777
854
|
const eventId = this.safeInteger(message, 'eventId');
|
|
778
855
|
const events = this.safeList(message, 'events');
|
|
779
856
|
const orderBookItems = [];
|
|
857
|
+
const bidaskItems = [];
|
|
780
858
|
const collectedEventsOfTrades = [];
|
|
859
|
+
const eventsLength = events.length;
|
|
781
860
|
for (let i = 0; i < events.length; i++) {
|
|
782
861
|
const event = events[i];
|
|
783
862
|
const eventType = this.safeString(event, 'type');
|
|
784
863
|
const isOrderBook = (eventType === 'change') && ('side' in event) && this.inArray(event['side'], ['ask', 'bid']);
|
|
785
|
-
|
|
864
|
+
const eventReason = this.safeString(event, 'reason');
|
|
865
|
+
const isBidAsk = (eventReason === 'top-of-book') || (isOrderBook && (eventReason === 'initial') && eventsLength === 2);
|
|
866
|
+
if (isBidAsk) {
|
|
867
|
+
bidaskItems.push(event);
|
|
868
|
+
}
|
|
869
|
+
else if (isOrderBook) {
|
|
786
870
|
orderBookItems.push(event);
|
|
787
871
|
}
|
|
788
872
|
else if (eventType === 'trade') {
|
|
789
873
|
collectedEventsOfTrades.push(events[i]);
|
|
790
874
|
}
|
|
791
875
|
}
|
|
876
|
+
const lengthBa = bidaskItems.length;
|
|
877
|
+
if (lengthBa > 0) {
|
|
878
|
+
this.handleBidsAsksForMultidata(client, bidaskItems, ts, eventId);
|
|
879
|
+
}
|
|
792
880
|
const lengthOb = orderBookItems.length;
|
|
793
881
|
if (lengthOb > 0) {
|
|
794
882
|
this.handleOrderBookForMultidata(client, orderBookItems, ts, eventId);
|
|
@@ -163,6 +163,7 @@ class whitebit extends whitebit$1 {
|
|
|
163
163
|
// "params":[
|
|
164
164
|
// true,
|
|
165
165
|
// {
|
|
166
|
+
// "timestamp": 1708679568.940867,
|
|
166
167
|
// "asks":[
|
|
167
168
|
// [ "21252.45","0.01957"],
|
|
168
169
|
// ["21252.55","0.126205"],
|
|
@@ -199,14 +200,14 @@ class whitebit extends whitebit$1 {
|
|
|
199
200
|
const market = this.safeMarket(marketId);
|
|
200
201
|
const symbol = market['symbol'];
|
|
201
202
|
const data = this.safeValue(params, 1);
|
|
202
|
-
|
|
203
|
-
if (symbol in this.orderbooks) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
const timestamp = this.safeTimestamp(data, 'timestamp');
|
|
204
|
+
if (!(symbol in this.orderbooks)) {
|
|
205
|
+
const ob = this.orderBook();
|
|
206
|
+
this.orderbooks[symbol] = ob;
|
|
207
|
+
}
|
|
208
|
+
const orderbook = this.orderbooks[symbol];
|
|
209
|
+
orderbook['timestamp'] = timestamp;
|
|
210
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
210
211
|
if (isSnapshot) {
|
|
211
212
|
const snapshot = this.parseOrderBook(data, symbol);
|
|
212
213
|
orderbook.reset(snapshot);
|
package/dist/cjs/src/timex.js
CHANGED
|
@@ -70,6 +70,7 @@ class timex extends timex$1 {
|
|
|
70
70
|
'fetchPremiumIndexOHLCV': false,
|
|
71
71
|
'fetchTicker': true,
|
|
72
72
|
'fetchTickers': true,
|
|
73
|
+
'fetchTime': true,
|
|
73
74
|
'fetchTrades': true,
|
|
74
75
|
'fetchTradingFee': true,
|
|
75
76
|
'fetchWithdrawal': false,
|
|
@@ -265,11 +266,26 @@ class timex extends timex$1 {
|
|
|
265
266
|
},
|
|
266
267
|
});
|
|
267
268
|
}
|
|
269
|
+
async fetchTime(params = {}) {
|
|
270
|
+
/**
|
|
271
|
+
* @method
|
|
272
|
+
* @name timex#fetchTime
|
|
273
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
274
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
275
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
276
|
+
*/
|
|
277
|
+
const response = await this.tradingviewGetTime(params);
|
|
278
|
+
//
|
|
279
|
+
// 1708682617
|
|
280
|
+
//
|
|
281
|
+
return this.parseToInt(response) * 1000;
|
|
282
|
+
}
|
|
268
283
|
async fetchMarkets(params = {}) {
|
|
269
284
|
/**
|
|
270
285
|
* @method
|
|
271
286
|
* @name timex#fetchMarkets
|
|
272
287
|
* @description retrieves data on all markets for timex
|
|
288
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listMarkets
|
|
273
289
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
274
290
|
* @returns {object[]} an array of objects representing market data
|
|
275
291
|
*/
|
|
@@ -302,6 +318,7 @@ class timex extends timex$1 {
|
|
|
302
318
|
* @method
|
|
303
319
|
* @name timex#fetchCurrencies
|
|
304
320
|
* @description fetches all available currencies on an exchange
|
|
321
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCurrencies
|
|
305
322
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
306
323
|
* @returns {object} an associative dictionary of currencies
|
|
307
324
|
*/
|
|
@@ -343,6 +360,7 @@ class timex extends timex$1 {
|
|
|
343
360
|
* @method
|
|
344
361
|
* @name timex#fetchDeposits
|
|
345
362
|
* @description fetch all deposits made to an account
|
|
363
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Manager/getDeposits
|
|
346
364
|
* @param {string} code unified currency code
|
|
347
365
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
348
366
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -378,6 +396,7 @@ class timex extends timex$1 {
|
|
|
378
396
|
* @method
|
|
379
397
|
* @name timex#fetchWithdrawals
|
|
380
398
|
* @description fetch all withdrawals made to an account
|
|
399
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Manager/getWithdraws
|
|
381
400
|
* @param {string} code unified currency code
|
|
382
401
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
383
402
|
* @param {int} [limit] the maximum number of transaction structures to retrieve
|
|
@@ -462,6 +481,7 @@ class timex extends timex$1 {
|
|
|
462
481
|
* @method
|
|
463
482
|
* @name timex#fetchTickers
|
|
464
483
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
484
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTickers
|
|
465
485
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
466
486
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
467
487
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -496,6 +516,7 @@ class timex extends timex$1 {
|
|
|
496
516
|
* @method
|
|
497
517
|
* @name timex#fetchTicker
|
|
498
518
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
519
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTickers
|
|
499
520
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
500
521
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
501
522
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -533,6 +554,7 @@ class timex extends timex$1 {
|
|
|
533
554
|
* @method
|
|
534
555
|
* @name timex#fetchOrderBook
|
|
535
556
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
557
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/orderbookV2
|
|
536
558
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
537
559
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
538
560
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -579,6 +601,7 @@ class timex extends timex$1 {
|
|
|
579
601
|
* @method
|
|
580
602
|
* @name timex#fetchTrades
|
|
581
603
|
* @description get the list of most recent trades for a particular symbol
|
|
604
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTrades
|
|
582
605
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
583
606
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
584
607
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -626,6 +649,7 @@ class timex extends timex$1 {
|
|
|
626
649
|
* @method
|
|
627
650
|
* @name timex#fetchOHLCV
|
|
628
651
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
652
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCandles
|
|
629
653
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
630
654
|
* @param {string} timeframe the length of time each candle represents
|
|
631
655
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -691,6 +715,7 @@ class timex extends timex$1 {
|
|
|
691
715
|
* @method
|
|
692
716
|
* @name timex#fetchBalance
|
|
693
717
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
718
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getBalances
|
|
694
719
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
695
720
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
696
721
|
*/
|
|
@@ -712,6 +737,7 @@ class timex extends timex$1 {
|
|
|
712
737
|
* @method
|
|
713
738
|
* @name timex#createOrder
|
|
714
739
|
* @description create a trade order
|
|
740
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/createOrder
|
|
715
741
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
716
742
|
* @param {string} type 'market' or 'limit'
|
|
717
743
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -840,6 +866,7 @@ class timex extends timex$1 {
|
|
|
840
866
|
* @method
|
|
841
867
|
* @name timex#cancelOrder
|
|
842
868
|
* @description cancels an open order
|
|
869
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/deleteOrders
|
|
843
870
|
* @param {string} id order id
|
|
844
871
|
* @param {string} symbol not used by timex cancelOrder ()
|
|
845
872
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -853,6 +880,7 @@ class timex extends timex$1 {
|
|
|
853
880
|
* @method
|
|
854
881
|
* @name timex#cancelOrders
|
|
855
882
|
* @description cancel multiple orders
|
|
883
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/deleteOrders
|
|
856
884
|
* @param {string[]} ids order ids
|
|
857
885
|
* @param {string} symbol unified market symbol, default is undefined
|
|
858
886
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -894,6 +922,7 @@ class timex extends timex$1 {
|
|
|
894
922
|
* @method
|
|
895
923
|
* @name timex#fetchOrder
|
|
896
924
|
* @description fetches information on an order made by the user
|
|
925
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getOrderDetails
|
|
897
926
|
* @param {string} symbol not used by timex fetchOrder
|
|
898
927
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
899
928
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -945,6 +974,7 @@ class timex extends timex$1 {
|
|
|
945
974
|
* @method
|
|
946
975
|
* @name timex#fetchOpenOrders
|
|
947
976
|
* @description fetch all unfilled currently open orders
|
|
977
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getOpenOrders
|
|
948
978
|
* @param {string} symbol unified market symbol
|
|
949
979
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
950
980
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -999,6 +1029,7 @@ class timex extends timex$1 {
|
|
|
999
1029
|
* @method
|
|
1000
1030
|
* @name timex#fetchClosedOrders
|
|
1001
1031
|
* @description fetches information on multiple closed orders made by the user
|
|
1032
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getOrders
|
|
1002
1033
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1003
1034
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1004
1035
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -1058,6 +1089,7 @@ class timex extends timex$1 {
|
|
|
1058
1089
|
* @method
|
|
1059
1090
|
* @name timex#fetchMyTrades
|
|
1060
1091
|
* @description fetch all trades made by the user
|
|
1092
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getTrades_1
|
|
1061
1093
|
* @param {string} symbol unified market symbol
|
|
1062
1094
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1063
1095
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -1136,6 +1168,7 @@ class timex extends timex$1 {
|
|
|
1136
1168
|
* @method
|
|
1137
1169
|
* @name timex#fetchTradingFee
|
|
1138
1170
|
* @description fetch the trading fees for a market
|
|
1171
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getFees
|
|
1139
1172
|
* @param {string} symbol unified market symbol
|
|
1140
1173
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1141
1174
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -1529,6 +1562,7 @@ class timex extends timex$1 {
|
|
|
1529
1562
|
* @method
|
|
1530
1563
|
* @name timex#fetchDepositAddress
|
|
1531
1564
|
* @description fetch the deposit address for a currency associated with this account, does not accept params["network"]
|
|
1565
|
+
* @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Currency/selectCurrencyBySymbol
|
|
1532
1566
|
* @param {string} code unified currency code
|
|
1533
1567
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1534
1568
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -1591,7 +1625,7 @@ class timex extends timex$1 {
|
|
|
1591
1625
|
if (Object.keys(params).length) {
|
|
1592
1626
|
url += '?' + this.urlencodeWithArrayRepeat(params);
|
|
1593
1627
|
}
|
|
1594
|
-
if (api !== 'public') {
|
|
1628
|
+
if (api !== 'public' && api !== 'tradingview') {
|
|
1595
1629
|
this.checkRequiredCredentials();
|
|
1596
1630
|
const auth = this.stringToBase64(this.apiKey + ':' + this.secret);
|
|
1597
1631
|
const secret = 'Basic ' + auth;
|
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.50";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
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.51';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -243,6 +243,9 @@ interface Exchange {
|
|
|
243
243
|
sapiGetSimpleEarnFlexibleHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
|
|
244
244
|
sapiGetSimpleEarnLockedHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
|
|
245
245
|
sapiGetSimpleEarnFlexibleHistoryCollateralRecord(params?: {}): Promise<implicitReturnType>;
|
|
246
|
+
sapiGetDciProductList(params?: {}): Promise<implicitReturnType>;
|
|
247
|
+
sapiGetDciProductPositions(params?: {}): Promise<implicitReturnType>;
|
|
248
|
+
sapiGetDciProductAccounts(params?: {}): Promise<implicitReturnType>;
|
|
246
249
|
sapiPostAssetDust(params?: {}): Promise<implicitReturnType>;
|
|
247
250
|
sapiPostAssetDustBtc(params?: {}): Promise<implicitReturnType>;
|
|
248
251
|
sapiPostAssetTransfer(params?: {}): Promise<implicitReturnType>;
|
|
@@ -357,6 +360,8 @@ interface Exchange {
|
|
|
357
360
|
sapiPostSimpleEarnLockedRedeem(params?: {}): Promise<implicitReturnType>;
|
|
358
361
|
sapiPostSimpleEarnFlexibleSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
|
|
359
362
|
sapiPostSimpleEarnLockedSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
|
|
363
|
+
sapiPostDciProductSubscribe(params?: {}): Promise<implicitReturnType>;
|
|
364
|
+
sapiPostDciProductAutoCompoundEdit(params?: {}): Promise<implicitReturnType>;
|
|
360
365
|
sapiPutUserDataStream(params?: {}): Promise<implicitReturnType>;
|
|
361
366
|
sapiPutUserDataStreamIsolated(params?: {}): Promise<implicitReturnType>;
|
|
362
367
|
sapiDeleteMarginOpenOrders(params?: {}): Promise<implicitReturnType>;
|