ccxt 4.1.98 → 4.1.99
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 +438 -176
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +29 -0
- package/dist/cjs/src/binance.js +84 -59
- package/dist/cjs/src/bingx.js +24 -7
- package/dist/cjs/src/bitget.js +95 -38
- package/dist/cjs/src/bitmart.js +71 -17
- package/dist/cjs/src/bitvavo.js +52 -14
- package/dist/cjs/src/coinex.js +58 -21
- package/dist/cjs/src/kraken.js +21 -16
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +16 -0
- package/js/src/abstract/binancecoinm.d.ts +16 -0
- package/js/src/abstract/binanceus.d.ts +16 -0
- package/js/src/abstract/binanceusdm.d.ts +16 -0
- package/js/src/abstract/coinex.d.ts +14 -1
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +29 -0
- package/js/src/binance.js +84 -59
- package/js/src/bingx.js +24 -7
- package/js/src/bitget.js +95 -38
- package/js/src/bitmart.js +71 -17
- package/js/src/bitvavo.js +52 -14
- package/js/src/coinex.js +58 -21
- package/js/src/kraken.js +21 -16
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -4000,6 +4000,9 @@ class bitget extends bitget$1 {
|
|
|
4000
4000
|
* @param {float} [params.takeProfit.price] *swap only* the execution price for a take profit attached to a trigger order
|
|
4001
4001
|
* @param {string} [params.stopLoss.type] *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price'
|
|
4002
4002
|
* @param {string} [params.takeProfit.type] *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price'
|
|
4003
|
+
* @param {string} [params.trailingPercent] *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10
|
|
4004
|
+
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
4005
|
+
* @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
4003
4006
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4004
4007
|
*/
|
|
4005
4008
|
await this.loadMarkets();
|
|
@@ -4009,6 +4012,8 @@ class bitget extends bitget$1 {
|
|
|
4009
4012
|
const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
|
|
4010
4013
|
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
4011
4014
|
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4015
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
|
|
4016
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
4012
4017
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
4013
4018
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4014
4019
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
@@ -4030,7 +4035,7 @@ class bitget extends bitget$1 {
|
|
|
4030
4035
|
}
|
|
4031
4036
|
}
|
|
4032
4037
|
else {
|
|
4033
|
-
if (isTriggerOrder) {
|
|
4038
|
+
if (isTriggerOrder || isTrailingPercentOrder) {
|
|
4034
4039
|
response = await this.privateMixPostV2MixOrderPlacePlanOrder(request);
|
|
4035
4040
|
}
|
|
4036
4041
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
@@ -4085,8 +4090,11 @@ class bitget extends bitget$1 {
|
|
|
4085
4090
|
const isTakeProfit = takeProfit !== undefined;
|
|
4086
4091
|
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
4087
4092
|
const isStopLossOrTakeProfit = isStopLoss || isTakeProfit;
|
|
4088
|
-
|
|
4089
|
-
|
|
4093
|
+
const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', price);
|
|
4094
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
|
|
4095
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
4096
|
+
if (this.sum(isTriggerOrder, isStopLossTriggerOrder, isTakeProfitTriggerOrder, isTrailingPercentOrder) > 1) {
|
|
4097
|
+
throw new errors.ExchangeError(this.id + ' createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
|
|
4090
4098
|
}
|
|
4091
4099
|
if (type === 'limit') {
|
|
4092
4100
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -4111,7 +4119,7 @@ class bitget extends bitget$1 {
|
|
|
4111
4119
|
else if (timeInForce === 'IOC') {
|
|
4112
4120
|
request['force'] = 'IOC';
|
|
4113
4121
|
}
|
|
4114
|
-
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'postOnly', 'reduceOnly', 'clientOrderId']);
|
|
4122
|
+
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'postOnly', 'reduceOnly', 'clientOrderId', 'trailingPercent', 'trailingTriggerPrice']);
|
|
4115
4123
|
if ((marketType === 'swap') || (marketType === 'future')) {
|
|
4116
4124
|
request['marginCoin'] = market['settleId'];
|
|
4117
4125
|
request['size'] = this.amountToPrecision(symbol, amount);
|
|
@@ -4121,34 +4129,21 @@ class bitget extends bitget$1 {
|
|
|
4121
4129
|
if (clientOrderId !== undefined) {
|
|
4122
4130
|
request['clientOid'] = clientOrderId;
|
|
4123
4131
|
}
|
|
4124
|
-
if (isTriggerOrder || isStopLossOrTakeProfitTrigger) {
|
|
4132
|
+
if (isTriggerOrder || isStopLossOrTakeProfitTrigger || isTrailingPercentOrder) {
|
|
4125
4133
|
request['triggerType'] = triggerType;
|
|
4126
4134
|
}
|
|
4127
|
-
if (
|
|
4135
|
+
if (isTrailingPercentOrder) {
|
|
4128
4136
|
if (!isMarketOrder) {
|
|
4129
|
-
throw new errors.
|
|
4137
|
+
throw new errors.BadRequest(this.id + ' createOrder() bitget trailing orders must be market orders');
|
|
4130
4138
|
}
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
else {
|
|
4134
|
-
if (marginMode === undefined) {
|
|
4135
|
-
marginMode = 'cross';
|
|
4139
|
+
if (trailingTriggerPrice === undefined) {
|
|
4140
|
+
throw new errors.ArgumentsRequired(this.id + ' createOrder() bitget trailing orders must have a trailingTriggerPrice param');
|
|
4136
4141
|
}
|
|
4137
|
-
|
|
4138
|
-
request['
|
|
4139
|
-
|
|
4140
|
-
if (reduceOnly) {
|
|
4141
|
-
request['reduceOnly'] = 'YES';
|
|
4142
|
-
request['tradeSide'] = 'Close';
|
|
4143
|
-
// on bitget if the position is long the side is always buy, and if the position is short the side is always sell
|
|
4144
|
-
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
4145
|
-
}
|
|
4146
|
-
else {
|
|
4147
|
-
request['tradeSide'] = 'Open';
|
|
4148
|
-
}
|
|
4149
|
-
request['side'] = requestSide;
|
|
4142
|
+
request['planType'] = 'track_plan';
|
|
4143
|
+
request['triggerPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
4144
|
+
request['callbackRatio'] = trailingPercent;
|
|
4150
4145
|
}
|
|
4151
|
-
if (isTriggerOrder) {
|
|
4146
|
+
else if (isTriggerOrder) {
|
|
4152
4147
|
request['planType'] = 'normal_plan';
|
|
4153
4148
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
4154
4149
|
if (price !== undefined) {
|
|
@@ -4172,6 +4167,10 @@ class bitget extends bitget$1 {
|
|
|
4172
4167
|
}
|
|
4173
4168
|
}
|
|
4174
4169
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
4170
|
+
if (!isMarketOrder) {
|
|
4171
|
+
throw new errors.ExchangeError(this.id + ' createOrder() bitget stopLoss or takeProfit orders must be market orders');
|
|
4172
|
+
}
|
|
4173
|
+
request['holdSide'] = (side === 'buy') ? 'long' : 'short';
|
|
4175
4174
|
if (isStopLossTriggerOrder) {
|
|
4176
4175
|
request['triggerPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4177
4176
|
request['planType'] = 'pos_loss';
|
|
@@ -4191,6 +4190,24 @@ class bitget extends bitget$1 {
|
|
|
4191
4190
|
request['presetStopSurplusPrice'] = this.priceToPrecision(symbol, tpTriggerPrice);
|
|
4192
4191
|
}
|
|
4193
4192
|
}
|
|
4193
|
+
if (!isStopLossOrTakeProfitTrigger) {
|
|
4194
|
+
if (marginMode === undefined) {
|
|
4195
|
+
marginMode = 'cross';
|
|
4196
|
+
}
|
|
4197
|
+
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
4198
|
+
request['marginMode'] = marginModeRequest;
|
|
4199
|
+
let requestSide = side;
|
|
4200
|
+
if (reduceOnly) {
|
|
4201
|
+
request['reduceOnly'] = 'YES';
|
|
4202
|
+
request['tradeSide'] = 'Close';
|
|
4203
|
+
// on bitget if the position is long the side is always buy, and if the position is short the side is always sell
|
|
4204
|
+
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
4205
|
+
}
|
|
4206
|
+
else {
|
|
4207
|
+
request['tradeSide'] = 'Open';
|
|
4208
|
+
}
|
|
4209
|
+
request['side'] = requestSide;
|
|
4210
|
+
}
|
|
4194
4211
|
}
|
|
4195
4212
|
else if (marketType === 'spot') {
|
|
4196
4213
|
if (isStopLossOrTakeProfitTrigger || isStopLossOrTakeProfit) {
|
|
@@ -4397,6 +4414,9 @@ class bitget extends bitget$1 {
|
|
|
4397
4414
|
* @param {float} [params.takeProfit.price] *swap only* the execution price for a take profit attached to a trigger order
|
|
4398
4415
|
* @param {string} [params.stopLoss.type] *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price'
|
|
4399
4416
|
* @param {string} [params.takeProfit.type] *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price'
|
|
4417
|
+
* @param {string} [params.trailingPercent] *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10
|
|
4418
|
+
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
4419
|
+
* @param {string} [params.newTriggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
4400
4420
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4401
4421
|
*/
|
|
4402
4422
|
await this.loadMarkets();
|
|
@@ -4423,14 +4443,17 @@ class bitget extends bitget$1 {
|
|
|
4423
4443
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4424
4444
|
const isStopLoss = stopLoss !== undefined;
|
|
4425
4445
|
const isTakeProfit = takeProfit !== undefined;
|
|
4426
|
-
|
|
4427
|
-
|
|
4446
|
+
const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', price);
|
|
4447
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'newCallbackRatio');
|
|
4448
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
4449
|
+
if (this.sum(isTriggerOrder, isStopLossOrder, isTakeProfitOrder, isTrailingPercentOrder) > 1) {
|
|
4450
|
+
throw new errors.ExchangeError(this.id + ' editOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
|
|
4428
4451
|
}
|
|
4429
4452
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
4430
4453
|
if (clientOrderId !== undefined) {
|
|
4431
4454
|
request['clientOid'] = clientOrderId;
|
|
4432
4455
|
}
|
|
4433
|
-
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId']);
|
|
4456
|
+
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId', 'trailingTriggerPrice', 'trailingPercent']);
|
|
4434
4457
|
let response = undefined;
|
|
4435
4458
|
if (market['spot']) {
|
|
4436
4459
|
const editMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'editMarketBuyOrderRequiresPrice', true);
|
|
@@ -4463,11 +4486,21 @@ class bitget extends bitget$1 {
|
|
|
4463
4486
|
request['productType'] = productType;
|
|
4464
4487
|
if (!isTakeProfitOrder && !isStopLossOrder) {
|
|
4465
4488
|
request['newSize'] = this.amountToPrecision(symbol, amount);
|
|
4466
|
-
if (price !== undefined) {
|
|
4489
|
+
if ((price !== undefined) && !isTrailingPercentOrder) {
|
|
4467
4490
|
request['newPrice'] = this.priceToPrecision(symbol, price);
|
|
4468
4491
|
}
|
|
4469
4492
|
}
|
|
4470
|
-
if (
|
|
4493
|
+
if (isTrailingPercentOrder) {
|
|
4494
|
+
if (!isMarketOrder) {
|
|
4495
|
+
throw new errors.BadRequest(this.id + ' editOrder() bitget trailing orders must be market orders');
|
|
4496
|
+
}
|
|
4497
|
+
if (trailingTriggerPrice !== undefined) {
|
|
4498
|
+
request['newTriggerPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
4499
|
+
}
|
|
4500
|
+
request['newCallbackRatio'] = trailingPercent;
|
|
4501
|
+
response = await this.privateMixPostV2MixOrderModifyPlanOrder(this.extend(request, params));
|
|
4502
|
+
}
|
|
4503
|
+
else if (isTakeProfitOrder || isStopLossOrder) {
|
|
4471
4504
|
request['marginCoin'] = market['settleId'];
|
|
4472
4505
|
request['size'] = this.amountToPrecision(symbol, amount);
|
|
4473
4506
|
request['executePrice'] = this.priceToPrecision(symbol, price);
|
|
@@ -4546,6 +4579,7 @@ class bitget extends bitget$1 {
|
|
|
4546
4579
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
4547
4580
|
* @param {boolean} [params.stop] set to true for canceling trigger orders
|
|
4548
4581
|
* @param {string} [params.planType] *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
|
|
4582
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
4549
4583
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4550
4584
|
*/
|
|
4551
4585
|
if (symbol === undefined) {
|
|
@@ -4565,8 +4599,9 @@ class bitget extends bitget$1 {
|
|
|
4565
4599
|
let response = undefined;
|
|
4566
4600
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
4567
4601
|
const request = {};
|
|
4568
|
-
const
|
|
4569
|
-
|
|
4602
|
+
const trailing = this.safeValue(params, 'trailing');
|
|
4603
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
4604
|
+
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
4570
4605
|
if (!(market['spot'] && stop)) {
|
|
4571
4606
|
request['symbol'] = market['id'];
|
|
4572
4607
|
}
|
|
@@ -4577,13 +4612,20 @@ class bitget extends bitget$1 {
|
|
|
4577
4612
|
let productType = undefined;
|
|
4578
4613
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
4579
4614
|
request['productType'] = productType;
|
|
4580
|
-
if (stop) {
|
|
4615
|
+
if (stop || trailing) {
|
|
4581
4616
|
const orderIdList = [];
|
|
4582
4617
|
const orderId = {
|
|
4583
4618
|
'orderId': id,
|
|
4584
4619
|
};
|
|
4585
4620
|
orderIdList.push(orderId);
|
|
4586
4621
|
request['orderIdList'] = orderIdList;
|
|
4622
|
+
}
|
|
4623
|
+
if (trailing) {
|
|
4624
|
+
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
4625
|
+
request['planType'] = planType;
|
|
4626
|
+
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
4627
|
+
}
|
|
4628
|
+
else if (stop) {
|
|
4587
4629
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
4588
4630
|
}
|
|
4589
4631
|
else {
|
|
@@ -4999,6 +5041,7 @@ class bitget extends bitget$1 {
|
|
|
4999
5041
|
* @param {boolean} [params.stop] set to true for fetching trigger orders
|
|
5000
5042
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5001
5043
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
5044
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
5002
5045
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5003
5046
|
*/
|
|
5004
5047
|
await this.loadMarkets();
|
|
@@ -5040,8 +5083,9 @@ class bitget extends bitget$1 {
|
|
|
5040
5083
|
return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
|
|
5041
5084
|
}
|
|
5042
5085
|
let response = undefined;
|
|
5086
|
+
const trailing = this.safeValue(params, 'trailing');
|
|
5043
5087
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
5044
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
5088
|
+
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
5045
5089
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5046
5090
|
if (since !== undefined) {
|
|
5047
5091
|
request['startTime'] = since;
|
|
@@ -5084,7 +5128,12 @@ class bitget extends bitget$1 {
|
|
|
5084
5128
|
let productType = undefined;
|
|
5085
5129
|
[productType, query] = this.handleProductTypeAndParams(market, query);
|
|
5086
5130
|
request['productType'] = productType;
|
|
5087
|
-
if (
|
|
5131
|
+
if (trailing) {
|
|
5132
|
+
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
5133
|
+
request['planType'] = planType;
|
|
5134
|
+
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
|
|
5135
|
+
}
|
|
5136
|
+
else if (stop) {
|
|
5088
5137
|
const planType = this.safeString(query, 'planType', 'normal_plan');
|
|
5089
5138
|
request['planType'] = planType;
|
|
5090
5139
|
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
|
|
@@ -5300,6 +5349,7 @@ class bitget extends bitget$1 {
|
|
|
5300
5349
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5301
5350
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
5302
5351
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
5352
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
5303
5353
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5304
5354
|
*/
|
|
5305
5355
|
await this.loadMarkets();
|
|
@@ -5337,6 +5387,7 @@ class bitget extends bitget$1 {
|
|
|
5337
5387
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5338
5388
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
5339
5389
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
5390
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
5340
5391
|
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5341
5392
|
*/
|
|
5342
5393
|
await this.loadMarkets();
|
|
@@ -5389,8 +5440,9 @@ class bitget extends bitget$1 {
|
|
|
5389
5440
|
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
|
|
5390
5441
|
}
|
|
5391
5442
|
let response = undefined;
|
|
5443
|
+
const trailing = this.safeValue(params, 'trailing');
|
|
5392
5444
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
5393
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
5445
|
+
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
5394
5446
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5395
5447
|
if (since !== undefined) {
|
|
5396
5448
|
request['startTime'] = since;
|
|
@@ -5444,7 +5496,12 @@ class bitget extends bitget$1 {
|
|
|
5444
5496
|
let productType = undefined;
|
|
5445
5497
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5446
5498
|
request['productType'] = productType;
|
|
5447
|
-
if (
|
|
5499
|
+
if (trailing) {
|
|
5500
|
+
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
5501
|
+
request['planType'] = planType;
|
|
5502
|
+
response = await this.privateMixGetV2MixOrderOrdersPlanHistory(this.extend(request, params));
|
|
5503
|
+
}
|
|
5504
|
+
else if (stop) {
|
|
5448
5505
|
const planType = this.safeString(params, 'planType', 'normal_plan');
|
|
5449
5506
|
request['planType'] = planType;
|
|
5450
5507
|
response = await this.privateMixGetV2MixOrderOrdersPlanHistory(this.extend(request, params));
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -2125,7 +2125,7 @@ class bitmart extends bitmart$1 {
|
|
|
2125
2125
|
if (priceString === 'market price') {
|
|
2126
2126
|
priceString = undefined;
|
|
2127
2127
|
}
|
|
2128
|
-
const
|
|
2128
|
+
const trailingActivationPrice = this.safeNumber(order, 'activation_price');
|
|
2129
2129
|
return this.safeOrder({
|
|
2130
2130
|
'id': id,
|
|
2131
2131
|
'clientOrderId': this.safeString(order, 'client_order_id'),
|
|
@@ -2139,8 +2139,8 @@ class bitmart extends bitmart$1 {
|
|
|
2139
2139
|
'postOnly': postOnly,
|
|
2140
2140
|
'side': this.parseOrderSide(this.safeString(order, 'side')),
|
|
2141
2141
|
'price': this.omitZero(priceString),
|
|
2142
|
-
'stopPrice':
|
|
2143
|
-
'triggerPrice':
|
|
2142
|
+
'stopPrice': trailingActivationPrice,
|
|
2143
|
+
'triggerPrice': trailingActivationPrice,
|
|
2144
2144
|
'amount': this.omitZero(this.safeString(order, 'size')),
|
|
2145
2145
|
'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
|
|
2146
2146
|
'average': this.safeStringN(order, ['price_avg', 'priceAvg', 'deal_avg_price']),
|
|
@@ -2212,6 +2212,7 @@ class bitmart extends bitmart$1 {
|
|
|
2212
2212
|
* @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
|
2213
2213
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2214
2214
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2215
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2215
2216
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2216
2217
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
2217
2218
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2223,12 +2224,20 @@ class bitmart extends bitmart$1 {
|
|
|
2223
2224
|
* @param {string} [params.clientOrderId] client order id of the order
|
|
2224
2225
|
* @param {boolean} [params.reduceOnly] *swap only* reduce only
|
|
2225
2226
|
* @param {boolean} [params.postOnly] make sure the order is posted to the order book and not matched immediately
|
|
2227
|
+
* @param {string} [params.triggerPrice] *swap only* the price to trigger a stop order
|
|
2228
|
+
* @param {int} [params.price_type] *swap only* 1: last price, 2: fair price, default is 1
|
|
2229
|
+
* @param {int} [params.price_way] *swap only* 1: price way long, 2: price way short
|
|
2230
|
+
* @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
|
|
2231
|
+
* @param {string} [params.trailingPercent] *swap only* the percent to trail away from the current market price, min 0.1 max 5
|
|
2232
|
+
* @param {string} [params.trailingTriggerPrice] *swap only* the price to trigger a trailing order, default uses the price argument
|
|
2226
2233
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2227
2234
|
*/
|
|
2228
2235
|
await this.loadMarkets();
|
|
2229
2236
|
const market = this.market(symbol);
|
|
2230
2237
|
const result = this.handleMarginModeAndParams('createOrder', params);
|
|
2231
2238
|
const marginMode = this.safeString(result, 0);
|
|
2239
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
2240
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
2232
2241
|
let response = undefined;
|
|
2233
2242
|
if (market['spot']) {
|
|
2234
2243
|
const spotRequest = this.createSpotOrderRequest(symbol, type, side, amount, price, params);
|
|
@@ -2241,7 +2250,12 @@ class bitmart extends bitmart$1 {
|
|
|
2241
2250
|
}
|
|
2242
2251
|
else {
|
|
2243
2252
|
const swapRequest = this.createSwapOrderRequest(symbol, type, side, amount, price, params);
|
|
2244
|
-
|
|
2253
|
+
if (isTriggerOrder) {
|
|
2254
|
+
response = await this.privatePostContractPrivateSubmitPlanOrder(swapRequest);
|
|
2255
|
+
}
|
|
2256
|
+
else {
|
|
2257
|
+
response = await this.privatePostContractPrivateSubmitOrder(swapRequest);
|
|
2258
|
+
}
|
|
2245
2259
|
}
|
|
2246
2260
|
//
|
|
2247
2261
|
// spot and margin
|
|
@@ -2273,6 +2287,7 @@ class bitmart extends bitmart$1 {
|
|
|
2273
2287
|
* @ignore
|
|
2274
2288
|
* @description create a trade order
|
|
2275
2289
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2290
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2276
2291
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2277
2292
|
* @param {string} type 'market', 'limit' or 'trailing'
|
|
2278
2293
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2283,8 +2298,12 @@ class bitmart extends bitmart$1 {
|
|
|
2283
2298
|
* @param {boolean} [params.reduceOnly] *swap only* reduce only
|
|
2284
2299
|
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
|
|
2285
2300
|
* @param {string} [params.clientOrderId] client order id of the order
|
|
2301
|
+
* @param {string} [params.triggerPrice] *swap only* the price to trigger a stop order
|
|
2302
|
+
* @param {int} [params.price_type] *swap only* 1: last price, 2: fair price, default is 1
|
|
2303
|
+
* @param {int} [params.price_way] *swap only* 1: price way long, 2: price way short
|
|
2286
2304
|
* @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
|
|
2287
|
-
* @param {string} [params.
|
|
2305
|
+
* @param {string} [params.trailingPercent] *swap only* the percent to trail away from the current market price, min 0.1 max 5
|
|
2306
|
+
* @param {string} [params.trailingTriggerPrice] *swap only* the price to trigger a trailing order, default uses the price argument
|
|
2288
2307
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2289
2308
|
*/
|
|
2290
2309
|
const market = this.market(symbol);
|
|
@@ -2297,10 +2316,9 @@ class bitmart extends bitmart$1 {
|
|
|
2297
2316
|
const mode = this.safeInteger(params, 'mode'); // only for swap
|
|
2298
2317
|
const isMarketOrder = type === 'market';
|
|
2299
2318
|
let postOnly = undefined;
|
|
2300
|
-
|
|
2319
|
+
const reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
2301
2320
|
const isExchangeSpecificPo = (mode === 4);
|
|
2302
2321
|
[postOnly, params] = this.handlePostOnly(isMarketOrder, isExchangeSpecificPo, params);
|
|
2303
|
-
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly']);
|
|
2304
2322
|
const ioc = ((timeInForce === 'IOC') || (mode === 3));
|
|
2305
2323
|
const isLimitOrder = (type === 'limit') || postOnly || ioc;
|
|
2306
2324
|
if (timeInForce === 'GTC') {
|
|
@@ -2315,14 +2333,39 @@ class bitmart extends bitmart$1 {
|
|
|
2315
2333
|
if (postOnly) {
|
|
2316
2334
|
request['mode'] = 4;
|
|
2317
2335
|
}
|
|
2336
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
2337
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
2338
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activation_price', price);
|
|
2339
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callback_rate');
|
|
2340
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
2318
2341
|
if (isLimitOrder) {
|
|
2319
2342
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
2320
2343
|
}
|
|
2321
|
-
else if (type === 'trailing') {
|
|
2322
|
-
|
|
2323
|
-
request['activation_price'] = this.priceToPrecision(symbol,
|
|
2344
|
+
else if (type === 'trailing' || isTrailingPercentOrder) {
|
|
2345
|
+
request['callback_rate'] = trailingPercent;
|
|
2346
|
+
request['activation_price'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
2324
2347
|
request['activation_price_type'] = this.safeInteger(params, 'activation_price_type', 1);
|
|
2325
|
-
|
|
2348
|
+
}
|
|
2349
|
+
if (isTriggerOrder) {
|
|
2350
|
+
request['executive_price'] = this.priceToPrecision(symbol, price);
|
|
2351
|
+
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
2352
|
+
request['price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
2353
|
+
if (side === 'buy') {
|
|
2354
|
+
if (reduceOnly) {
|
|
2355
|
+
request['price_way'] = 2;
|
|
2356
|
+
}
|
|
2357
|
+
else {
|
|
2358
|
+
request['price_way'] = 1;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
else if (side === 'sell') {
|
|
2362
|
+
if (reduceOnly) {
|
|
2363
|
+
request['price_way'] = 1;
|
|
2364
|
+
}
|
|
2365
|
+
else {
|
|
2366
|
+
request['price_way'] = 2;
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2326
2369
|
}
|
|
2327
2370
|
if (side === 'buy') {
|
|
2328
2371
|
if (reduceOnly) {
|
|
@@ -2349,7 +2392,7 @@ class bitmart extends bitmart$1 {
|
|
|
2349
2392
|
request['client_order_id'] = clientOrderId;
|
|
2350
2393
|
}
|
|
2351
2394
|
const leverage = this.safeInteger(params, 'leverage', 1);
|
|
2352
|
-
params = this.omit(params, 'leverage');
|
|
2395
|
+
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
|
|
2353
2396
|
request['leverage'] = this.numberToString(leverage);
|
|
2354
2397
|
return this.extend(request, params);
|
|
2355
2398
|
}
|
|
@@ -2431,10 +2474,11 @@ class bitmart extends bitmart$1 {
|
|
|
2431
2474
|
/**
|
|
2432
2475
|
* @method
|
|
2433
2476
|
* @name bitmart#cancelOrder
|
|
2477
|
+
* @description cancels an open order
|
|
2434
2478
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
|
2435
2479
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
|
2436
2480
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2437
|
-
* @
|
|
2481
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2438
2482
|
* @param {string} id order id
|
|
2439
2483
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2440
2484
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2644,6 +2688,7 @@ class bitmart extends bitmart$1 {
|
|
|
2644
2688
|
* @param {string} [params.type] *swap* order type, 'limit' or 'market'
|
|
2645
2689
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
2646
2690
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
2691
|
+
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
|
|
2647
2692
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2648
2693
|
*/
|
|
2649
2694
|
await this.loadMarkets();
|
|
@@ -2676,8 +2721,12 @@ class bitmart extends bitmart$1 {
|
|
|
2676
2721
|
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
2677
2722
|
}
|
|
2678
2723
|
else if (type === 'swap') {
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2724
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
2725
|
+
let orderType = this.safeString(params, 'orderType');
|
|
2726
|
+
params = this.omit(params, ['orderType', 'trailing']);
|
|
2727
|
+
if (trailing) {
|
|
2728
|
+
orderType = 'trailing';
|
|
2729
|
+
}
|
|
2681
2730
|
if (orderType !== undefined) {
|
|
2682
2731
|
request['type'] = orderType;
|
|
2683
2732
|
}
|
|
@@ -2823,6 +2872,7 @@ class bitmart extends bitmart$1 {
|
|
|
2823
2872
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2824
2873
|
* @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
|
|
2825
2874
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
|
|
2875
|
+
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
|
|
2826
2876
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2827
2877
|
*/
|
|
2828
2878
|
await this.loadMarkets();
|
|
@@ -2850,8 +2900,12 @@ class bitmart extends bitmart$1 {
|
|
|
2850
2900
|
if (symbol === undefined) {
|
|
2851
2901
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
2852
2902
|
}
|
|
2853
|
-
const
|
|
2854
|
-
|
|
2903
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
2904
|
+
let orderType = this.safeString(params, 'orderType');
|
|
2905
|
+
params = this.omit(params, ['orderType', 'trailing']);
|
|
2906
|
+
if (trailing) {
|
|
2907
|
+
orderType = 'trailing';
|
|
2908
|
+
}
|
|
2855
2909
|
if (orderType !== undefined) {
|
|
2856
2910
|
request['type'] = orderType;
|
|
2857
2911
|
}
|
package/dist/cjs/src/bitvavo.js
CHANGED
|
@@ -989,7 +989,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
989
989
|
* @method
|
|
990
990
|
* @name bitvavo#createOrder
|
|
991
991
|
* @description create a trade order
|
|
992
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
992
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
|
|
993
993
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
994
994
|
* @param {string} type 'market' or 'limit'
|
|
995
995
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -1007,6 +1007,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1007
1007
|
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1008
1008
|
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
1009
1009
|
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1010
|
+
* @param {string} [params.clientOrderId] An ID supplied by the client that must be unique among all open orders for the same market
|
|
1010
1011
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1011
1012
|
*/
|
|
1012
1013
|
await this.loadMarkets();
|
|
@@ -1117,25 +1118,54 @@ class bitvavo extends bitvavo$1 {
|
|
|
1117
1118
|
return this.parseOrder(response, market);
|
|
1118
1119
|
}
|
|
1119
1120
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1121
|
+
/**
|
|
1122
|
+
* @method
|
|
1123
|
+
* @name bitvavo#editOrder
|
|
1124
|
+
* @description edit a trade order
|
|
1125
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/put
|
|
1126
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1127
|
+
* @param {string} type 'market' or 'limit'
|
|
1128
|
+
* @param {string} side 'buy' or 'sell'
|
|
1129
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1130
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1131
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1132
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1133
|
+
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1134
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1135
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1136
|
+
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1137
|
+
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1138
|
+
* @param {string} [params.clientOrderId] An ID supplied by the client
|
|
1139
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1140
|
+
*/
|
|
1120
1141
|
await this.loadMarkets();
|
|
1121
1142
|
const market = this.market(symbol);
|
|
1122
|
-
|
|
1143
|
+
const request = {
|
|
1144
|
+
'market': market['id'],
|
|
1145
|
+
};
|
|
1146
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1147
|
+
if (clientOrderId === undefined) {
|
|
1148
|
+
request['orderId'] = id;
|
|
1149
|
+
}
|
|
1123
1150
|
const amountRemaining = this.safeNumber(params, 'amountRemaining');
|
|
1124
|
-
|
|
1151
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1152
|
+
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1153
|
+
let updateRequest = {};
|
|
1125
1154
|
if (price !== undefined) {
|
|
1126
|
-
|
|
1155
|
+
updateRequest['price'] = this.priceToPrecision(symbol, price);
|
|
1127
1156
|
}
|
|
1128
1157
|
if (amount !== undefined) {
|
|
1129
|
-
|
|
1158
|
+
updateRequest['amount'] = this.amountToPrecision(symbol, amount);
|
|
1130
1159
|
}
|
|
1131
1160
|
if (amountRemaining !== undefined) {
|
|
1132
|
-
|
|
1161
|
+
updateRequest['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
1133
1162
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1163
|
+
if (triggerPrice !== undefined) {
|
|
1164
|
+
updateRequest['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1165
|
+
}
|
|
1166
|
+
updateRequest = this.extend(updateRequest, params);
|
|
1167
|
+
if (Object.keys(updateRequest).length) {
|
|
1168
|
+
const response = await this.privatePutOrder(this.extend(request, updateRequest));
|
|
1139
1169
|
return this.parseOrder(response, market);
|
|
1140
1170
|
}
|
|
1141
1171
|
else {
|
|
@@ -1147,6 +1177,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1147
1177
|
* @method
|
|
1148
1178
|
* @name bitvavo#cancelOrder
|
|
1149
1179
|
* @description cancels an open order
|
|
1180
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
|
|
1150
1181
|
* @param {string} id order id
|
|
1151
1182
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1152
1183
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1158,9 +1189,12 @@ class bitvavo extends bitvavo$1 {
|
|
|
1158
1189
|
await this.loadMarkets();
|
|
1159
1190
|
const market = this.market(symbol);
|
|
1160
1191
|
const request = {
|
|
1161
|
-
'orderId': id,
|
|
1162
1192
|
'market': market['id'],
|
|
1163
1193
|
};
|
|
1194
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1195
|
+
if (clientOrderId === undefined) {
|
|
1196
|
+
request['orderId'] = id;
|
|
1197
|
+
}
|
|
1164
1198
|
const response = await this.privateDeleteOrder(this.extend(request, params));
|
|
1165
1199
|
//
|
|
1166
1200
|
// {
|
|
@@ -1200,6 +1234,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1200
1234
|
* @method
|
|
1201
1235
|
* @name bitvavo#fetchOrder
|
|
1202
1236
|
* @description fetches information on an order made by the user
|
|
1237
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/get
|
|
1203
1238
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1204
1239
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1205
1240
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1210,9 +1245,12 @@ class bitvavo extends bitvavo$1 {
|
|
|
1210
1245
|
await this.loadMarkets();
|
|
1211
1246
|
const market = this.market(symbol);
|
|
1212
1247
|
const request = {
|
|
1213
|
-
'orderId': id,
|
|
1214
1248
|
'market': market['id'],
|
|
1215
1249
|
};
|
|
1250
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1251
|
+
if (clientOrderId === undefined) {
|
|
1252
|
+
request['orderId'] = id;
|
|
1253
|
+
}
|
|
1216
1254
|
const response = await this.privateGetOrder(this.extend(request, params));
|
|
1217
1255
|
//
|
|
1218
1256
|
// {
|
|
@@ -1254,7 +1292,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1254
1292
|
/**
|
|
1255
1293
|
* @method
|
|
1256
1294
|
* @name bitvavo#fetchOrders
|
|
1257
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
1295
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1orders/get
|
|
1258
1296
|
* @description fetches information on multiple orders made by the user
|
|
1259
1297
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1260
1298
|
* @param {int} [since] the earliest time in ms to fetch orders for
|