ccxt 4.2.12 → 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 +1338 -366
- 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 +125 -54
- package/dist/cjs/js/src/binance.js +142 -27
- package/dist/cjs/js/src/binanceus.js +8 -0
- package/dist/cjs/js/src/bingx.js +110 -36
- package/dist/cjs/js/src/bitget.js +17 -6
- package/dist/cjs/js/src/bitmart.js +3 -3
- package/dist/cjs/js/src/bybit.js +5 -1
- package/dist/cjs/js/src/coinbase.js +176 -26
- package/dist/cjs/js/src/coinex.js +3 -0
- package/dist/cjs/js/src/coinlist.js +1 -1
- package/dist/cjs/js/src/coinone.js +1 -1
- package/dist/cjs/js/src/delta.js +7 -1
- package/dist/cjs/js/src/deribit.js +1 -1
- package/dist/cjs/js/src/gate.js +79 -56
- package/dist/cjs/js/src/gemini.js +1 -1
- package/dist/cjs/js/src/htx.js +151 -1
- package/dist/cjs/js/src/independentreserve.js +7 -5
- package/dist/cjs/js/src/kraken.js +22 -14
- package/dist/cjs/js/src/kucoin.js +5 -0
- package/dist/cjs/js/src/kucoinfutures.js +131 -77
- package/dist/cjs/js/src/lbank.js +59 -33
- package/dist/cjs/js/src/oceanex.js +1 -1
- package/dist/cjs/js/src/okx.js +11 -9
- package/dist/cjs/js/src/phemex.js +9 -2
- package/dist/cjs/js/src/pro/kraken.js +1 -1
- package/dist/cjs/js/src/pro/okx.js +52 -2
- package/dist/cjs/js/src/probit.js +4 -2
- package/dist/cjs/js/src/wavesexchange.js +1 -1
- package/dist/cjs/js/src/woo.js +56 -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/bingx.d.ts +2 -0
- package/js/src/abstract/kucoin.d.ts +4 -0
- package/js/src/abstract/kucoinfutures.d.ts +4 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +8 -0
- package/js/src/base/Exchange.js +148 -1
- package/js/src/bigone.d.ts +2 -0
- package/js/src/bigone.js +125 -54
- package/js/src/binance.d.ts +9 -0
- package/js/src/binance.js +142 -27
- package/js/src/binanceus.js +8 -0
- package/js/src/bingx.js +110 -36
- package/js/src/bitget.js +17 -6
- package/js/src/bitmart.js +3 -3
- package/js/src/bybit.js +5 -1
- package/js/src/coinbase.d.ts +26 -3
- package/js/src/coinbase.js +176 -26
- package/js/src/coinex.js +3 -0
- package/js/src/coinlist.js +1 -1
- package/js/src/coinone.js +1 -1
- package/js/src/delta.js +7 -1
- package/js/src/deribit.js +1 -1
- package/js/src/gate.js +79 -56
- package/js/src/gemini.js +1 -1
- package/js/src/htx.d.ts +10 -0
- package/js/src/htx.js +151 -1
- package/js/src/independentreserve.js +7 -5
- package/js/src/kraken.js +22 -14
- 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/lbank.js +59 -33
- package/js/src/oceanex.js +1 -1
- package/js/src/okx.js +11 -9
- package/js/src/phemex.js +9 -2
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/okx.d.ts +1 -0
- package/js/src/pro/okx.js +52 -2
- package/js/src/probit.js +4 -2
- package/js/src/wavesexchange.js +1 -1
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +56 -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
|
},
|
|
@@ -931,29 +935,90 @@ class bigone extends bigone$1 {
|
|
|
931
935
|
*/
|
|
932
936
|
await this.loadMarkets();
|
|
933
937
|
const market = this.market(symbol);
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
938
|
+
let response = undefined;
|
|
939
|
+
if (market['contract']) {
|
|
940
|
+
const request = {
|
|
941
|
+
'symbol': market['id'],
|
|
942
|
+
};
|
|
943
|
+
response = await this.contractPublicGetDepthSymbolSnapshot(this.extend(request, params));
|
|
944
|
+
//
|
|
945
|
+
// {
|
|
946
|
+
// bids: {
|
|
947
|
+
// '20000': '20',
|
|
948
|
+
// ...
|
|
949
|
+
// '34552': '64851',
|
|
950
|
+
// '34526.5': '59594',
|
|
951
|
+
// ...
|
|
952
|
+
// '34551.5': '29711'
|
|
953
|
+
// },
|
|
954
|
+
// asks: {
|
|
955
|
+
// '34557': '34395',
|
|
956
|
+
// ...
|
|
957
|
+
// '40000': '20',
|
|
958
|
+
// '34611.5': '56024',
|
|
959
|
+
// ...
|
|
960
|
+
// '34578.5': '66367'
|
|
961
|
+
// },
|
|
962
|
+
// to: '59737174',
|
|
963
|
+
// lastPrice: '34554.5',
|
|
964
|
+
// bestPrices: {
|
|
965
|
+
// ask: '34557.0',
|
|
966
|
+
// bid: '34552.0'
|
|
967
|
+
// },
|
|
968
|
+
// from: '0'
|
|
969
|
+
// }
|
|
970
|
+
//
|
|
971
|
+
return this.parseContractOrderBook(response, market['symbol'], limit);
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
const request = {
|
|
975
|
+
'asset_pair_name': market['id'],
|
|
976
|
+
};
|
|
977
|
+
if (limit !== undefined) {
|
|
978
|
+
request['limit'] = limit; // default 50, max 200
|
|
979
|
+
}
|
|
980
|
+
response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
|
|
981
|
+
//
|
|
982
|
+
// {
|
|
983
|
+
// "code":0,
|
|
984
|
+
// "data": {
|
|
985
|
+
// "asset_pair_name": "EOS-BTC",
|
|
986
|
+
// "bids": [
|
|
987
|
+
// { "price": "42", "order_count": 4, "quantity": "23.33363711" }
|
|
988
|
+
// ],
|
|
989
|
+
// "asks": [
|
|
990
|
+
// { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
|
|
991
|
+
// ]
|
|
992
|
+
// }
|
|
993
|
+
// }
|
|
994
|
+
//
|
|
995
|
+
const orderbook = this.safeValue(response, 'data', {});
|
|
996
|
+
return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
|
|
939
997
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const
|
|
956
|
-
return
|
|
998
|
+
}
|
|
999
|
+
parseContractBidsAsks(bidsAsks) {
|
|
1000
|
+
const bidsAsksKeys = Object.keys(bidsAsks);
|
|
1001
|
+
const result = [];
|
|
1002
|
+
for (let i = 0; i < bidsAsksKeys.length; i++) {
|
|
1003
|
+
const price = bidsAsksKeys[i];
|
|
1004
|
+
const amount = bidsAsks[price];
|
|
1005
|
+
result.push([this.parseNumber(price), this.parseNumber(amount)]);
|
|
1006
|
+
}
|
|
1007
|
+
return result;
|
|
1008
|
+
}
|
|
1009
|
+
parseContractOrderBook(orderbook, symbol, limit = undefined) {
|
|
1010
|
+
const responseBids = this.safeValue(orderbook, 'bids');
|
|
1011
|
+
const responseAsks = this.safeValue(orderbook, 'asks');
|
|
1012
|
+
const bids = this.parseContractBidsAsks(responseBids);
|
|
1013
|
+
const asks = this.parseContractBidsAsks(responseAsks);
|
|
1014
|
+
return {
|
|
1015
|
+
'symbol': symbol,
|
|
1016
|
+
'bids': this.filterByLimit(this.sortBy(bids, 0, true), limit),
|
|
1017
|
+
'asks': this.filterByLimit(this.sortBy(asks, 0), limit),
|
|
1018
|
+
'timestamp': undefined,
|
|
1019
|
+
'datetime': undefined,
|
|
1020
|
+
'nonce': undefined,
|
|
1021
|
+
};
|
|
957
1022
|
}
|
|
958
1023
|
parseTrade(trade, market = undefined) {
|
|
959
1024
|
//
|
|
@@ -1113,6 +1178,9 @@ class bigone extends bigone$1 {
|
|
|
1113
1178
|
*/
|
|
1114
1179
|
await this.loadMarkets();
|
|
1115
1180
|
const market = this.market(symbol);
|
|
1181
|
+
if (market['contract']) {
|
|
1182
|
+
throw new errors.BadRequest(this.id + ' fetchTrades () can only fetch trades for spot markets');
|
|
1183
|
+
}
|
|
1116
1184
|
const request = {
|
|
1117
1185
|
'asset_pair_name': market['id'],
|
|
1118
1186
|
};
|
|
@@ -1175,6 +1243,9 @@ class bigone extends bigone$1 {
|
|
|
1175
1243
|
*/
|
|
1176
1244
|
await this.loadMarkets();
|
|
1177
1245
|
const market = this.market(symbol);
|
|
1246
|
+
if (market['contract']) {
|
|
1247
|
+
throw new errors.BadRequest(this.id + ' fetchOHLCV () can only fetch ohlcvs for spot markets');
|
|
1248
|
+
}
|
|
1178
1249
|
if (limit === undefined) {
|
|
1179
1250
|
limit = 100; // default 100, max 500
|
|
1180
1251
|
}
|