ccxt 4.2.51 → 4.2.52
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 +76 -16
- package/README.md +5 -6
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +688 -1360
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -4
- package/dist/cjs/src/base/Exchange.js +65 -26
- package/dist/cjs/src/binance.js +45 -2
- package/dist/cjs/src/pro/binance.js +156 -1
- package/dist/cjs/src/pro/bitfinex2.js +3 -1
- package/dist/cjs/src/pro/gate.js +2 -1
- package/dist/cjs/src/woo.js +3 -1
- package/js/ccxt.d.ts +2 -5
- package/js/ccxt.js +2 -4
- package/js/src/base/Exchange.d.ts +65 -26
- package/js/src/base/Exchange.js +65 -26
- package/js/src/binance.d.ts +4 -0
- package/js/src/binance.js +45 -2
- package/js/src/deribit.js +1 -1
- package/js/src/ndax.js +1 -1
- package/js/src/pro/binance.d.ts +3 -0
- package/js/src/pro/binance.js +156 -1
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitfinex2.js +3 -1
- package/js/src/pro/gate.js +2 -1
- package/js/src/woo.js +4 -2
- package/package.json +1 -1
- package/skip-tests.json +4 -5
- package/dist/cjs/src/abstract/bitforex.js +0 -9
- package/dist/cjs/src/bitforex.js +0 -884
- package/js/src/abstract/bitforex.d.ts +0 -27
- package/js/src/abstract/bitforex.js +0 -11
- package/js/src/bitforex.d.ts +0 -39
- package/js/src/bitforex.js +0 -885
package/dist/cjs/ccxt.js
CHANGED
|
@@ -30,7 +30,6 @@ var bitcoincom = require('./src/bitcoincom.js');
|
|
|
30
30
|
var bitfinex = require('./src/bitfinex.js');
|
|
31
31
|
var bitfinex2 = require('./src/bitfinex2.js');
|
|
32
32
|
var bitflyer = require('./src/bitflyer.js');
|
|
33
|
-
var bitforex = require('./src/bitforex.js');
|
|
34
33
|
var bitget = require('./src/bitget.js');
|
|
35
34
|
var bithumb = require('./src/bithumb.js');
|
|
36
35
|
var bitmart = require('./src/bitmart.js');
|
|
@@ -177,7 +176,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
177
176
|
|
|
178
177
|
//-----------------------------------------------------------------------------
|
|
179
178
|
// this is updated by vss.js when building
|
|
180
|
-
const version = '4.2.
|
|
179
|
+
const version = '4.2.52';
|
|
181
180
|
Exchange["default"].ccxtVersion = version;
|
|
182
181
|
const exchanges = {
|
|
183
182
|
'ace': ace,
|
|
@@ -198,7 +197,6 @@ const exchanges = {
|
|
|
198
197
|
'bitfinex': bitfinex,
|
|
199
198
|
'bitfinex2': bitfinex2,
|
|
200
199
|
'bitflyer': bitflyer,
|
|
201
|
-
'bitforex': bitforex,
|
|
202
200
|
'bitget': bitget,
|
|
203
201
|
'bithumb': bithumb,
|
|
204
202
|
'bitmart': bitmart,
|
|
@@ -404,7 +402,6 @@ exports.bitcoincom = bitcoincom;
|
|
|
404
402
|
exports.bitfinex = bitfinex;
|
|
405
403
|
exports.bitfinex2 = bitfinex2;
|
|
406
404
|
exports.bitflyer = bitflyer;
|
|
407
|
-
exports.bitforex = bitforex;
|
|
408
405
|
exports.bitget = bitget;
|
|
409
406
|
exports.bithumb = bithumb;
|
|
410
407
|
exports.bitmart = bitmart;
|
|
@@ -355,51 +355,59 @@ class Exchange {
|
|
|
355
355
|
'future': undefined,
|
|
356
356
|
'option': undefined,
|
|
357
357
|
'addMargin': undefined,
|
|
358
|
+
'borrowCrossMargin': undefined,
|
|
359
|
+
'borrowIsolatedMargin': undefined,
|
|
360
|
+
'borrowMargin': undefined,
|
|
358
361
|
'cancelAllOrders': undefined,
|
|
362
|
+
'cancelAllOrdersWs': undefined,
|
|
359
363
|
'cancelOrder': true,
|
|
360
364
|
'cancelOrders': undefined,
|
|
365
|
+
'cancelOrdersWs': undefined,
|
|
366
|
+
'cancelOrderWs': undefined,
|
|
361
367
|
'closeAllPositions': undefined,
|
|
362
368
|
'closePosition': undefined,
|
|
363
369
|
'createDepositAddress': undefined,
|
|
370
|
+
'createLimitBuyOrder': undefined,
|
|
364
371
|
'createLimitOrder': true,
|
|
365
|
-
'
|
|
366
|
-
'
|
|
372
|
+
'createLimitSellOrder': undefined,
|
|
373
|
+
'createMarketBuyOrder': undefined,
|
|
367
374
|
'createMarketBuyOrderWithCost': undefined,
|
|
375
|
+
'createMarketOrder': true,
|
|
368
376
|
'createMarketOrderWithCost': undefined,
|
|
377
|
+
'createMarketSellOrder': undefined,
|
|
369
378
|
'createMarketSellOrderWithCost': undefined,
|
|
379
|
+
'createOrder': true,
|
|
370
380
|
'createOrders': undefined,
|
|
371
381
|
'createOrderWithTakeProfitAndStopLoss': undefined,
|
|
382
|
+
'createOrderWs': undefined,
|
|
372
383
|
'createPostOnlyOrder': undefined,
|
|
373
384
|
'createReduceOnlyOrder': undefined,
|
|
374
|
-
'createStopLossOrder': undefined,
|
|
375
|
-
'createStopOrder': undefined,
|
|
376
385
|
'createStopLimitOrder': undefined,
|
|
386
|
+
'createStopLossOrder': undefined,
|
|
377
387
|
'createStopMarketOrder': undefined,
|
|
388
|
+
'createStopOrder': undefined,
|
|
378
389
|
'createTakeProfitOrder': undefined,
|
|
379
390
|
'createTrailingAmountOrder': undefined,
|
|
380
391
|
'createTrailingPercentOrder': undefined,
|
|
381
392
|
'createTriggerOrder': undefined,
|
|
382
|
-
'
|
|
383
|
-
'editOrderWs': undefined,
|
|
384
|
-
'fetchOpenOrdersWs': undefined,
|
|
385
|
-
'fetchClosedOrdersWs': undefined,
|
|
386
|
-
'fetchOrderWs': undefined,
|
|
387
|
-
'fetchOrdersWs': undefined,
|
|
388
|
-
'cancelOrderWs': undefined,
|
|
389
|
-
'cancelOrdersWs': undefined,
|
|
390
|
-
'cancelAllOrdersWs': undefined,
|
|
391
|
-
'fetchTradesWs': undefined,
|
|
392
|
-
'fetchBalanceWs': undefined,
|
|
393
|
+
'deposit': undefined,
|
|
393
394
|
'editOrder': 'emulated',
|
|
395
|
+
'editOrderWs': undefined,
|
|
394
396
|
'fetchAccounts': undefined,
|
|
395
397
|
'fetchBalance': true,
|
|
398
|
+
'fetchBalanceWs': undefined,
|
|
396
399
|
'fetchBidsAsks': undefined,
|
|
397
400
|
'fetchBorrowInterest': undefined,
|
|
401
|
+
'fetchBorrowRate': undefined,
|
|
402
|
+
'fetchBorrowRateHistories': undefined,
|
|
398
403
|
'fetchBorrowRateHistory': undefined,
|
|
399
|
-
'
|
|
404
|
+
'fetchBorrowRates': undefined,
|
|
405
|
+
'fetchBorrowRatesPerSymbol': undefined,
|
|
400
406
|
'fetchCanceledAndClosedOrders': undefined,
|
|
407
|
+
'fetchCanceledOrders': undefined,
|
|
401
408
|
'fetchClosedOrder': undefined,
|
|
402
409
|
'fetchClosedOrders': undefined,
|
|
410
|
+
'fetchClosedOrdersWs': undefined,
|
|
403
411
|
'fetchCrossBorrowRate': undefined,
|
|
404
412
|
'fetchCrossBorrowRates': undefined,
|
|
405
413
|
'fetchCurrencies': 'emulated',
|
|
@@ -409,78 +417,109 @@ class Exchange {
|
|
|
409
417
|
'fetchDepositAddresses': undefined,
|
|
410
418
|
'fetchDepositAddressesByNetwork': undefined,
|
|
411
419
|
'fetchDeposits': undefined,
|
|
412
|
-
'fetchDepositsWs': undefined,
|
|
413
420
|
'fetchDepositsWithdrawals': undefined,
|
|
414
|
-
'
|
|
415
|
-
'
|
|
421
|
+
'fetchDepositsWs': undefined,
|
|
422
|
+
'fetchDepositWithdrawFee': undefined,
|
|
423
|
+
'fetchDepositWithdrawFees': undefined,
|
|
416
424
|
'fetchFundingHistory': undefined,
|
|
417
425
|
'fetchFundingRate': undefined,
|
|
418
426
|
'fetchFundingRateHistory': undefined,
|
|
419
427
|
'fetchFundingRates': undefined,
|
|
428
|
+
'fetchGreeks': undefined,
|
|
420
429
|
'fetchIndexOHLCV': undefined,
|
|
421
430
|
'fetchIsolatedBorrowRate': undefined,
|
|
422
431
|
'fetchIsolatedBorrowRates': undefined,
|
|
432
|
+
'fetchIsolatedPositions': undefined,
|
|
423
433
|
'fetchL2OrderBook': true,
|
|
434
|
+
'fetchL3OrderBook': undefined,
|
|
424
435
|
'fetchLastPrices': undefined,
|
|
425
436
|
'fetchLedger': undefined,
|
|
426
437
|
'fetchLedgerEntry': undefined,
|
|
438
|
+
'fetchLeverage': undefined,
|
|
427
439
|
'fetchLeverageTiers': undefined,
|
|
440
|
+
'fetchLiquidations': undefined,
|
|
441
|
+
'fetchMarginMode': undefined,
|
|
428
442
|
'fetchMarketLeverageTiers': undefined,
|
|
429
443
|
'fetchMarkets': true,
|
|
430
444
|
'fetchMarketsWs': undefined,
|
|
431
445
|
'fetchMarkOHLCV': undefined,
|
|
446
|
+
'fetchMyLiquidations': undefined,
|
|
447
|
+
'fetchMySettlementHistory': undefined,
|
|
432
448
|
'fetchMyTrades': undefined,
|
|
449
|
+
'fetchMyTradesWs': undefined,
|
|
433
450
|
'fetchOHLCV': undefined,
|
|
434
451
|
'fetchOHLCVWs': undefined,
|
|
435
452
|
'fetchOpenInterest': undefined,
|
|
436
453
|
'fetchOpenInterestHistory': undefined,
|
|
437
454
|
'fetchOpenOrder': undefined,
|
|
438
455
|
'fetchOpenOrders': undefined,
|
|
456
|
+
'fetchOpenOrdersWs': undefined,
|
|
439
457
|
'fetchOrder': undefined,
|
|
440
458
|
'fetchOrderBook': true,
|
|
441
459
|
'fetchOrderBooks': undefined,
|
|
460
|
+
'fetchOrderBookWs': undefined,
|
|
442
461
|
'fetchOrders': undefined,
|
|
462
|
+
'fetchOrdersByStatus': undefined,
|
|
463
|
+
'fetchOrdersWs': undefined,
|
|
443
464
|
'fetchOrderTrades': undefined,
|
|
465
|
+
'fetchOrderWs': undefined,
|
|
444
466
|
'fetchPermissions': undefined,
|
|
445
467
|
'fetchPosition': undefined,
|
|
468
|
+
'fetchPositionMode': undefined,
|
|
446
469
|
'fetchPositions': undefined,
|
|
447
470
|
'fetchPositionsForSymbol': undefined,
|
|
448
471
|
'fetchPositionsRisk': undefined,
|
|
449
472
|
'fetchPremiumIndexOHLCV': undefined,
|
|
473
|
+
'fetchSettlementHistory': undefined,
|
|
450
474
|
'fetchStatus': undefined,
|
|
451
475
|
'fetchTicker': true,
|
|
452
476
|
'fetchTickers': undefined,
|
|
477
|
+
'fetchTickerWs': undefined,
|
|
453
478
|
'fetchTime': undefined,
|
|
454
479
|
'fetchTrades': true,
|
|
480
|
+
'fetchTradesWs': undefined,
|
|
455
481
|
'fetchTradingFee': undefined,
|
|
456
482
|
'fetchTradingFees': undefined,
|
|
457
483
|
'fetchTradingFeesWs': undefined,
|
|
458
484
|
'fetchTradingLimits': undefined,
|
|
485
|
+
'fetchTransactionFee': undefined,
|
|
486
|
+
'fetchTransactionFees': undefined,
|
|
459
487
|
'fetchTransactions': undefined,
|
|
488
|
+
'fetchTransfer': undefined,
|
|
460
489
|
'fetchTransfers': undefined,
|
|
490
|
+
'fetchUnderlyingAssets': undefined,
|
|
491
|
+
'fetchVolatilityHistory': undefined,
|
|
461
492
|
'fetchWithdrawAddresses': undefined,
|
|
462
493
|
'fetchWithdrawal': undefined,
|
|
463
494
|
'fetchWithdrawals': undefined,
|
|
464
495
|
'fetchWithdrawalsWs': undefined,
|
|
496
|
+
'fetchWithdrawalWhitelist': undefined,
|
|
465
497
|
'reduceMargin': undefined,
|
|
498
|
+
'repayCrossMargin': undefined,
|
|
499
|
+
'repayIsolatedMargin': undefined,
|
|
466
500
|
'setLeverage': undefined,
|
|
467
501
|
'setMargin': undefined,
|
|
468
502
|
'setMarginMode': undefined,
|
|
469
503
|
'setPositionMode': undefined,
|
|
470
504
|
'signIn': undefined,
|
|
471
505
|
'transfer': undefined,
|
|
472
|
-
'
|
|
506
|
+
'watchBalance': undefined,
|
|
507
|
+
'watchMyTrades': undefined,
|
|
508
|
+
'watchOHLCV': undefined,
|
|
509
|
+
'watchOHLCVForSymbols': undefined,
|
|
473
510
|
'watchOrderBook': undefined,
|
|
511
|
+
'watchOrderBookForSymbols': undefined,
|
|
474
512
|
'watchOrders': undefined,
|
|
475
|
-
'
|
|
476
|
-
'
|
|
513
|
+
'watchOrdersForSymbols': undefined,
|
|
514
|
+
'watchPosition': undefined,
|
|
515
|
+
'watchPositions': undefined,
|
|
516
|
+
'watchStatus': undefined,
|
|
477
517
|
'watchTicker': undefined,
|
|
518
|
+
'watchTickers': undefined,
|
|
478
519
|
'watchTrades': undefined,
|
|
479
520
|
'watchTradesForSymbols': undefined,
|
|
480
|
-
'
|
|
481
|
-
'
|
|
482
|
-
'watchBalance': undefined,
|
|
483
|
-
'watchOHLCV': undefined,
|
|
521
|
+
'withdraw': undefined,
|
|
522
|
+
'ws': undefined,
|
|
484
523
|
},
|
|
485
524
|
'urls': {
|
|
486
525
|
'logo': undefined,
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -44,6 +44,10 @@ class binance extends binance$1 {
|
|
|
44
44
|
'createMarketBuyOrderWithCost': true,
|
|
45
45
|
'createMarketOrderWithCost': true,
|
|
46
46
|
'createMarketSellOrderWithCost': true,
|
|
47
|
+
'createLimitBuyOrder': true,
|
|
48
|
+
'createLimitSellOrder': true,
|
|
49
|
+
'createMarketBuyOrder': true,
|
|
50
|
+
'createMarketSellOrder': true,
|
|
47
51
|
'createOrder': true,
|
|
48
52
|
'createOrders': true,
|
|
49
53
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -108,6 +112,7 @@ class binance extends binance$1 {
|
|
|
108
112
|
'fetchOrders': true,
|
|
109
113
|
'fetchOrderTrades': true,
|
|
110
114
|
'fetchPosition': true,
|
|
115
|
+
'fetchPositionMode': true,
|
|
111
116
|
'fetchPositions': true,
|
|
112
117
|
'fetchPositionsRisk': true,
|
|
113
118
|
'fetchPremiumIndexOHLCV': false,
|
|
@@ -123,6 +128,7 @@ class binance extends binance$1 {
|
|
|
123
128
|
'fetchTransactionFee': 'emulated',
|
|
124
129
|
'fetchTransactionFees': true,
|
|
125
130
|
'fetchTransactions': false,
|
|
131
|
+
'fetchTransfer': false,
|
|
126
132
|
'fetchTransfers': true,
|
|
127
133
|
'fetchUnderlyingAssets': false,
|
|
128
134
|
'fetchVolatilityHistory': false,
|
|
@@ -4113,7 +4119,8 @@ class binance extends binance$1 {
|
|
|
4113
4119
|
// "closeTime": 1677097200000
|
|
4114
4120
|
// }
|
|
4115
4121
|
//
|
|
4116
|
-
const
|
|
4122
|
+
const inverse = this.safeBool(market, 'inverse');
|
|
4123
|
+
const volumeIndex = inverse ? 7 : 5;
|
|
4117
4124
|
return [
|
|
4118
4125
|
this.safeInteger2(ohlcv, 0, 'closeTime'),
|
|
4119
4126
|
this.safeNumber2(ohlcv, 1, 'open'),
|
|
@@ -8099,7 +8106,6 @@ class binance extends binance$1 {
|
|
|
8099
8106
|
/**
|
|
8100
8107
|
* @method
|
|
8101
8108
|
* @name binance#fetchTransfers
|
|
8102
|
-
* @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
|
|
8103
8109
|
* @description fetch a history of internal transfers made on an account
|
|
8104
8110
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
|
|
8105
8111
|
* @param {string} code unified currency code of the currency transferred
|
|
@@ -11988,6 +11994,43 @@ class binance extends binance$1 {
|
|
|
11988
11994
|
'info': greeks,
|
|
11989
11995
|
};
|
|
11990
11996
|
}
|
|
11997
|
+
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
11998
|
+
/**
|
|
11999
|
+
* @method
|
|
12000
|
+
* @name binance#fetchPositionMode
|
|
12001
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
12002
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
12003
|
+
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
12004
|
+
* @param {string} params.subType "linear" or "inverse"
|
|
12005
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
12006
|
+
*/
|
|
12007
|
+
let market = undefined;
|
|
12008
|
+
if (symbol !== undefined) {
|
|
12009
|
+
market = this.market(symbol);
|
|
12010
|
+
}
|
|
12011
|
+
let subType = undefined;
|
|
12012
|
+
[subType, params] = this.handleSubTypeAndParams('fetchPositionMode', market, params);
|
|
12013
|
+
let response = undefined;
|
|
12014
|
+
if (subType === 'linear') {
|
|
12015
|
+
response = await this.fapiPrivateGetPositionSideDual(params);
|
|
12016
|
+
}
|
|
12017
|
+
else if (subType === 'inverse') {
|
|
12018
|
+
response = await this.dapiPrivateGetPositionSideDual(params);
|
|
12019
|
+
}
|
|
12020
|
+
else {
|
|
12021
|
+
throw new errors.BadRequest(this.id + ' fetchPositionMode requires either a symbol argument or params["subType"]');
|
|
12022
|
+
}
|
|
12023
|
+
//
|
|
12024
|
+
// {
|
|
12025
|
+
// dualSidePosition: false
|
|
12026
|
+
// }
|
|
12027
|
+
//
|
|
12028
|
+
const dualSidePosition = this.safeBool(response, 'dualSidePosition');
|
|
12029
|
+
return {
|
|
12030
|
+
'info': response,
|
|
12031
|
+
'hedged': dualSidePosition,
|
|
12032
|
+
};
|
|
12033
|
+
}
|
|
11991
12034
|
}
|
|
11992
12035
|
|
|
11993
12036
|
module.exports = binance;
|
|
@@ -38,9 +38,11 @@ class binance extends binance$1 {
|
|
|
38
38
|
'fetchDepositsWs': false,
|
|
39
39
|
'fetchMarketsWs': false,
|
|
40
40
|
'fetchMyTradesWs': true,
|
|
41
|
+
'fetchOHLCVWs': true,
|
|
41
42
|
'fetchOpenOrdersWs': true,
|
|
42
43
|
'fetchOrderWs': true,
|
|
43
44
|
'fetchOrdersWs': true,
|
|
45
|
+
'fetchTradesWs': true,
|
|
44
46
|
'fetchTradingFeesWs': false,
|
|
45
47
|
'fetchWithdrawalsWs': false,
|
|
46
48
|
},
|
|
@@ -837,6 +839,94 @@ class binance extends binance$1 {
|
|
|
837
839
|
stored.append(parsed);
|
|
838
840
|
client.resolve(stored, messageHash);
|
|
839
841
|
}
|
|
842
|
+
async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
843
|
+
/**
|
|
844
|
+
* @method
|
|
845
|
+
* @name binance#fetchOHLCVWs
|
|
846
|
+
* @see https://binance-docs.github.io/apidocs/websocket_api/en/#klines
|
|
847
|
+
* @description query historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
848
|
+
* @param {string} symbol unified symbol of the market to query OHLCV data for
|
|
849
|
+
* @param {string} timeframe the length of time each candle represents
|
|
850
|
+
* @param {int} since timestamp in ms of the earliest candle to fetch
|
|
851
|
+
* @param {int} limit the maximum amount of candles to fetch
|
|
852
|
+
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
853
|
+
* @param {int} params.until timestamp in ms of the earliest candle to fetch
|
|
854
|
+
*
|
|
855
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
856
|
+
* @param {string} params.timeZone default=0 (UTC)
|
|
857
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
858
|
+
*/
|
|
859
|
+
await this.loadMarkets();
|
|
860
|
+
this.checkIsSpot('fetchOHLCVWs', symbol, params);
|
|
861
|
+
const url = this.urls['api']['ws']['ws'];
|
|
862
|
+
const requestId = this.requestId(url);
|
|
863
|
+
const messageHash = requestId.toString();
|
|
864
|
+
let returnRateLimits = false;
|
|
865
|
+
[returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchOHLCVWs', 'returnRateLimits', false);
|
|
866
|
+
const payload = {
|
|
867
|
+
'symbol': this.marketId(symbol),
|
|
868
|
+
'returnRateLimits': returnRateLimits,
|
|
869
|
+
'interval': this.timeframes[timeframe],
|
|
870
|
+
};
|
|
871
|
+
const until = this.safeInteger(params, 'until');
|
|
872
|
+
params = this.omit(params, 'until');
|
|
873
|
+
if (since !== undefined) {
|
|
874
|
+
payload['startTime'] = since;
|
|
875
|
+
}
|
|
876
|
+
if (limit !== undefined) {
|
|
877
|
+
payload['limit'] = limit;
|
|
878
|
+
}
|
|
879
|
+
if (until !== undefined) {
|
|
880
|
+
payload['endTime'] = until;
|
|
881
|
+
}
|
|
882
|
+
const message = {
|
|
883
|
+
'id': messageHash,
|
|
884
|
+
'method': 'klines',
|
|
885
|
+
'params': this.extend(payload, params),
|
|
886
|
+
};
|
|
887
|
+
const subscription = {
|
|
888
|
+
'method': this.handleFetchOHLCV,
|
|
889
|
+
};
|
|
890
|
+
return await this.watch(url, messageHash, message, messageHash, subscription);
|
|
891
|
+
}
|
|
892
|
+
handleFetchOHLCV(client, message) {
|
|
893
|
+
//
|
|
894
|
+
// {
|
|
895
|
+
// "id": "1dbbeb56-8eea-466a-8f6e-86bdcfa2fc0b",
|
|
896
|
+
// "status": 200,
|
|
897
|
+
// "result": [
|
|
898
|
+
// [
|
|
899
|
+
// 1655971200000, // Kline open time
|
|
900
|
+
// "0.01086000", // Open price
|
|
901
|
+
// "0.01086600", // High price
|
|
902
|
+
// "0.01083600", // Low price
|
|
903
|
+
// "0.01083800", // Close price
|
|
904
|
+
// "2290.53800000", // Volume
|
|
905
|
+
// 1655974799999, // Kline close time
|
|
906
|
+
// "24.85074442", // Quote asset volume
|
|
907
|
+
// 2283, // Number of trades
|
|
908
|
+
// "1171.64000000", // Taker buy base asset volume
|
|
909
|
+
// "12.71225884", // Taker buy quote asset volume
|
|
910
|
+
// "0" // Unused field, ignore
|
|
911
|
+
// ]
|
|
912
|
+
// ],
|
|
913
|
+
// "rateLimits": [
|
|
914
|
+
// {
|
|
915
|
+
// "rateLimitType": "REQUEST_WEIGHT",
|
|
916
|
+
// "interval": "MINUTE",
|
|
917
|
+
// "intervalNum": 1,
|
|
918
|
+
// "limit": 6000,
|
|
919
|
+
// "count": 2
|
|
920
|
+
// }
|
|
921
|
+
// ]
|
|
922
|
+
// }
|
|
923
|
+
//
|
|
924
|
+
const result = this.safeList(message, 'result');
|
|
925
|
+
const parsed = this.parseOHLCVs(result);
|
|
926
|
+
// use a reverse lookup in a static map instead
|
|
927
|
+
const messageHash = this.safeString(message, 'id');
|
|
928
|
+
client.resolve(parsed, messageHash);
|
|
929
|
+
}
|
|
840
930
|
async watchTicker(symbol, params = {}) {
|
|
841
931
|
/**
|
|
842
932
|
* @method
|
|
@@ -2538,12 +2628,58 @@ class binance extends binance$1 {
|
|
|
2538
2628
|
const trades = await this.watch(url, messageHash, message, messageHash, subscription);
|
|
2539
2629
|
return this.filterBySymbolSinceLimit(trades, symbol, since, limit);
|
|
2540
2630
|
}
|
|
2631
|
+
async fetchTradesWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2632
|
+
/**
|
|
2633
|
+
* @method
|
|
2634
|
+
* @name binance#fetchTradesWs
|
|
2635
|
+
* @see https://binance-docs.github.io/apidocs/websocket_api/en/#recent-trades
|
|
2636
|
+
* @description fetch all trades made by the user
|
|
2637
|
+
* @param {string} symbol unified market symbol
|
|
2638
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2639
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve, default=500, max=1000
|
|
2640
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2641
|
+
*
|
|
2642
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
2643
|
+
* @param {int} [params.fromId] trade ID to begin at
|
|
2644
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2645
|
+
*/
|
|
2646
|
+
await this.loadMarkets();
|
|
2647
|
+
if (symbol === undefined) {
|
|
2648
|
+
throw new errors.BadRequest(this.id + ' fetchTradesWs () requires a symbol argument');
|
|
2649
|
+
}
|
|
2650
|
+
this.checkIsSpot('fetchTradesWs', symbol, params);
|
|
2651
|
+
const url = this.urls['api']['ws']['ws'];
|
|
2652
|
+
const requestId = this.requestId(url);
|
|
2653
|
+
const messageHash = requestId.toString();
|
|
2654
|
+
let returnRateLimits = false;
|
|
2655
|
+
[returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchTradesWs', 'returnRateLimits', false);
|
|
2656
|
+
const payload = {
|
|
2657
|
+
'symbol': this.marketId(symbol),
|
|
2658
|
+
'returnRateLimits': returnRateLimits,
|
|
2659
|
+
};
|
|
2660
|
+
if (limit !== undefined) {
|
|
2661
|
+
payload['limit'] = limit;
|
|
2662
|
+
}
|
|
2663
|
+
const message = {
|
|
2664
|
+
'id': messageHash,
|
|
2665
|
+
'method': 'trades.historical',
|
|
2666
|
+
'params': this.extend(payload, params),
|
|
2667
|
+
};
|
|
2668
|
+
const subscription = {
|
|
2669
|
+
'method': this.handleTradesWs,
|
|
2670
|
+
};
|
|
2671
|
+
const trades = await this.watch(url, messageHash, message, messageHash, subscription);
|
|
2672
|
+
return this.filterBySinceLimit(trades, since, limit);
|
|
2673
|
+
}
|
|
2541
2674
|
handleTradesWs(client, message) {
|
|
2675
|
+
//
|
|
2676
|
+
// fetchMyTradesWs
|
|
2542
2677
|
//
|
|
2543
2678
|
// {
|
|
2544
2679
|
// "id": "f4ce6a53-a29d-4f70-823b-4ab59391d6e8",
|
|
2545
2680
|
// "status": 200,
|
|
2546
|
-
// "result": [
|
|
2681
|
+
// "result": [
|
|
2682
|
+
// {
|
|
2547
2683
|
// "symbol": "BTCUSDT",
|
|
2548
2684
|
// "id": 1650422481,
|
|
2549
2685
|
// "orderId": 12569099453,
|
|
@@ -2562,6 +2698,25 @@ class binance extends binance$1 {
|
|
|
2562
2698
|
// ],
|
|
2563
2699
|
// }
|
|
2564
2700
|
//
|
|
2701
|
+
// fetchTradesWs
|
|
2702
|
+
//
|
|
2703
|
+
// {
|
|
2704
|
+
// "id": "f4ce6a53-a29d-4f70-823b-4ab59391d6e8",
|
|
2705
|
+
// "status": 200,
|
|
2706
|
+
// "result": [
|
|
2707
|
+
// {
|
|
2708
|
+
// "id": 0,
|
|
2709
|
+
// "price": "0.00005000",
|
|
2710
|
+
// "qty": "40.00000000",
|
|
2711
|
+
// "quoteQty": "0.00200000",
|
|
2712
|
+
// "time": 1500004800376,
|
|
2713
|
+
// "isBuyerMaker": true,
|
|
2714
|
+
// "isBestMatch": true
|
|
2715
|
+
// }
|
|
2716
|
+
// ...
|
|
2717
|
+
// ],
|
|
2718
|
+
// }
|
|
2719
|
+
//
|
|
2565
2720
|
const messageHash = this.safeString(message, 'id');
|
|
2566
2721
|
const result = this.safeValue(message, 'result', []);
|
|
2567
2722
|
const trades = this.parseTrades(result);
|
|
@@ -320,7 +320,9 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
320
320
|
const messageLength = message.length;
|
|
321
321
|
if (messageLength === 2) {
|
|
322
322
|
// initial snapshot
|
|
323
|
-
|
|
323
|
+
let trades = this.safeList(message, 1, []);
|
|
324
|
+
// needs to be reversed to make chronological order
|
|
325
|
+
trades = trades.reverse();
|
|
324
326
|
for (let i = 0; i < trades.length; i++) {
|
|
325
327
|
const parsed = this.parseWsTrade(trades[i], market);
|
|
326
328
|
stored.append(parsed);
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -383,8 +383,9 @@ class gate extends gate$1 {
|
|
|
383
383
|
const parts = channel.split('.');
|
|
384
384
|
const rawMarketType = this.safeString(parts, 0);
|
|
385
385
|
const marketType = (rawMarketType === 'futures') ? 'contract' : 'spot';
|
|
386
|
+
const result = this.safeValue(message, 'result');
|
|
386
387
|
let results = [];
|
|
387
|
-
if (
|
|
388
|
+
if (Array.isArray(result)) {
|
|
388
389
|
results = this.safeList(message, 'result', []);
|
|
389
390
|
}
|
|
390
391
|
else {
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -295,7 +295,6 @@ class woo extends woo$1 {
|
|
|
295
295
|
'-1007': errors.BadRequest,
|
|
296
296
|
'-1008': errors.InvalidOrder,
|
|
297
297
|
'-1009': errors.BadRequest,
|
|
298
|
-
'-1011': errors.ExchangeError,
|
|
299
298
|
'-1012': errors.BadRequest,
|
|
300
299
|
'-1101': errors.InvalidOrder,
|
|
301
300
|
'-1102': errors.InvalidOrder,
|
|
@@ -304,6 +303,8 @@ class woo extends woo$1 {
|
|
|
304
303
|
'-1105': errors.InvalidOrder, // { "code": -1105, "message": "Price is X% too high or X% too low from the mid price." }
|
|
305
304
|
},
|
|
306
305
|
'broad': {
|
|
306
|
+
'Can not place': errors.ExchangeError,
|
|
307
|
+
'maintenance': errors.OnMaintenance,
|
|
307
308
|
'symbol must not be blank': errors.BadRequest,
|
|
308
309
|
'The token is not supported': errors.BadRequest,
|
|
309
310
|
'Your order and symbol are not valid or already canceled': errors.BadRequest,
|
|
@@ -2380,6 +2381,7 @@ class woo extends woo$1 {
|
|
|
2380
2381
|
}
|
|
2381
2382
|
//
|
|
2382
2383
|
// 400 Bad Request {"success":false,"code":-1012,"message":"Amount is required for buy market orders when margin disabled."}
|
|
2384
|
+
// {"code":"-1011","message":"The system is under maintenance.","success":false}
|
|
2383
2385
|
//
|
|
2384
2386
|
const success = this.safeValue(response, 'success');
|
|
2385
2387
|
const errorCode = this.safeString(response, 'code');
|
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.51";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -23,7 +23,6 @@ import bitcoincom from './src/bitcoincom.js';
|
|
|
23
23
|
import bitfinex from './src/bitfinex.js';
|
|
24
24
|
import bitfinex2 from './src/bitfinex2.js';
|
|
25
25
|
import bitflyer from './src/bitflyer.js';
|
|
26
|
-
import bitforex from './src/bitforex.js';
|
|
27
26
|
import bitget from './src/bitget.js';
|
|
28
27
|
import bithumb from './src/bithumb.js';
|
|
29
28
|
import bitmart from './src/bitmart.js';
|
|
@@ -186,7 +185,6 @@ declare const exchanges: {
|
|
|
186
185
|
bitfinex: typeof bitfinex;
|
|
187
186
|
bitfinex2: typeof bitfinex2;
|
|
188
187
|
bitflyer: typeof bitflyer;
|
|
189
|
-
bitforex: typeof bitforex;
|
|
190
188
|
bitget: typeof bitget;
|
|
191
189
|
bithumb: typeof bithumb;
|
|
192
190
|
bitmart: typeof bitmart;
|
|
@@ -420,7 +418,6 @@ declare const ccxt: {
|
|
|
420
418
|
bitfinex: typeof bitfinex;
|
|
421
419
|
bitfinex2: typeof bitfinex2;
|
|
422
420
|
bitflyer: typeof bitflyer;
|
|
423
|
-
bitforex: typeof bitforex;
|
|
424
421
|
bitget: typeof bitget;
|
|
425
422
|
bithumb: typeof bithumb;
|
|
426
423
|
bitmart: typeof bitmart;
|
|
@@ -504,5 +501,5 @@ declare const ccxt: {
|
|
|
504
501
|
zaif: typeof zaif;
|
|
505
502
|
zonda: typeof zonda;
|
|
506
503
|
} & typeof functions & typeof errors;
|
|
507
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer,
|
|
504
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
508
505
|
export default ccxt;
|
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.52';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -59,7 +59,6 @@ import bitcoincom from './src/bitcoincom.js';
|
|
|
59
59
|
import bitfinex from './src/bitfinex.js';
|
|
60
60
|
import bitfinex2 from './src/bitfinex2.js';
|
|
61
61
|
import bitflyer from './src/bitflyer.js';
|
|
62
|
-
import bitforex from './src/bitforex.js';
|
|
63
62
|
import bitget from './src/bitget.js';
|
|
64
63
|
import bithumb from './src/bithumb.js';
|
|
65
64
|
import bitmart from './src/bitmart.js';
|
|
@@ -223,7 +222,6 @@ const exchanges = {
|
|
|
223
222
|
'bitfinex': bitfinex,
|
|
224
223
|
'bitfinex2': bitfinex2,
|
|
225
224
|
'bitflyer': bitflyer,
|
|
226
|
-
'bitforex': bitforex,
|
|
227
225
|
'bitget': bitget,
|
|
228
226
|
'bithumb': bithumb,
|
|
229
227
|
'bitmart': bitmart,
|
|
@@ -382,6 +380,6 @@ pro.exchanges = Object.keys(pro);
|
|
|
382
380
|
pro['Exchange'] = Exchange; // now the same for rest and ts
|
|
383
381
|
//-----------------------------------------------------------------------------
|
|
384
382
|
const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
|
|
385
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer,
|
|
383
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
386
384
|
export default ccxt;
|
|
387
385
|
//-----------------------------------------------------------------------------
|