ccxt 4.5.45 → 4.5.46
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/binance.js +11 -2
- package/dist/cjs/src/bitget.js +3 -1
- package/dist/cjs/src/bitmart.js +144 -21
- package/dist/cjs/src/bybit.js +58 -56
- package/dist/cjs/src/bydfi.js +102 -100
- package/dist/cjs/src/gate.js +37 -2
- package/dist/cjs/src/kraken.js +2 -0
- package/dist/cjs/src/kucoin.js +4 -2
- package/dist/cjs/src/okx.js +75 -57
- package/dist/cjs/src/paradex.js +2 -6
- package/dist/cjs/src/pro/bydfi.js +19 -19
- package/dist/cjs/src/pro/gate.js +79 -54
- package/dist/cjs/src/pro/grvt.js +5 -3
- package/dist/cjs/src/pro/htx.js +4 -4
- package/dist/cjs/src/pro/okx.js +1 -1
- package/index.d.cts +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +7 -0
- package/js/src/abstract/bydfi.d.ts +29 -29
- package/js/src/abstract/kraken.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -0
- package/js/src/binance.js +11 -2
- package/js/src/bitget.js +3 -1
- package/js/src/bitmart.d.ts +18 -4
- package/js/src/bitmart.js +144 -21
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +58 -56
- package/js/src/bydfi.d.ts +31 -31
- package/js/src/bydfi.js +102 -100
- package/js/src/gate.js +37 -2
- package/js/src/kraken.js +2 -0
- package/js/src/kucoin.js +4 -2
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +75 -57
- package/js/src/paradex.d.ts +0 -1
- package/js/src/paradex.js +2 -6
- package/js/src/pro/bydfi.d.ts +18 -18
- package/js/src/pro/bydfi.js +19 -19
- package/js/src/pro/gate.d.ts +2 -2
- package/js/src/pro/gate.js +79 -54
- package/js/src/pro/grvt.js +5 -3
- package/js/src/pro/htx.js +4 -4
- package/js/src/pro/okx.js +1 -1
- package/package.json +2 -2
package/js/src/bitmart.js
CHANGED
|
@@ -239,6 +239,13 @@ export default class bitmart extends Exchange {
|
|
|
239
239
|
'spot/v4/cancel_orders': 3,
|
|
240
240
|
'spot/v4/cancel_all': 90,
|
|
241
241
|
'spot/v4/batch_orders': 3,
|
|
242
|
+
'spot/v4/algo/submit_order': 6,
|
|
243
|
+
'spot/v4/algo/cancel_order': 6,
|
|
244
|
+
'spot/v4/algo/cancel_all': 12,
|
|
245
|
+
'spot/v4/query/algo/order': 1.5,
|
|
246
|
+
'spot/v4/query/algo/client-order': 1.5,
|
|
247
|
+
'spot/v4/query/algo/open-orders': 3,
|
|
248
|
+
'spot/v4/query/algo/history-orders': 3,
|
|
242
249
|
// newer endpoint
|
|
243
250
|
'spot/v3/cancel_order': 1,
|
|
244
251
|
'spot/v2/batch_orders': 1,
|
|
@@ -926,7 +933,7 @@ export default class bitmart extends Exchange {
|
|
|
926
933
|
if (type === 'swap') {
|
|
927
934
|
type = 'contract';
|
|
928
935
|
}
|
|
929
|
-
const service = this.
|
|
936
|
+
const service = this.safeDict(servicesByType, type);
|
|
930
937
|
let status = undefined;
|
|
931
938
|
let eta = undefined;
|
|
932
939
|
if (service !== undefined) {
|
|
@@ -2764,6 +2771,7 @@ export default class bitmart extends Exchange {
|
|
|
2764
2771
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2765
2772
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed
|
|
2766
2773
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed
|
|
2774
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-algo-order-v4-signed
|
|
2767
2775
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2768
2776
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
2769
2777
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2801,7 +2809,10 @@ export default class bitmart extends Exchange {
|
|
|
2801
2809
|
let response = undefined;
|
|
2802
2810
|
if (market['spot']) {
|
|
2803
2811
|
const spotRequest = this.createSpotOrderRequest(symbol, type, side, amount, price, params);
|
|
2804
|
-
if (
|
|
2812
|
+
if (isStopLoss || isTakeProfit || isTriggerOrder) {
|
|
2813
|
+
response = await this.privatePostSpotV4AlgoSubmitOrder(spotRequest);
|
|
2814
|
+
}
|
|
2815
|
+
else if (marginMode === 'isolated') {
|
|
2805
2816
|
response = await this.privatePostSpotV1MarginSubmitOrder(spotRequest);
|
|
2806
2817
|
}
|
|
2807
2818
|
else {
|
|
@@ -3081,6 +3092,7 @@ export default class bitmart extends Exchange {
|
|
|
3081
3092
|
* @description create a spot order request
|
|
3082
3093
|
* @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
|
3083
3094
|
* @see https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed
|
|
3095
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-algo-order-v4-signed
|
|
3084
3096
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
3085
3097
|
* @param {string} type 'market' or 'limit'
|
|
3086
3098
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -3088,13 +3100,23 @@ export default class bitmart extends Exchange {
|
|
|
3088
3100
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3089
3101
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3090
3102
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
3103
|
+
* @param {string} [params.clientOrderId] client order id of the order
|
|
3104
|
+
* @param {string} [params.triggerPrice] the price to trigger a stop order
|
|
3105
|
+
* @param {string} [params.stopLossPrice] the price to trigger a stop-loss order
|
|
3106
|
+
* @param {string} [params.takeProfitPrice] the price to trigger a take-profit order
|
|
3091
3107
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3092
3108
|
*/
|
|
3093
3109
|
const market = this.market(symbol);
|
|
3110
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
3111
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
3112
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
3113
|
+
const isStopLoss = stopLossPrice !== undefined;
|
|
3114
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
3115
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
3116
|
+
const isAlgoOrder = isStopLoss || isTakeProfit || isTriggerOrder;
|
|
3094
3117
|
const request = {
|
|
3095
3118
|
'symbol': market['id'],
|
|
3096
3119
|
'side': side,
|
|
3097
|
-
'type': type,
|
|
3098
3120
|
};
|
|
3099
3121
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
3100
3122
|
if (timeInForce === 'FOK') {
|
|
@@ -3108,7 +3130,32 @@ export default class bitmart extends Exchange {
|
|
|
3108
3130
|
params = this.omit(params, ['timeInForce', 'postOnly']);
|
|
3109
3131
|
const ioc = ((timeInForce === 'IOC') || (type === 'ioc'));
|
|
3110
3132
|
const isLimitOrder = (type === 'limit') || postOnly || ioc;
|
|
3111
|
-
|
|
3133
|
+
if (isAlgoOrder) {
|
|
3134
|
+
if (isTriggerOrder) {
|
|
3135
|
+
request['type'] = 'trigger';
|
|
3136
|
+
}
|
|
3137
|
+
else {
|
|
3138
|
+
request['type'] = 'tp/sl';
|
|
3139
|
+
}
|
|
3140
|
+
if (isLimitOrder) {
|
|
3141
|
+
request['trigger_type'] = 'limit';
|
|
3142
|
+
}
|
|
3143
|
+
else {
|
|
3144
|
+
request['trigger_type'] = 'market';
|
|
3145
|
+
}
|
|
3146
|
+
if (isStopLoss) {
|
|
3147
|
+
request['trigger_price'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
3148
|
+
}
|
|
3149
|
+
else if (isTakeProfit) {
|
|
3150
|
+
request['trigger_price'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
3151
|
+
}
|
|
3152
|
+
else if (isTriggerOrder) {
|
|
3153
|
+
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
else {
|
|
3157
|
+
request['type'] = type;
|
|
3158
|
+
}
|
|
3112
3159
|
if (isLimitOrder) {
|
|
3113
3160
|
request['size'] = this.amountToPrecision(symbol, amount);
|
|
3114
3161
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -3161,12 +3208,14 @@ export default class bitmart extends Exchange {
|
|
|
3161
3208
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-plan-order-signed
|
|
3162
3209
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed
|
|
3163
3210
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-trail-order-signed
|
|
3211
|
+
* @see https://developer-pro.bitmart.com/en/spot/#cancel-algo-order-v4-signed
|
|
3164
3212
|
* @param {string} id order id
|
|
3165
3213
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3166
3214
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3167
3215
|
* @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
|
|
3168
|
-
* @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
|
|
3169
3216
|
* @param {boolean} [params.trailing] *swap only* whether the order is a stop order
|
|
3217
|
+
* @param {boolean} [params.trigger] whether the order is a trigger order
|
|
3218
|
+
* @param {boolean} [params.stopLossTakeProfit] whether the order is a stopLossPrice or takeProfitPrice order
|
|
3170
3219
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3171
3220
|
*/
|
|
3172
3221
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -3185,15 +3234,26 @@ export default class bitmart extends Exchange {
|
|
|
3185
3234
|
else {
|
|
3186
3235
|
request['order_id'] = id.toString();
|
|
3187
3236
|
}
|
|
3188
|
-
|
|
3237
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3238
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3239
|
+
const trailing = this.safeBool(params, 'trailing');
|
|
3240
|
+
params = this.omit(params, ['clientOrderId', 'stop', 'trigger', 'trailing', 'stopLossTakeProfit']);
|
|
3189
3241
|
let response = undefined;
|
|
3190
3242
|
if (market['spot']) {
|
|
3191
|
-
|
|
3243
|
+
if (trigger || stopLossTakeProfit) {
|
|
3244
|
+
if (stopLossTakeProfit) {
|
|
3245
|
+
request['type'] = 'tp/sl';
|
|
3246
|
+
}
|
|
3247
|
+
else if (trigger) {
|
|
3248
|
+
request['type'] = 'trigger';
|
|
3249
|
+
}
|
|
3250
|
+
response = await this.privatePostSpotV4AlgoCancelOrder(this.extend(request, params));
|
|
3251
|
+
}
|
|
3252
|
+
else {
|
|
3253
|
+
response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
|
|
3254
|
+
}
|
|
3192
3255
|
}
|
|
3193
3256
|
else {
|
|
3194
|
-
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3195
|
-
const trailing = this.safeBool(params, 'trailing');
|
|
3196
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
3197
3257
|
if (trigger) {
|
|
3198
3258
|
response = await this.privatePostContractPrivateCancelPlanOrder(this.extend(request, params));
|
|
3199
3259
|
}
|
|
@@ -3318,9 +3378,12 @@ export default class bitmart extends Exchange {
|
|
|
3318
3378
|
* @description cancel all open orders in a market
|
|
3319
3379
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-order-v4-signed
|
|
3320
3380
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
|
3381
|
+
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-algo-order-v4-signed
|
|
3321
3382
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
3322
3383
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3323
3384
|
* @param {string} [params.side] *spot only* 'buy' or 'sell'
|
|
3385
|
+
* @param {boolean} [params.trigger] whether the orders are trigger orders
|
|
3386
|
+
* @param {boolean} [params.stopLossTakeProfit] whether the orders are stopLossPrice or takeProfitPrice orders
|
|
3324
3387
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3325
3388
|
*/
|
|
3326
3389
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -3335,7 +3398,21 @@ export default class bitmart extends Exchange {
|
|
|
3335
3398
|
let type = undefined;
|
|
3336
3399
|
[type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
3337
3400
|
if (type === 'spot') {
|
|
3338
|
-
|
|
3401
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3402
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3403
|
+
params = this.omit(params, ['stop', 'trigger', 'stopLossTakeProfit']);
|
|
3404
|
+
if (trigger || stopLossTakeProfit) {
|
|
3405
|
+
if (stopLossTakeProfit) {
|
|
3406
|
+
request['type'] = 'tp/sl';
|
|
3407
|
+
}
|
|
3408
|
+
else if (trigger) {
|
|
3409
|
+
request['type'] = 'trigger';
|
|
3410
|
+
}
|
|
3411
|
+
response = await this.privatePostSpotV4AlgoCancelAll(this.extend(request, params));
|
|
3412
|
+
}
|
|
3413
|
+
else {
|
|
3414
|
+
response = await this.privatePostSpotV4CancelAll(this.extend(request, params));
|
|
3415
|
+
}
|
|
3339
3416
|
}
|
|
3340
3417
|
else if (type === 'swap') {
|
|
3341
3418
|
if (symbol === undefined) {
|
|
@@ -3425,10 +3502,11 @@ export default class bitmart extends Exchange {
|
|
|
3425
3502
|
/**
|
|
3426
3503
|
* @method
|
|
3427
3504
|
* @name bitmart#fetchOpenOrders
|
|
3505
|
+
* @description fetch all unfilled currently open orders
|
|
3428
3506
|
* @see https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
|
3429
3507
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-all-open-orders-keyed
|
|
3430
3508
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-all-current-plan-orders-keyed
|
|
3431
|
-
* @
|
|
3509
|
+
* @see https://developer-pro.bitmart.com/en/spot/#current-algo-open-orders-v4-signed
|
|
3432
3510
|
* @param {string} symbol unified market symbol
|
|
3433
3511
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3434
3512
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -3439,7 +3517,8 @@ export default class bitmart extends Exchange {
|
|
|
3439
3517
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
3440
3518
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
3441
3519
|
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
|
|
3442
|
-
* @param {boolean} [params.trigger]
|
|
3520
|
+
* @param {boolean} [params.trigger] set to true if you want to fetch trigger orders
|
|
3521
|
+
* @param {boolean} [params.stopLossTakeProfit] set to true if you want to fetch stopLossPrice or takeProfitPrice orders
|
|
3443
3522
|
* @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
|
3444
3523
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3445
3524
|
*/
|
|
@@ -3454,6 +3533,9 @@ export default class bitmart extends Exchange {
|
|
|
3454
3533
|
let type = undefined;
|
|
3455
3534
|
let response = undefined;
|
|
3456
3535
|
[type, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
3536
|
+
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3537
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3538
|
+
params = this.omit(params, ['stop', 'trigger', 'stopLossTakeProfit']);
|
|
3457
3539
|
if (type === 'spot') {
|
|
3458
3540
|
if (limit !== undefined) {
|
|
3459
3541
|
request['limit'] = Math.min(limit, 200);
|
|
@@ -3471,14 +3553,23 @@ export default class bitmart extends Exchange {
|
|
|
3471
3553
|
params = this.omit(params, ['endTime']);
|
|
3472
3554
|
request['endTime'] = until;
|
|
3473
3555
|
}
|
|
3474
|
-
|
|
3556
|
+
if (isTrigger || stopLossTakeProfit) {
|
|
3557
|
+
if (isTrigger) {
|
|
3558
|
+
request['orderMode'] = 'trigger';
|
|
3559
|
+
}
|
|
3560
|
+
else if (stopLossTakeProfit) {
|
|
3561
|
+
request['orderMode'] = 'tp/sl';
|
|
3562
|
+
}
|
|
3563
|
+
response = await this.privatePostSpotV4QueryAlgoOpenOrders(this.extend(request, params));
|
|
3564
|
+
}
|
|
3565
|
+
else {
|
|
3566
|
+
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
3567
|
+
}
|
|
3475
3568
|
}
|
|
3476
3569
|
else if (type === 'swap') {
|
|
3477
3570
|
if (limit !== undefined) {
|
|
3478
3571
|
request['limit'] = Math.min(limit, 100);
|
|
3479
3572
|
}
|
|
3480
|
-
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3481
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
3482
3573
|
if (isTrigger) {
|
|
3483
3574
|
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
3484
3575
|
}
|
|
@@ -3558,9 +3649,10 @@ export default class bitmart extends Exchange {
|
|
|
3558
3649
|
/**
|
|
3559
3650
|
* @method
|
|
3560
3651
|
* @name bitmart#fetchClosedOrders
|
|
3652
|
+
* @description fetches information on multiple closed orders made by the user
|
|
3561
3653
|
* @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
|
3562
3654
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
|
3563
|
-
* @
|
|
3655
|
+
* @see https://developer-pro.bitmart.com/en/spot/#account-algo-orders-v4-signed
|
|
3564
3656
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3565
3657
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3566
3658
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -3568,6 +3660,8 @@ export default class bitmart extends Exchange {
|
|
|
3568
3660
|
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
3569
3661
|
* @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
|
|
3570
3662
|
* @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
|
3663
|
+
* @param {boolean} [params.trigger] set to true if you want to fetch trigger orders
|
|
3664
|
+
* @param {boolean} [params.stopLossTakeProfit] set to true if you want to fetch stopLossPrice or takeProfitPrice orders
|
|
3571
3665
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3572
3666
|
*/
|
|
3573
3667
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -3595,6 +3689,9 @@ export default class bitmart extends Exchange {
|
|
|
3595
3689
|
params = this.omit(params, ['until']);
|
|
3596
3690
|
request[endTimeKey] = until;
|
|
3597
3691
|
}
|
|
3692
|
+
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3693
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3694
|
+
params = this.omit(params, ['stop', 'trigger', 'stopLossTakeProfit']);
|
|
3598
3695
|
let response = undefined;
|
|
3599
3696
|
if (type === 'spot') {
|
|
3600
3697
|
let marginMode = undefined;
|
|
@@ -3602,7 +3699,18 @@ export default class bitmart extends Exchange {
|
|
|
3602
3699
|
if (marginMode === 'isolated') {
|
|
3603
3700
|
request['orderMode'] = 'iso_margin';
|
|
3604
3701
|
}
|
|
3605
|
-
|
|
3702
|
+
if (isTrigger || stopLossTakeProfit) {
|
|
3703
|
+
if (isTrigger) {
|
|
3704
|
+
request['orderMode'] = 'trigger';
|
|
3705
|
+
}
|
|
3706
|
+
else if (stopLossTakeProfit) {
|
|
3707
|
+
request['orderMode'] = 'tp/sl';
|
|
3708
|
+
}
|
|
3709
|
+
response = await this.privatePostSpotV4QueryAlgoHistoryOrders(this.extend(request, params));
|
|
3710
|
+
}
|
|
3711
|
+
else {
|
|
3712
|
+
response = await this.privatePostSpotV4QueryHistoryOrders(this.extend(request, params));
|
|
3713
|
+
}
|
|
3606
3714
|
}
|
|
3607
3715
|
else {
|
|
3608
3716
|
response = await this.privateGetContractPrivateOrderHistory(this.extend(request, params));
|
|
@@ -3630,6 +3738,8 @@ export default class bitmart extends Exchange {
|
|
|
3630
3738
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
|
3631
3739
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
|
3632
3740
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
|
3741
|
+
* @see https://developer-pro.bitmart.com/en/spot/#query-algo-order-by-id-v4-signed
|
|
3742
|
+
* @see https://developer-pro.bitmart.com/en/spot/#query-algo-order-by-clientorderid-v4-signed
|
|
3633
3743
|
* @param {string} id the id of the order
|
|
3634
3744
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3635
3745
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3637,6 +3747,7 @@ export default class bitmart extends Exchange {
|
|
|
3637
3747
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
|
|
3638
3748
|
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
|
|
3639
3749
|
* @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
|
3750
|
+
* @param {boolean} [params.trigger] whether the orders is a trigger, stopLossPrice or takeProfitPrice order
|
|
3640
3751
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3641
3752
|
*/
|
|
3642
3753
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -3651,14 +3762,26 @@ export default class bitmart extends Exchange {
|
|
|
3651
3762
|
[type, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
3652
3763
|
if (type === 'spot') {
|
|
3653
3764
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
3765
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3766
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
3654
3767
|
if (!clientOrderId) {
|
|
3655
3768
|
request['orderId'] = id;
|
|
3656
3769
|
}
|
|
3657
|
-
if (
|
|
3658
|
-
|
|
3770
|
+
if (trigger) {
|
|
3771
|
+
if (clientOrderId !== undefined) {
|
|
3772
|
+
response = await this.privatePostSpotV4QueryAlgoClientOrder(this.extend(request, params));
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
response = await this.privatePostSpotV4QueryAlgoOrder(this.extend(request, params));
|
|
3776
|
+
}
|
|
3659
3777
|
}
|
|
3660
3778
|
else {
|
|
3661
|
-
|
|
3779
|
+
if (clientOrderId !== undefined) {
|
|
3780
|
+
response = await this.privatePostSpotV4QueryClientOrder(this.extend(request, params));
|
|
3781
|
+
}
|
|
3782
|
+
else {
|
|
3783
|
+
response = await this.privatePostSpotV4QueryOrder(this.extend(request, params));
|
|
3784
|
+
}
|
|
3662
3785
|
}
|
|
3663
3786
|
}
|
|
3664
3787
|
else if (type === 'swap') {
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export default class bybit extends Exchange {
|
|
|
59
59
|
* @returns {object} an associative dictionary of currencies
|
|
60
60
|
*/
|
|
61
61
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
62
|
+
parseCurrency(currency: Dict): Currency;
|
|
62
63
|
/**
|
|
63
64
|
* @method
|
|
64
65
|
* @name bybit#fetchMarkets
|
package/js/src/bybit.js
CHANGED
|
@@ -1125,8 +1125,12 @@ export default class bybit extends Exchange {
|
|
|
1125
1125
|
'FUND': 'fund',
|
|
1126
1126
|
},
|
|
1127
1127
|
'networks': {
|
|
1128
|
+
'BTC': 'BTC',
|
|
1129
|
+
'ETH': 'ETH',
|
|
1128
1130
|
'ERC20': 'ETH',
|
|
1131
|
+
'TRX': 'TRX',
|
|
1129
1132
|
'TRC20': 'TRX',
|
|
1133
|
+
'BSC': 'BSC',
|
|
1130
1134
|
'BEP20': 'BSC',
|
|
1131
1135
|
'SOL': 'SOL',
|
|
1132
1136
|
'ACA': 'ACA',
|
|
@@ -1175,6 +1179,7 @@ export default class bybit extends Exchange {
|
|
|
1175
1179
|
'OASIS': 'ROSE',
|
|
1176
1180
|
'OMNI': 'OMNI',
|
|
1177
1181
|
'ONE': 'ONE',
|
|
1182
|
+
'OP': 'OP',
|
|
1178
1183
|
'OPTIMISM': 'OP',
|
|
1179
1184
|
'POKT': 'POKT',
|
|
1180
1185
|
'QTUM': 'QTUM',
|
|
@@ -1205,8 +1210,7 @@ export default class bybit extends Exchange {
|
|
|
1205
1210
|
'ETH': 'ERC20',
|
|
1206
1211
|
'TRX': 'TRC20',
|
|
1207
1212
|
'BSC': 'BEP20',
|
|
1208
|
-
'
|
|
1209
|
-
'SPL': 'SOL',
|
|
1213
|
+
'OP': 'OP',
|
|
1210
1214
|
},
|
|
1211
1215
|
'defaultNetwork': 'ERC20',
|
|
1212
1216
|
'defaultNetworks': {
|
|
@@ -1702,68 +1706,66 @@ export default class bybit extends Exchange {
|
|
|
1702
1706
|
//
|
|
1703
1707
|
const data = this.safeDict(response, 'result', {});
|
|
1704
1708
|
const rows = this.safeList(data, 'rows', []);
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
'active': undefined,
|
|
1722
|
-
'deposit': this.safeInteger(chain, 'chainDeposit') === 1,
|
|
1723
|
-
'withdraw': this.safeInteger(chain, 'chainWithdraw') === 1,
|
|
1724
|
-
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
1725
|
-
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'minAccuracy'))),
|
|
1726
|
-
'limits': {
|
|
1727
|
-
'withdraw': {
|
|
1728
|
-
'min': this.safeNumber(chain, 'withdrawMin'),
|
|
1729
|
-
'max': undefined,
|
|
1730
|
-
},
|
|
1731
|
-
'deposit': {
|
|
1732
|
-
'min': this.safeNumber(chain, 'depositMin'),
|
|
1733
|
-
'max': undefined,
|
|
1734
|
-
},
|
|
1735
|
-
},
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
result[code] = this.safeCurrencyStructure({
|
|
1739
|
-
'info': currency,
|
|
1740
|
-
'code': code,
|
|
1741
|
-
'id': currencyId,
|
|
1742
|
-
'name': name,
|
|
1709
|
+
return this.parseCurrencies(rows);
|
|
1710
|
+
}
|
|
1711
|
+
parseCurrency(currency) {
|
|
1712
|
+
const currencyId = this.safeString(currency, 'coin');
|
|
1713
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
1714
|
+
const name = this.safeString(currency, 'name');
|
|
1715
|
+
const chains = this.safeList(currency, 'chains', []);
|
|
1716
|
+
const networks = {};
|
|
1717
|
+
for (let j = 0; j < chains.length; j++) {
|
|
1718
|
+
const chain = chains[j];
|
|
1719
|
+
const networkId = this.safeString(chain, 'chain');
|
|
1720
|
+
const networkCode = this.networkIdToCode(networkId, code);
|
|
1721
|
+
networks[networkCode] = {
|
|
1722
|
+
'info': chain,
|
|
1723
|
+
'id': networkId,
|
|
1724
|
+
'network': networkCode,
|
|
1743
1725
|
'active': undefined,
|
|
1744
|
-
'deposit':
|
|
1745
|
-
'withdraw':
|
|
1746
|
-
'fee':
|
|
1747
|
-
'precision':
|
|
1726
|
+
'deposit': this.safeInteger(chain, 'chainDeposit') === 1,
|
|
1727
|
+
'withdraw': this.safeInteger(chain, 'chainWithdraw') === 1,
|
|
1728
|
+
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
1729
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'minAccuracy'))),
|
|
1748
1730
|
'limits': {
|
|
1749
|
-
'amount': {
|
|
1750
|
-
'min': undefined,
|
|
1751
|
-
'max': undefined,
|
|
1752
|
-
},
|
|
1753
1731
|
'withdraw': {
|
|
1754
|
-
'min':
|
|
1732
|
+
'min': this.safeNumber(chain, 'withdrawMin'),
|
|
1755
1733
|
'max': undefined,
|
|
1756
1734
|
},
|
|
1757
1735
|
'deposit': {
|
|
1758
|
-
'min':
|
|
1736
|
+
'min': this.safeNumber(chain, 'depositMin'),
|
|
1759
1737
|
'max': undefined,
|
|
1760
1738
|
},
|
|
1761
1739
|
},
|
|
1762
|
-
|
|
1763
|
-
'type': 'crypto', // atm exchange api provides only cryptos
|
|
1764
|
-
});
|
|
1740
|
+
};
|
|
1765
1741
|
}
|
|
1766
|
-
return
|
|
1742
|
+
return this.safeCurrencyStructure({
|
|
1743
|
+
'info': currency,
|
|
1744
|
+
'code': code,
|
|
1745
|
+
'id': currencyId,
|
|
1746
|
+
'name': name,
|
|
1747
|
+
'active': undefined,
|
|
1748
|
+
'deposit': undefined,
|
|
1749
|
+
'withdraw': undefined,
|
|
1750
|
+
'fee': undefined,
|
|
1751
|
+
'precision': undefined,
|
|
1752
|
+
'limits': {
|
|
1753
|
+
'amount': {
|
|
1754
|
+
'min': undefined,
|
|
1755
|
+
'max': undefined,
|
|
1756
|
+
},
|
|
1757
|
+
'withdraw': {
|
|
1758
|
+
'min': undefined,
|
|
1759
|
+
'max': undefined,
|
|
1760
|
+
},
|
|
1761
|
+
'deposit': {
|
|
1762
|
+
'min': undefined,
|
|
1763
|
+
'max': undefined,
|
|
1764
|
+
},
|
|
1765
|
+
},
|
|
1766
|
+
'networks': networks,
|
|
1767
|
+
'type': 'crypto', // atm exchange api provides only cryptos
|
|
1768
|
+
});
|
|
1767
1769
|
}
|
|
1768
1770
|
/**
|
|
1769
1771
|
* @method
|
|
@@ -6072,7 +6074,7 @@ export default class bybit extends Exchange {
|
|
|
6072
6074
|
'txid': this.safeString(transaction, 'txID'),
|
|
6073
6075
|
'timestamp': timestamp,
|
|
6074
6076
|
'datetime': this.iso8601(timestamp),
|
|
6075
|
-
'network': this.networkIdToCode(this.safeString(transaction, 'chain')),
|
|
6077
|
+
'network': this.networkIdToCode(this.safeString(transaction, 'chain'), code),
|
|
6076
6078
|
'address': undefined,
|
|
6077
6079
|
'addressTo': toAddress,
|
|
6078
6080
|
'addressFrom': undefined,
|
|
@@ -6409,7 +6411,7 @@ export default class bybit extends Exchange {
|
|
|
6409
6411
|
request['tag'] = tag;
|
|
6410
6412
|
}
|
|
6411
6413
|
const [networkCode, query] = this.handleNetworkCodeAndParams(params);
|
|
6412
|
-
const networkId = this.networkCodeToId(networkCode);
|
|
6414
|
+
const networkId = this.networkCodeToId(networkCode, code);
|
|
6413
6415
|
if (networkId !== undefined) {
|
|
6414
6416
|
request['chain'] = networkId.toUpperCase();
|
|
6415
6417
|
}
|