ccxt 4.2.13 → 4.2.14
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 +624 -130
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/js/ccxt.js +1 -1
- package/dist/cjs/js/src/base/Exchange.js +148 -1
- package/dist/cjs/js/src/bigone.js +36 -32
- package/dist/cjs/js/src/binance.js +108 -0
- package/dist/cjs/js/src/binanceus.js +8 -0
- package/dist/cjs/js/src/bingx.js +4 -0
- package/dist/cjs/js/src/bitget.js +4 -0
- package/dist/cjs/js/src/bybit.js +4 -0
- package/dist/cjs/js/src/coinex.js +3 -0
- package/dist/cjs/js/src/delta.js +7 -1
- package/dist/cjs/js/src/gate.js +5 -0
- package/dist/cjs/js/src/htx.js +126 -1
- package/dist/cjs/js/src/kraken.js +19 -7
- package/dist/cjs/js/src/kucoin.js +5 -0
- package/dist/cjs/js/src/kucoinfutures.js +131 -77
- package/dist/cjs/js/src/okx.js +9 -8
- package/dist/cjs/js/src/woo.js +6 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bigone.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +4 -0
- package/js/src/abstract/kucoinfutures.d.ts +4 -0
- package/js/src/base/Exchange.d.ts +8 -0
- package/js/src/base/Exchange.js +148 -1
- package/js/src/bigone.js +36 -32
- package/js/src/binance.d.ts +9 -0
- package/js/src/binance.js +108 -0
- package/js/src/binanceus.js +8 -0
- package/js/src/bingx.js +4 -0
- package/js/src/bitget.js +4 -0
- package/js/src/bybit.js +4 -0
- package/js/src/coinex.js +3 -0
- package/js/src/delta.js +7 -1
- package/js/src/gate.js +5 -0
- package/js/src/htx.d.ts +9 -0
- package/js/src/htx.js +126 -1
- package/js/src/kraken.js +19 -7
- package/js/src/kucoin.js +5 -0
- package/js/src/kucoinfutures.d.ts +4 -2
- package/js/src/kucoinfutures.js +131 -77
- package/js/src/okx.js +9 -8
- package/js/src/woo.js +6 -2
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.14';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
package/dist/cjs/js/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.13';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
|
@@ -367,13 +367,17 @@ class Exchange {
|
|
|
367
367
|
'createMarketOrderWithCost': undefined,
|
|
368
368
|
'createMarketSellOrderWithCost': undefined,
|
|
369
369
|
'createOrders': undefined,
|
|
370
|
+
'createOrderWithTakeProfitAndStopLoss': undefined,
|
|
370
371
|
'createPostOnlyOrder': undefined,
|
|
371
372
|
'createReduceOnlyOrder': undefined,
|
|
373
|
+
'createStopLossOrder': undefined,
|
|
372
374
|
'createStopOrder': undefined,
|
|
373
375
|
'createStopLimitOrder': undefined,
|
|
374
376
|
'createStopMarketOrder': undefined,
|
|
377
|
+
'createTakeProfitOrder': undefined,
|
|
375
378
|
'createTrailingAmountOrder': undefined,
|
|
376
379
|
'createTrailingPercentOrder': undefined,
|
|
380
|
+
'createTriggerOrder': undefined,
|
|
377
381
|
'createOrderWs': undefined,
|
|
378
382
|
'editOrderWs': undefined,
|
|
379
383
|
'fetchOpenOrdersWs': undefined,
|
|
@@ -3874,11 +3878,154 @@ class Exchange {
|
|
|
3874
3878
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3875
3879
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3876
3880
|
*/
|
|
3877
|
-
if (this.options['createMarketSellOrderRequiresPrice'] || this.
|
|
3881
|
+
if (this.options['createMarketSellOrderRequiresPrice'] || this.has['createMarketSellOrderWithCost']) {
|
|
3878
3882
|
return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
|
|
3879
3883
|
}
|
|
3880
3884
|
throw new errors.NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
|
|
3881
3885
|
}
|
|
3886
|
+
async createTriggerOrder(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
|
|
3887
|
+
/**
|
|
3888
|
+
* @method
|
|
3889
|
+
* @name createTriggerOrder
|
|
3890
|
+
* @description create a trigger stop order (type 1)
|
|
3891
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3892
|
+
* @param {string} type 'market' or 'limit'
|
|
3893
|
+
* @param {string} side 'buy' or 'sell'
|
|
3894
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
3895
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
3896
|
+
* @param {float} triggerPrice the price to trigger the stop order, in units of the quote currency
|
|
3897
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3898
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3899
|
+
*/
|
|
3900
|
+
if (triggerPrice === undefined) {
|
|
3901
|
+
throw new errors.ArgumentsRequired(this.id + ' createTriggerOrder() requires a triggerPrice argument');
|
|
3902
|
+
}
|
|
3903
|
+
params['triggerPrice'] = triggerPrice;
|
|
3904
|
+
if (this.has['createTriggerOrder']) {
|
|
3905
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
3906
|
+
}
|
|
3907
|
+
throw new errors.NotSupported(this.id + ' createTriggerOrder() is not supported yet');
|
|
3908
|
+
}
|
|
3909
|
+
async createStopLossOrder(symbol, type, side, amount, price = undefined, stopLossPrice = undefined, params = {}) {
|
|
3910
|
+
/**
|
|
3911
|
+
* @method
|
|
3912
|
+
* @name createStopLossOrder
|
|
3913
|
+
* @description create a trigger stop loss order (type 2)
|
|
3914
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3915
|
+
* @param {string} type 'market' or 'limit'
|
|
3916
|
+
* @param {string} side 'buy' or 'sell'
|
|
3917
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
3918
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
3919
|
+
* @param {float} stopLossPrice the price to trigger the stop loss order, in units of the quote currency
|
|
3920
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3921
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3922
|
+
*/
|
|
3923
|
+
if (stopLossPrice === undefined) {
|
|
3924
|
+
throw new errors.ArgumentsRequired(this.id + ' createStopLossOrder() requires a stopLossPrice argument');
|
|
3925
|
+
}
|
|
3926
|
+
params['stopLossPrice'] = stopLossPrice;
|
|
3927
|
+
if (this.has['createStopLossOrder']) {
|
|
3928
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
3929
|
+
}
|
|
3930
|
+
throw new errors.NotSupported(this.id + ' createStopLossOrder() is not supported yet');
|
|
3931
|
+
}
|
|
3932
|
+
async createTakeProfitOrder(symbol, type, side, amount, price = undefined, takeProfitPrice = undefined, params = {}) {
|
|
3933
|
+
/**
|
|
3934
|
+
* @method
|
|
3935
|
+
* @name createTakeProfitOrder
|
|
3936
|
+
* @description create a trigger take profit order (type 2)
|
|
3937
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3938
|
+
* @param {string} type 'market' or 'limit'
|
|
3939
|
+
* @param {string} side 'buy' or 'sell'
|
|
3940
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
3941
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
3942
|
+
* @param {float} takeProfitPrice the price to trigger the take profit order, in units of the quote currency
|
|
3943
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3944
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3945
|
+
*/
|
|
3946
|
+
if (takeProfitPrice === undefined) {
|
|
3947
|
+
throw new errors.ArgumentsRequired(this.id + ' createTakeProfitOrder() requires a takeProfitPrice argument');
|
|
3948
|
+
}
|
|
3949
|
+
params['takeProfitPrice'] = takeProfitPrice;
|
|
3950
|
+
if (this.has['createTakeProfitOrder']) {
|
|
3951
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
3952
|
+
}
|
|
3953
|
+
throw new errors.NotSupported(this.id + ' createTakeProfitOrder() is not supported yet');
|
|
3954
|
+
}
|
|
3955
|
+
async createOrderWithTakeProfitAndStopLoss(symbol, type, side, amount, price = undefined, takeProfit = undefined, stopLoss = undefined, params = {}) {
|
|
3956
|
+
/**
|
|
3957
|
+
* @method
|
|
3958
|
+
* @name createOrderWithTakeProfitAndStopLoss
|
|
3959
|
+
* @description create an order with a stop loss or take profit attached (type 3)
|
|
3960
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3961
|
+
* @param {string} type 'market' or 'limit'
|
|
3962
|
+
* @param {string} side 'buy' or 'sell'
|
|
3963
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
3964
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
3965
|
+
* @param {float} [takeProfit] the take profit price, in units of the quote currency
|
|
3966
|
+
* @param {float} [stopLoss] the stop loss price, in units of the quote currency
|
|
3967
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3968
|
+
* @param {string} [params.takeProfitType] *not available on all exchanges* 'limit' or 'market'
|
|
3969
|
+
* @param {string} [params.stopLossType] *not available on all exchanges* 'limit' or 'market'
|
|
3970
|
+
* @param {string} [params.takeProfitPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
|
|
3971
|
+
* @param {string} [params.stopLossPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
|
|
3972
|
+
* @param {float} [params.takeProfitLimitPrice] *not available on all exchanges* limit price for a limit take profit order
|
|
3973
|
+
* @param {float} [params.stopLossLimitPrice] *not available on all exchanges* stop loss for a limit stop loss order
|
|
3974
|
+
* @param {float} [params.takeProfitAmount] *not available on all exchanges* the amount for a take profit
|
|
3975
|
+
* @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
|
|
3976
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3977
|
+
*/
|
|
3978
|
+
if ((takeProfit === undefined) && (stopLoss === undefined)) {
|
|
3979
|
+
throw new errors.ArgumentsRequired(this.id + ' createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument');
|
|
3980
|
+
}
|
|
3981
|
+
if (takeProfit !== undefined) {
|
|
3982
|
+
params['takeProfit'] = {
|
|
3983
|
+
'triggerPrice': takeProfit,
|
|
3984
|
+
};
|
|
3985
|
+
}
|
|
3986
|
+
if (stopLoss !== undefined) {
|
|
3987
|
+
params['stopLoss'] = {
|
|
3988
|
+
'triggerPrice': stopLoss,
|
|
3989
|
+
};
|
|
3990
|
+
}
|
|
3991
|
+
const takeProfitType = this.safeString(params, 'takeProfitType');
|
|
3992
|
+
const takeProfitPriceType = this.safeString(params, 'takeProfitPriceType');
|
|
3993
|
+
const takeProfitLimitPrice = this.safeString(params, 'takeProfitLimitPrice');
|
|
3994
|
+
const takeProfitAmount = this.safeString(params, 'takeProfitAmount');
|
|
3995
|
+
const stopLossType = this.safeString(params, 'stopLossType');
|
|
3996
|
+
const stopLossPriceType = this.safeString(params, 'stopLossPriceType');
|
|
3997
|
+
const stopLossLimitPrice = this.safeString(params, 'stopLossLimitPrice');
|
|
3998
|
+
const stopLossAmount = this.safeString(params, 'stopLossAmount');
|
|
3999
|
+
if (takeProfitType !== undefined) {
|
|
4000
|
+
params['takeProfit']['type'] = takeProfitType;
|
|
4001
|
+
}
|
|
4002
|
+
if (takeProfitPriceType !== undefined) {
|
|
4003
|
+
params['takeProfit']['priceType'] = takeProfitPriceType;
|
|
4004
|
+
}
|
|
4005
|
+
if (takeProfitLimitPrice !== undefined) {
|
|
4006
|
+
params['takeProfit']['price'] = this.parseToNumeric(takeProfitLimitPrice);
|
|
4007
|
+
}
|
|
4008
|
+
if (takeProfitAmount !== undefined) {
|
|
4009
|
+
params['takeProfit']['amount'] = this.parseToNumeric(takeProfitAmount);
|
|
4010
|
+
}
|
|
4011
|
+
if (stopLossType !== undefined) {
|
|
4012
|
+
params['stopLoss']['type'] = stopLossType;
|
|
4013
|
+
}
|
|
4014
|
+
if (stopLossPriceType !== undefined) {
|
|
4015
|
+
params['stopLoss']['priceType'] = stopLossPriceType;
|
|
4016
|
+
}
|
|
4017
|
+
if (stopLossLimitPrice !== undefined) {
|
|
4018
|
+
params['stopLoss']['price'] = this.parseToNumeric(stopLossLimitPrice);
|
|
4019
|
+
}
|
|
4020
|
+
if (stopLossAmount !== undefined) {
|
|
4021
|
+
params['stopLoss']['amount'] = this.parseToNumeric(stopLossAmount);
|
|
4022
|
+
}
|
|
4023
|
+
params = this.omit(params, ['takeProfitType', 'takeProfitPriceType', 'takeProfitLimitPrice', 'takeProfitAmount', 'stopLossType', 'stopLossPriceType', 'stopLossLimitPrice', 'stopLossAmount']);
|
|
4024
|
+
if (this.has['createOrderWithTakeProfitAndStopLoss']) {
|
|
4025
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
4026
|
+
}
|
|
4027
|
+
throw new errors.NotSupported(this.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet');
|
|
4028
|
+
}
|
|
3882
4029
|
async createOrders(orders, params = {}) {
|
|
3883
4030
|
throw new errors.NotSupported(this.id + ' createOrders() is not supported yet');
|
|
3884
4031
|
}
|
|
@@ -124,6 +124,7 @@ class bigone extends bigone$1 {
|
|
|
124
124
|
},
|
|
125
125
|
'contractPublic': {
|
|
126
126
|
'get': [
|
|
127
|
+
'symbols',
|
|
127
128
|
'instruments',
|
|
128
129
|
'depth@{symbol}/snapshot',
|
|
129
130
|
'instruments/difference',
|
|
@@ -519,7 +520,10 @@ class bigone extends bigone$1 {
|
|
|
519
520
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
520
521
|
* @returns {object[]} an array of objects representing market data
|
|
521
522
|
*/
|
|
522
|
-
const
|
|
523
|
+
const promises = [this.publicGetAssetPairs(params), this.contractPublicGetSymbols(params)];
|
|
524
|
+
const promisesResult = await Promise.all(promises);
|
|
525
|
+
const response = promisesResult[0];
|
|
526
|
+
const contractResponse = promisesResult[1];
|
|
523
527
|
//
|
|
524
528
|
// {
|
|
525
529
|
// "code":0,
|
|
@@ -545,29 +549,30 @@ class bigone extends bigone$1 {
|
|
|
545
549
|
// ]
|
|
546
550
|
// }
|
|
547
551
|
//
|
|
548
|
-
const contractResponse = await this.contractPublicGetInstruments(params);
|
|
549
552
|
//
|
|
550
553
|
// [
|
|
551
554
|
// {
|
|
552
|
-
// "
|
|
555
|
+
// "baseCurrency": "BTC",
|
|
556
|
+
// "multiplier": 1,
|
|
557
|
+
// "enable": true,
|
|
558
|
+
// "priceStep": 0.5,
|
|
559
|
+
// "maxRiskLimit": 1000,
|
|
560
|
+
// "pricePrecision": 1,
|
|
561
|
+
// "maintenanceMargin": 0.00500,
|
|
553
562
|
// "symbol": "BTCUSD",
|
|
554
|
-
// "
|
|
555
|
-
// "
|
|
556
|
-
// "
|
|
557
|
-
// "
|
|
558
|
-
// "
|
|
559
|
-
// "
|
|
560
|
-
// "
|
|
561
|
-
// "
|
|
562
|
-
// "
|
|
563
|
-
// "
|
|
564
|
-
// "
|
|
565
|
-
// "
|
|
566
|
-
//
|
|
567
|
-
// "openValue": 32.88054722085945,
|
|
568
|
-
// "last24hMinPrice": 33552.0,
|
|
569
|
-
// "openInterest": 1141372.0
|
|
570
|
-
// }
|
|
563
|
+
// "valuePrecision": 4,
|
|
564
|
+
// "minRiskLimit": 100,
|
|
565
|
+
// "riskLimit": 100,
|
|
566
|
+
// "isInverse": true,
|
|
567
|
+
// "riskStep": 1,
|
|
568
|
+
// "settleCurrency": "BTC",
|
|
569
|
+
// "baseName": "Bitcoin",
|
|
570
|
+
// "feePrecision": 8,
|
|
571
|
+
// "priceMin": 0.5,
|
|
572
|
+
// "priceMax": 1E+6,
|
|
573
|
+
// "initialMargin": 0.01000,
|
|
574
|
+
// "quoteCurrency": "USD"
|
|
575
|
+
// },
|
|
571
576
|
// ...
|
|
572
577
|
// ]
|
|
573
578
|
//
|
|
@@ -634,15 +639,14 @@ class bigone extends bigone$1 {
|
|
|
634
639
|
}
|
|
635
640
|
for (let i = 0; i < contractResponse.length; i++) {
|
|
636
641
|
const market = contractResponse[i];
|
|
642
|
+
const baseId = this.safeString(market, 'baseCurrency');
|
|
643
|
+
const quoteId = this.safeString(market, 'quoteCurrency');
|
|
644
|
+
const settleId = this.safeString(market, 'settleCurrency');
|
|
637
645
|
const marketId = this.safeString(market, 'symbol');
|
|
638
|
-
const index = marketId.indexOf('USD');
|
|
639
|
-
const baseId = marketId.slice(0, index);
|
|
640
|
-
const quoteId = marketId.slice(index);
|
|
641
|
-
const inverse = (quoteId === 'USD');
|
|
642
|
-
const settleId = inverse ? baseId : quoteId;
|
|
643
646
|
const base = this.safeCurrencyCode(baseId);
|
|
644
647
|
const quote = this.safeCurrencyCode(quoteId);
|
|
645
648
|
const settle = this.safeCurrencyCode(settleId);
|
|
649
|
+
const inverse = this.safeValue(market, 'isInverse');
|
|
646
650
|
result.push(this.safeMarketStructure({
|
|
647
651
|
'id': marketId,
|
|
648
652
|
'symbol': base + '/' + quote + ':' + settle,
|
|
@@ -658,18 +662,18 @@ class bigone extends bigone$1 {
|
|
|
658
662
|
'swap': true,
|
|
659
663
|
'future': false,
|
|
660
664
|
'option': false,
|
|
661
|
-
'active':
|
|
665
|
+
'active': this.safeValue(market, 'enable'),
|
|
662
666
|
'contract': true,
|
|
663
667
|
'linear': !inverse,
|
|
664
668
|
'inverse': inverse,
|
|
665
|
-
'contractSize':
|
|
669
|
+
'contractSize': this.safeNumber(market, 'multiplier'),
|
|
666
670
|
'expiry': undefined,
|
|
667
671
|
'expiryDatetime': undefined,
|
|
668
672
|
'strike': undefined,
|
|
669
673
|
'optionType': undefined,
|
|
670
674
|
'precision': {
|
|
671
|
-
'amount':
|
|
672
|
-
'price':
|
|
675
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'valuePrecision'))),
|
|
676
|
+
'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
|
|
673
677
|
},
|
|
674
678
|
'limits': {
|
|
675
679
|
'leverage': {
|
|
@@ -681,11 +685,11 @@ class bigone extends bigone$1 {
|
|
|
681
685
|
'max': undefined,
|
|
682
686
|
},
|
|
683
687
|
'price': {
|
|
684
|
-
'min':
|
|
685
|
-
'max':
|
|
688
|
+
'min': this.safeNumber(market, 'priceMin'),
|
|
689
|
+
'max': this.safeNumber(market, 'priceMax'),
|
|
686
690
|
},
|
|
687
691
|
'cost': {
|
|
688
|
-
'min':
|
|
692
|
+
'min': this.safeNumber(market, 'initialMargin'),
|
|
689
693
|
'max': undefined,
|
|
690
694
|
},
|
|
691
695
|
},
|
|
@@ -52,6 +52,9 @@ class binance extends binance$1 {
|
|
|
52
52
|
'createStopMarketOrder': false,
|
|
53
53
|
'createStopOrder': true,
|
|
54
54
|
'createTrailingPercentOrder': true,
|
|
55
|
+
'createTriggerOrder': true,
|
|
56
|
+
'createTakeProfitOrder': true,
|
|
57
|
+
'createStopLossOrder': true,
|
|
55
58
|
'editOrder': true,
|
|
56
59
|
'fetchAccounts': undefined,
|
|
57
60
|
'fetchBalance': true,
|
|
@@ -82,6 +85,7 @@ class binance extends binance$1 {
|
|
|
82
85
|
'fetchIsolatedBorrowRate': false,
|
|
83
86
|
'fetchIsolatedBorrowRates': false,
|
|
84
87
|
'fetchL3OrderBook': false,
|
|
88
|
+
'fetchLastPrices': true,
|
|
85
89
|
'fetchLedger': true,
|
|
86
90
|
'fetchLeverage': false,
|
|
87
91
|
'fetchLeverageTiers': true,
|
|
@@ -3157,6 +3161,110 @@ class binance extends binance$1 {
|
|
|
3157
3161
|
}
|
|
3158
3162
|
return this.parseTickers(response, symbols);
|
|
3159
3163
|
}
|
|
3164
|
+
async fetchLastPrices(symbols = undefined, params = {}) {
|
|
3165
|
+
/**
|
|
3166
|
+
* @method
|
|
3167
|
+
* @name binance#fetchLastPrices
|
|
3168
|
+
* @description fetches the last price for multiple markets
|
|
3169
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker // spot
|
|
3170
|
+
* @see https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker // swap
|
|
3171
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
|
|
3172
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
|
|
3173
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3174
|
+
* @returns {object} a dictionary of lastprices structures
|
|
3175
|
+
*/
|
|
3176
|
+
await this.loadMarkets();
|
|
3177
|
+
symbols = this.marketSymbols(symbols);
|
|
3178
|
+
const market = this.getMarketFromSymbols(symbols);
|
|
3179
|
+
let type = undefined;
|
|
3180
|
+
let subType = undefined;
|
|
3181
|
+
[subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
|
|
3182
|
+
[type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
|
|
3183
|
+
let response = undefined;
|
|
3184
|
+
if (this.isLinear(type, subType)) {
|
|
3185
|
+
response = await this.fapiPublicV2GetTickerPrice(params);
|
|
3186
|
+
//
|
|
3187
|
+
// [
|
|
3188
|
+
// {
|
|
3189
|
+
// "symbol": "LTCBTC",
|
|
3190
|
+
// "price": "4.00000200"
|
|
3191
|
+
// "time": 1589437530011
|
|
3192
|
+
// },
|
|
3193
|
+
// ...
|
|
3194
|
+
// ]
|
|
3195
|
+
//
|
|
3196
|
+
}
|
|
3197
|
+
else if (this.isInverse(type, subType)) {
|
|
3198
|
+
response = await this.dapiPublicGetTickerPrice(params);
|
|
3199
|
+
//
|
|
3200
|
+
// [
|
|
3201
|
+
// {
|
|
3202
|
+
// "symbol": "BTCUSD_200626",
|
|
3203
|
+
// "ps": "9647.8",
|
|
3204
|
+
// "price": "9647.8",
|
|
3205
|
+
// "time": 1591257246176
|
|
3206
|
+
// }
|
|
3207
|
+
// ]
|
|
3208
|
+
//
|
|
3209
|
+
}
|
|
3210
|
+
else if (type === 'spot') {
|
|
3211
|
+
response = await this.publicGetTickerPrice(params);
|
|
3212
|
+
//
|
|
3213
|
+
// [
|
|
3214
|
+
// {
|
|
3215
|
+
// "symbol": "LTCBTC",
|
|
3216
|
+
// "price": "4.00000200"
|
|
3217
|
+
// },
|
|
3218
|
+
// ...
|
|
3219
|
+
// ]
|
|
3220
|
+
//
|
|
3221
|
+
}
|
|
3222
|
+
else {
|
|
3223
|
+
throw new errors.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
|
|
3224
|
+
}
|
|
3225
|
+
return this.parseLastPrices(response, symbols);
|
|
3226
|
+
}
|
|
3227
|
+
parseLastPrice(entry, market = undefined) {
|
|
3228
|
+
//
|
|
3229
|
+
// spot
|
|
3230
|
+
//
|
|
3231
|
+
// {
|
|
3232
|
+
// "symbol": "LTCBTC",
|
|
3233
|
+
// "price": "4.00000200"
|
|
3234
|
+
// }
|
|
3235
|
+
//
|
|
3236
|
+
// usdm (swap/future)
|
|
3237
|
+
//
|
|
3238
|
+
// {
|
|
3239
|
+
// "symbol": "BTCUSDT",
|
|
3240
|
+
// "price": "6000.01",
|
|
3241
|
+
// "time": 1589437530011 // Transaction time
|
|
3242
|
+
// }
|
|
3243
|
+
//
|
|
3244
|
+
//
|
|
3245
|
+
// coinm (swap/future)
|
|
3246
|
+
//
|
|
3247
|
+
// {
|
|
3248
|
+
// "symbol": "BTCUSD_200626", // symbol ("BTCUSD_200626", "BTCUSD_PERP", etc..)
|
|
3249
|
+
// "ps": "BTCUSD", // pair
|
|
3250
|
+
// "price": "9647.8",
|
|
3251
|
+
// "time": 1591257246176
|
|
3252
|
+
// }
|
|
3253
|
+
//
|
|
3254
|
+
const timestamp = this.safeInteger(entry, 'time');
|
|
3255
|
+
const type = (timestamp === undefined) ? 'spot' : 'swap';
|
|
3256
|
+
const marketId = this.safeString(entry, 'symbol');
|
|
3257
|
+
market = this.safeMarket(marketId, market, undefined, type);
|
|
3258
|
+
const price = this.safeNumber(entry, 'price');
|
|
3259
|
+
return {
|
|
3260
|
+
'symbol': market['symbol'],
|
|
3261
|
+
'timestamp': timestamp,
|
|
3262
|
+
'datetime': this.iso8601(timestamp),
|
|
3263
|
+
'price': price,
|
|
3264
|
+
'side': undefined,
|
|
3265
|
+
'info': entry,
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3160
3268
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
3161
3269
|
/**
|
|
3162
3270
|
* @method
|
|
@@ -10,6 +10,7 @@ class binanceus extends binance {
|
|
|
10
10
|
'id': 'binanceus',
|
|
11
11
|
'name': 'Binance US',
|
|
12
12
|
'countries': ['US'],
|
|
13
|
+
'rateLimit': 50,
|
|
13
14
|
'certified': false,
|
|
14
15
|
'pro': true,
|
|
15
16
|
'urls': {
|
|
@@ -77,6 +78,13 @@ class binanceus extends binance {
|
|
|
77
78
|
'setMarginMode': false,
|
|
78
79
|
'setPositionMode': false,
|
|
79
80
|
},
|
|
81
|
+
'api': {
|
|
82
|
+
'public': {
|
|
83
|
+
'get': {
|
|
84
|
+
'ticker/price': { 'cost': 1, 'noSymbol': 2 },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
80
88
|
});
|
|
81
89
|
}
|
|
82
90
|
}
|
package/dist/cjs/js/src/bingx.js
CHANGED
|
@@ -38,6 +38,10 @@ class bingx extends bingx$1 {
|
|
|
38
38
|
'createOrders': true,
|
|
39
39
|
'createTrailingAmountOrder': true,
|
|
40
40
|
'createTrailingPercentOrder': true,
|
|
41
|
+
'createTriggerOrder': true,
|
|
42
|
+
'createTakeProfitOrder': true,
|
|
43
|
+
'createStopLossOrder': true,
|
|
44
|
+
'createOrderWithTakeProfitAndStopLoss': true,
|
|
41
45
|
'fetchBalance': true,
|
|
42
46
|
'fetchClosedOrders': true,
|
|
43
47
|
'fetchCurrencies': true,
|
|
@@ -44,6 +44,10 @@ class bitget extends bitget$1 {
|
|
|
44
44
|
'createOrders': true,
|
|
45
45
|
'createReduceOnlyOrder': false,
|
|
46
46
|
'createTrailingPercentOrder': true,
|
|
47
|
+
'createTriggerOrder': true,
|
|
48
|
+
'createTakeProfitOrder': true,
|
|
49
|
+
'createStopLossOrder': true,
|
|
50
|
+
'createOrderWithTakeProfitAndStopLoss': true,
|
|
47
51
|
'editOrder': true,
|
|
48
52
|
'fetchAccounts': false,
|
|
49
53
|
'fetchBalance': true,
|
package/dist/cjs/js/src/bybit.js
CHANGED
|
@@ -47,6 +47,10 @@ class bybit extends bybit$1 {
|
|
|
47
47
|
'createStopMarketOrder': true,
|
|
48
48
|
'createStopOrder': true,
|
|
49
49
|
'createTrailingAmountOrder': true,
|
|
50
|
+
'createTriggerOrder': true,
|
|
51
|
+
'createTakeProfitOrder': true,
|
|
52
|
+
'createStopLossOrder': true,
|
|
53
|
+
'createOrderWithTakeProfitAndStopLoss': true,
|
|
50
54
|
'editOrder': true,
|
|
51
55
|
'fetchBalance': true,
|
|
52
56
|
'fetchBorrowInterest': false,
|
|
@@ -48,6 +48,9 @@ class coinex extends coinex$1 {
|
|
|
48
48
|
'createMarketBuyOrderWithCost': true,
|
|
49
49
|
'createMarketOrderWithCost': false,
|
|
50
50
|
'createMarketSellOrderWithCost': false,
|
|
51
|
+
'createTriggerOrder': true,
|
|
52
|
+
'createTakeProfitOrder': true,
|
|
53
|
+
'createStopLossOrder': true,
|
|
51
54
|
'createOrder': true,
|
|
52
55
|
'createOrders': true,
|
|
53
56
|
'createReduceOnlyOrder': true,
|
package/dist/cjs/js/src/delta.js
CHANGED
|
@@ -2071,7 +2071,13 @@ class delta extends delta$1 {
|
|
|
2071
2071
|
if (limit !== undefined) {
|
|
2072
2072
|
request['page_size'] = limit;
|
|
2073
2073
|
}
|
|
2074
|
-
|
|
2074
|
+
let response = undefined;
|
|
2075
|
+
if (method === 'privateGetOrders') {
|
|
2076
|
+
response = await this.privateGetOrders(this.extend(request, params));
|
|
2077
|
+
}
|
|
2078
|
+
else if (method === 'privateGetOrdersHistory') {
|
|
2079
|
+
response = await this.privateGetOrdersHistory(this.extend(request, params));
|
|
2080
|
+
}
|
|
2075
2081
|
//
|
|
2076
2082
|
// {
|
|
2077
2083
|
// "success": true,
|
package/dist/cjs/js/src/gate.js
CHANGED
|
@@ -90,6 +90,9 @@ class gate extends gate$1 {
|
|
|
90
90
|
'createReduceOnlyOrder': true,
|
|
91
91
|
'createStopLimitOrder': true,
|
|
92
92
|
'createStopMarketOrder': false,
|
|
93
|
+
'createTriggerOrder': true,
|
|
94
|
+
'createTakeProfitOrder': true,
|
|
95
|
+
'createStopLossOrder': true,
|
|
93
96
|
'createStopOrder': true,
|
|
94
97
|
'editOrder': true,
|
|
95
98
|
'fetchBalance': true,
|
|
@@ -3766,6 +3769,8 @@ class gate extends gate$1 {
|
|
|
3766
3769
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3767
3770
|
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
3768
3771
|
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
3772
|
+
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
3773
|
+
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
3769
3774
|
* @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
|
|
3770
3775
|
* @param {int} [params.iceberg] Amount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely
|
|
3771
3776
|
* @param {string} [params.text] User defined information
|