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/ccxt.browser.js
CHANGED
|
@@ -7322,7 +7322,9 @@ class Exchange {
|
|
|
7322
7322
|
'createOrderWs': undefined,
|
|
7323
7323
|
'editOrderWs': undefined,
|
|
7324
7324
|
'fetchOpenOrdersWs': undefined,
|
|
7325
|
+
'fetchClosedOrdersWs': undefined,
|
|
7325
7326
|
'fetchOrderWs': undefined,
|
|
7327
|
+
'fetchOrdersWs': undefined,
|
|
7326
7328
|
'cancelOrderWs': undefined,
|
|
7327
7329
|
'cancelOrdersWs': undefined,
|
|
7328
7330
|
'cancelAllOrdersWs': undefined,
|
|
@@ -9238,6 +9240,11 @@ class Exchange {
|
|
|
9238
9240
|
if ('rate' in tradeFee) {
|
|
9239
9241
|
tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
|
|
9240
9242
|
}
|
|
9243
|
+
const entryFees = this.safeValue(entry, 'fees', []);
|
|
9244
|
+
for (let j = 0; j < entryFees.length; j++) {
|
|
9245
|
+
entryFees[j]['cost'] = this.safeNumber(entryFees[j], 'cost');
|
|
9246
|
+
}
|
|
9247
|
+
entry['fees'] = entryFees;
|
|
9241
9248
|
entry['fee'] = tradeFee;
|
|
9242
9249
|
}
|
|
9243
9250
|
let timeInForce = this.safeString(order, 'timeInForce');
|
|
@@ -10711,6 +10718,9 @@ class Exchange {
|
|
|
10711
10718
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10712
10719
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrders() is not supported yet');
|
|
10713
10720
|
}
|
|
10721
|
+
async fetchOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10722
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrdersWs() is not supported yet');
|
|
10723
|
+
}
|
|
10714
10724
|
async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10715
10725
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrderTrades() is not supported yet');
|
|
10716
10726
|
}
|
|
@@ -10718,14 +10728,33 @@ class Exchange {
|
|
|
10718
10728
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOrders() is not supported yet');
|
|
10719
10729
|
}
|
|
10720
10730
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10731
|
+
if (this.has['fetchOrders']) {
|
|
10732
|
+
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
10733
|
+
return this.filterBy(orders, 'status', 'open');
|
|
10734
|
+
}
|
|
10721
10735
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenOrders() is not supported yet');
|
|
10722
10736
|
}
|
|
10723
10737
|
async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10738
|
+
if (this.has['fetchOrdersWs']) {
|
|
10739
|
+
const orders = await this.fetchOrdersWs(symbol, since, limit, params);
|
|
10740
|
+
return this.filterBy(orders, 'status', 'open');
|
|
10741
|
+
}
|
|
10724
10742
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenOrdersWs() is not supported yet');
|
|
10725
10743
|
}
|
|
10726
10744
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10745
|
+
if (this.has['fetchOrders']) {
|
|
10746
|
+
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
10747
|
+
return this.filterBy(orders, 'status', 'closed');
|
|
10748
|
+
}
|
|
10727
10749
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchClosedOrders() is not supported yet');
|
|
10728
10750
|
}
|
|
10751
|
+
async fetchClosedOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10752
|
+
if (this.has['fetchOrdersWs']) {
|
|
10753
|
+
const orders = await this.fetchOrdersWs(symbol, since, limit, params);
|
|
10754
|
+
return this.filterBy(orders, 'status', 'closed');
|
|
10755
|
+
}
|
|
10756
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchClosedOrdersWs() is not supported yet');
|
|
10757
|
+
}
|
|
10729
10758
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10730
10759
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMyTrades() is not supported yet');
|
|
10731
10760
|
}
|
|
@@ -17414,6 +17443,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17414
17443
|
'lending/union/interestHistory': 0.1,
|
|
17415
17444
|
'lending/project/list': 0.1,
|
|
17416
17445
|
'lending/project/position/list': 0.1,
|
|
17446
|
+
// eth-staking
|
|
17447
|
+
'eth-staking/eth/history/stakingHistory': 15,
|
|
17448
|
+
'eth-staking/eth/history/redemptionHistory': 15,
|
|
17449
|
+
'eth-staking/eth/history/rewardsHistory': 15,
|
|
17450
|
+
'eth-staking/eth/quota': 15,
|
|
17451
|
+
'eth-staking/eth/history/rateHistory': 15,
|
|
17452
|
+
'eth-staking/account': 15,
|
|
17453
|
+
'eth-staking/wbeth/history/wrapHistory': 15,
|
|
17454
|
+
'eth-staking/wbeth/history/unwrapHistory': 15,
|
|
17455
|
+
'eth-staking/eth/history/wbethRewardsHistory': 15,
|
|
17417
17456
|
// mining endpoints
|
|
17418
17457
|
'mining/pub/algoList': 0.1,
|
|
17419
17458
|
'mining/pub/coinList': 0.1,
|
|
@@ -17615,6 +17654,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17615
17654
|
'staking/purchase': 0.1,
|
|
17616
17655
|
'staking/redeem': 0.1,
|
|
17617
17656
|
'staking/setAutoStaking': 0.1,
|
|
17657
|
+
// eth-staking
|
|
17658
|
+
'eth-staking/eth/stake': 15,
|
|
17659
|
+
'eth-staking/eth/redeem': 15,
|
|
17660
|
+
'eth-staking/wbeth/wrap': 15,
|
|
17661
|
+
// mining endpoints
|
|
17662
|
+
'mining/hash-transfer/config': 0.5,
|
|
17663
|
+
'mining/hash-transfer/config/cancel': 0.5,
|
|
17618
17664
|
'portfolio/repay': 20.001,
|
|
17619
17665
|
'loan/vip/renew': 40.002,
|
|
17620
17666
|
'loan/vip/borrow': 40.002,
|
|
@@ -17668,11 +17714,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17668
17714
|
},
|
|
17669
17715
|
'sapiV2': {
|
|
17670
17716
|
'get': {
|
|
17717
|
+
'eth-staking/account': 15,
|
|
17671
17718
|
'sub-account/futures/account': 0.1,
|
|
17672
17719
|
'sub-account/futures/accountSummary': 1,
|
|
17673
17720
|
'sub-account/futures/positionRisk': 0.1,
|
|
17674
17721
|
},
|
|
17675
17722
|
'post': {
|
|
17723
|
+
'eth-staking/eth/stake': 15,
|
|
17676
17724
|
'sub-account/subAccountApi/ipRestriction': 20.001, // Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
|
|
17677
17725
|
},
|
|
17678
17726
|
},
|
|
@@ -20694,22 +20742,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20694
20742
|
// 'endTime': 789, // Timestamp in ms to get aggregate trades until INCLUSIVE.
|
|
20695
20743
|
// 'limit': 500, // default = 500, maximum = 1000
|
|
20696
20744
|
};
|
|
20697
|
-
let method = this.safeString(this.options, 'fetchTradesMethod');
|
|
20698
|
-
method = this.safeString2(params, 'fetchTradesMethod', 'method', method);
|
|
20699
|
-
if (method === undefined) {
|
|
20700
|
-
if (market['option']) {
|
|
20701
|
-
method = 'eapiPublicGetTrades';
|
|
20702
|
-
}
|
|
20703
|
-
else if (market['linear']) {
|
|
20704
|
-
method = 'fapiPublicGetAggTrades';
|
|
20705
|
-
}
|
|
20706
|
-
else if (market['inverse']) {
|
|
20707
|
-
method = 'dapiPublicGetAggTrades';
|
|
20708
|
-
}
|
|
20709
|
-
else {
|
|
20710
|
-
method = 'publicGetAggTrades';
|
|
20711
|
-
}
|
|
20712
|
-
}
|
|
20713
20745
|
if (!market['option']) {
|
|
20714
20746
|
if (since !== undefined) {
|
|
20715
20747
|
request['startTime'] = since;
|
|
@@ -20726,7 +20758,22 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20726
20758
|
const isFutureOrSwap = (market['swap'] || market['future']);
|
|
20727
20759
|
request['limit'] = isFutureOrSwap ? Math.min(limit, 1000) : limit; // default = 500, maximum = 1000
|
|
20728
20760
|
}
|
|
20761
|
+
let method = this.safeString(this.options, 'fetchTradesMethod');
|
|
20762
|
+
method = this.safeString2(params, 'fetchTradesMethod', 'method', method);
|
|
20729
20763
|
params = this.omit(params, ['until', 'fetchTradesMethod']);
|
|
20764
|
+
let response = undefined;
|
|
20765
|
+
if (market['option'] || method === 'eapiPublicGetTrades') {
|
|
20766
|
+
response = await this.eapiPublicGetTrades(this.extend(request, params));
|
|
20767
|
+
}
|
|
20768
|
+
else if (market['linear'] || method === 'fapiPublicGetAggTrades') {
|
|
20769
|
+
response = await this.fapiPublicGetAggTrades(this.extend(request, params));
|
|
20770
|
+
}
|
|
20771
|
+
else if (market['inverse'] || method === 'dapiPublicGetAggTrades') {
|
|
20772
|
+
response = await this.dapiPublicGetAggTrades(this.extend(request, params));
|
|
20773
|
+
}
|
|
20774
|
+
else {
|
|
20775
|
+
response = await this.publicGetAggTrades(this.extend(request, params));
|
|
20776
|
+
}
|
|
20730
20777
|
//
|
|
20731
20778
|
// Caveats:
|
|
20732
20779
|
// - default limit (500) applies only if no other parameters set, trades up
|
|
@@ -20736,7 +20783,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20736
20783
|
// - "tradeId" accepted and returned by this method is "aggregate" trade id
|
|
20737
20784
|
// which is different from actual trade id
|
|
20738
20785
|
// - setting both fromId and time window results in error
|
|
20739
|
-
const response = await this[method](this.extend(request, params));
|
|
20740
20786
|
//
|
|
20741
20787
|
// aggregate trades
|
|
20742
20788
|
//
|
|
@@ -21335,6 +21381,15 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21335
21381
|
}
|
|
21336
21382
|
const stopPriceString = this.safeString(order, 'stopPrice');
|
|
21337
21383
|
const stopPrice = this.parseNumber(this.omitZero(stopPriceString));
|
|
21384
|
+
const feeCost = this.safeNumber(order, 'fee');
|
|
21385
|
+
let fee = undefined;
|
|
21386
|
+
if (feeCost !== undefined) {
|
|
21387
|
+
fee = {
|
|
21388
|
+
'currency': this.safeString(order, 'quoteAsset'),
|
|
21389
|
+
'cost': feeCost,
|
|
21390
|
+
'rate': undefined,
|
|
21391
|
+
};
|
|
21392
|
+
}
|
|
21338
21393
|
return this.safeOrder({
|
|
21339
21394
|
'info': order,
|
|
21340
21395
|
'id': id,
|
|
@@ -21357,11 +21412,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21357
21412
|
'filled': filled,
|
|
21358
21413
|
'remaining': undefined,
|
|
21359
21414
|
'status': status,
|
|
21360
|
-
'fee':
|
|
21361
|
-
'currency': this.safeString(order, 'quoteAsset'),
|
|
21362
|
-
'cost': this.safeNumber(order, 'fee'),
|
|
21363
|
-
'rate': undefined,
|
|
21364
|
-
},
|
|
21415
|
+
'fee': fee,
|
|
21365
21416
|
'trades': fills,
|
|
21366
21417
|
}, market);
|
|
21367
21418
|
}
|
|
@@ -24910,23 +24961,22 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24910
24961
|
}
|
|
24911
24962
|
await this.loadMarkets();
|
|
24912
24963
|
await this.loadLeverageBrackets(false, params);
|
|
24913
|
-
let method = undefined;
|
|
24914
24964
|
const defaultType = this.safeString(this.options, 'defaultType', 'future');
|
|
24915
24965
|
const type = this.safeString(params, 'type', defaultType);
|
|
24916
24966
|
let query = this.omit(params, 'type');
|
|
24917
24967
|
let subType = undefined;
|
|
24918
24968
|
[subType, query] = this.handleSubTypeAndParams('fetchAccountPositions', undefined, params, 'linear');
|
|
24969
|
+
let response = undefined;
|
|
24919
24970
|
if (this.isLinear(type, subType)) {
|
|
24920
|
-
|
|
24971
|
+
response = await this.fapiPrivateV2GetAccount(query);
|
|
24921
24972
|
}
|
|
24922
24973
|
else if (this.isInverse(type, subType)) {
|
|
24923
|
-
|
|
24974
|
+
response = await this.dapiPrivateGetAccount(query);
|
|
24924
24975
|
}
|
|
24925
24976
|
else {
|
|
24926
24977
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
|
|
24927
24978
|
}
|
|
24928
|
-
const
|
|
24929
|
-
const result = this.parseAccountPositions(account);
|
|
24979
|
+
const result = this.parseAccountPositions(response);
|
|
24930
24980
|
symbols = this.marketSymbols(symbols);
|
|
24931
24981
|
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
|
24932
24982
|
}
|
|
@@ -24950,15 +25000,15 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24950
25000
|
await this.loadMarkets();
|
|
24951
25001
|
await this.loadLeverageBrackets(false, params);
|
|
24952
25002
|
const request = {};
|
|
24953
|
-
let method = undefined;
|
|
24954
25003
|
let defaultType = 'future';
|
|
24955
25004
|
defaultType = this.safeString(this.options, 'defaultType', defaultType);
|
|
24956
25005
|
const type = this.safeString(params, 'type', defaultType);
|
|
24957
25006
|
let subType = undefined;
|
|
24958
25007
|
[subType, params] = this.handleSubTypeAndParams('fetchPositionsRisk', undefined, params, 'linear');
|
|
24959
25008
|
params = this.omit(params, 'type');
|
|
25009
|
+
let response = undefined;
|
|
24960
25010
|
if (this.isLinear(type, subType)) {
|
|
24961
|
-
|
|
25011
|
+
response = await this.fapiPrivateV2GetPositionRisk(this.extend(request, params));
|
|
24962
25012
|
// ### Response examples ###
|
|
24963
25013
|
//
|
|
24964
25014
|
// For One-way position mode:
|
|
@@ -25015,12 +25065,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25015
25065
|
// ]
|
|
25016
25066
|
}
|
|
25017
25067
|
else if (this.isInverse(type, subType)) {
|
|
25018
|
-
|
|
25068
|
+
response = await this.dapiPrivateGetPositionRisk(this.extend(request, params));
|
|
25019
25069
|
}
|
|
25020
25070
|
else {
|
|
25021
25071
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositionsRisk() supports linear and inverse contracts only');
|
|
25022
25072
|
}
|
|
25023
|
-
const response = await this[method](this.extend(request, params));
|
|
25024
25073
|
const result = [];
|
|
25025
25074
|
for (let i = 0; i < response.length; i++) {
|
|
25026
25075
|
const parsed = this.parsePositionRisk(response[i]);
|
|
@@ -25198,6 +25247,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25198
25247
|
const defaultType = this.safeString(this.options, 'defaultType', 'future');
|
|
25199
25248
|
const type = this.safeString(params, 'type', defaultType);
|
|
25200
25249
|
params = this.omit(params, ['type']);
|
|
25250
|
+
let subType = undefined;
|
|
25251
|
+
[subType, params] = this.handleSubTypeAndParams('setPositionMode', undefined, params);
|
|
25201
25252
|
let dualSidePosition = undefined;
|
|
25202
25253
|
if (hedged) {
|
|
25203
25254
|
dualSidePosition = 'true';
|
|
@@ -25208,13 +25259,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25208
25259
|
const request = {
|
|
25209
25260
|
'dualSidePosition': dualSidePosition,
|
|
25210
25261
|
};
|
|
25211
|
-
let
|
|
25212
|
-
if (this.isInverse(type)) {
|
|
25213
|
-
|
|
25262
|
+
let response = undefined;
|
|
25263
|
+
if (this.isInverse(type, subType)) {
|
|
25264
|
+
response = await this.dapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
25214
25265
|
}
|
|
25215
25266
|
else {
|
|
25216
25267
|
// default to future
|
|
25217
|
-
|
|
25268
|
+
response = await this.fapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
25218
25269
|
}
|
|
25219
25270
|
//
|
|
25220
25271
|
// {
|
|
@@ -25222,7 +25273,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25222
25273
|
// "msg": "success"
|
|
25223
25274
|
// }
|
|
25224
25275
|
//
|
|
25225
|
-
return
|
|
25276
|
+
return response;
|
|
25226
25277
|
}
|
|
25227
25278
|
async fetchSettlementHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
25228
25279
|
/**
|
|
@@ -25434,24 +25485,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25434
25485
|
if (code !== undefined) {
|
|
25435
25486
|
currency = this.currency(code);
|
|
25436
25487
|
}
|
|
25437
|
-
let method = undefined;
|
|
25438
25488
|
const request = {};
|
|
25439
25489
|
[type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
|
|
25440
25490
|
[subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
|
|
25441
|
-
if (type === 'option') {
|
|
25442
|
-
this.checkRequiredArgument('fetchLedger', code, 'code');
|
|
25443
|
-
request['currency'] = currency['id'];
|
|
25444
|
-
method = 'eapiPrivateGetBill';
|
|
25445
|
-
}
|
|
25446
|
-
else if (this.isLinear(type, subType)) {
|
|
25447
|
-
method = 'fapiPrivateGetIncome';
|
|
25448
|
-
}
|
|
25449
|
-
else if (this.isInverse(type, subType)) {
|
|
25450
|
-
method = 'dapiPrivateGetIncome';
|
|
25451
|
-
}
|
|
25452
|
-
else {
|
|
25453
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLedger() supports contract wallets only');
|
|
25454
|
-
}
|
|
25455
25491
|
if (since !== undefined) {
|
|
25456
25492
|
request['startTime'] = since;
|
|
25457
25493
|
}
|
|
@@ -25463,7 +25499,21 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25463
25499
|
params = this.omit(params, 'until');
|
|
25464
25500
|
request['endTime'] = until;
|
|
25465
25501
|
}
|
|
25466
|
-
|
|
25502
|
+
let response = undefined;
|
|
25503
|
+
if (type === 'option') {
|
|
25504
|
+
this.checkRequiredArgument('fetchLedger', code, 'code');
|
|
25505
|
+
request['currency'] = currency['id'];
|
|
25506
|
+
response = await this.eapiPrivateGetBill(this.extend(request, params));
|
|
25507
|
+
}
|
|
25508
|
+
else if (this.isLinear(type, subType)) {
|
|
25509
|
+
response = await this.fapiPrivateGetIncome(this.extend(request, params));
|
|
25510
|
+
}
|
|
25511
|
+
else if (this.isInverse(type, subType)) {
|
|
25512
|
+
response = await this.dapiPrivateGetIncome(this.extend(request, params));
|
|
25513
|
+
}
|
|
25514
|
+
else {
|
|
25515
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLedger() supports contract wallets only');
|
|
25516
|
+
}
|
|
25467
25517
|
//
|
|
25468
25518
|
// options (eapi)
|
|
25469
25519
|
//
|
|
@@ -26337,11 +26387,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
26337
26387
|
const duration = this.parseTimeframe(timeframe);
|
|
26338
26388
|
request['endTime'] = this.sum(since, duration * limit * 1000);
|
|
26339
26389
|
}
|
|
26340
|
-
let
|
|
26390
|
+
let response = undefined;
|
|
26341
26391
|
if (market['inverse']) {
|
|
26342
|
-
|
|
26392
|
+
response = await this.dapiDataGetOpenInterestHist(this.extend(request, params));
|
|
26393
|
+
}
|
|
26394
|
+
else {
|
|
26395
|
+
response = await this.fapiDataGetOpenInterestHist(this.extend(request, params));
|
|
26343
26396
|
}
|
|
26344
|
-
const response = await this[method](this.extend(request, params));
|
|
26345
26397
|
//
|
|
26346
26398
|
// [
|
|
26347
26399
|
// {
|
|
@@ -26377,14 +26429,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
26377
26429
|
else {
|
|
26378
26430
|
request['symbol'] = market['id'];
|
|
26379
26431
|
}
|
|
26380
|
-
let
|
|
26432
|
+
let response = undefined;
|
|
26381
26433
|
if (market['option']) {
|
|
26382
|
-
|
|
26434
|
+
response = await this.eapiPublicGetOpenInterest(this.extend(request, params));
|
|
26383
26435
|
}
|
|
26384
26436
|
else if (market['inverse']) {
|
|
26385
|
-
|
|
26437
|
+
response = await this.dapiPublicGetOpenInterest(this.extend(request, params));
|
|
26438
|
+
}
|
|
26439
|
+
else {
|
|
26440
|
+
response = await this.fapiPublicGetOpenInterest(this.extend(request, params));
|
|
26386
26441
|
}
|
|
26387
|
-
const response = await this[method](this.extend(request, params));
|
|
26388
26442
|
//
|
|
26389
26443
|
// futures (fapi)
|
|
26390
26444
|
//
|
|
@@ -28665,15 +28719,20 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28665
28719
|
else if (timeInForce === 'FOK') {
|
|
28666
28720
|
request['timeInForce'] = 'FOK';
|
|
28667
28721
|
}
|
|
28668
|
-
|
|
28669
|
-
|
|
28670
|
-
|
|
28671
|
-
const
|
|
28672
|
-
const
|
|
28673
|
-
const takeProfitPrice = this.safeNumber(params, 'takeProfitPrice');
|
|
28722
|
+
const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
|
|
28723
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
28724
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
28725
|
+
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
28726
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'priceRate');
|
|
28674
28727
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
28675
28728
|
const isStopLossPriceOrder = stopLossPrice !== undefined;
|
|
28676
28729
|
const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
|
|
28730
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
28731
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
28732
|
+
const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
|
|
28733
|
+
if (((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) && !isTrailing) {
|
|
28734
|
+
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
28735
|
+
}
|
|
28677
28736
|
let reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
28678
28737
|
if (isTriggerOrder) {
|
|
28679
28738
|
request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
|
|
@@ -28706,6 +28765,16 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28706
28765
|
}
|
|
28707
28766
|
}
|
|
28708
28767
|
}
|
|
28768
|
+
else if (isTrailing) {
|
|
28769
|
+
request['type'] = 'TRAILING_STOP_MARKET';
|
|
28770
|
+
if (isTrailingAmountOrder) {
|
|
28771
|
+
request['price'] = this.parseToNumeric(trailingAmount);
|
|
28772
|
+
}
|
|
28773
|
+
else if (isTrailingPercentOrder) {
|
|
28774
|
+
const requestTrailingPercent = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(trailingPercent, '100');
|
|
28775
|
+
request['priceRate'] = this.parseToNumeric(requestTrailingPercent);
|
|
28776
|
+
}
|
|
28777
|
+
}
|
|
28709
28778
|
let positionSide = undefined;
|
|
28710
28779
|
if (reduceOnly) {
|
|
28711
28780
|
positionSide = (side === 'buy') ? 'SHORT' : 'LONG';
|
|
@@ -28715,7 +28784,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28715
28784
|
}
|
|
28716
28785
|
request['positionSide'] = positionSide;
|
|
28717
28786
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
28718
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
28787
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent']);
|
|
28719
28788
|
}
|
|
28720
28789
|
return this.extend(request, params);
|
|
28721
28790
|
}
|
|
@@ -28738,6 +28807,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28738
28807
|
* @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
|
|
28739
28808
|
* @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
|
|
28740
28809
|
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
|
|
28810
|
+
* @param {float} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
|
|
28811
|
+
* @param {float} [params.trailingPercent] *swap only* the percent to trail away from the current market price
|
|
28741
28812
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
28742
28813
|
*/
|
|
28743
28814
|
await this.loadMarkets();
|
|
@@ -44346,6 +44417,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44346
44417
|
* @param {float} [params.takeProfit.price] *swap only* the execution price for a take profit attached to a trigger order
|
|
44347
44418
|
* @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'
|
|
44348
44419
|
* @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'
|
|
44420
|
+
* @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
|
|
44421
|
+
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
44422
|
+
* @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
44349
44423
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
44350
44424
|
*/
|
|
44351
44425
|
await this.loadMarkets();
|
|
@@ -44355,6 +44429,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44355
44429
|
const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
|
|
44356
44430
|
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
44357
44431
|
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
44432
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
|
|
44433
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
44358
44434
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
44359
44435
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
44360
44436
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
@@ -44376,7 +44452,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44376
44452
|
}
|
|
44377
44453
|
}
|
|
44378
44454
|
else {
|
|
44379
|
-
if (isTriggerOrder) {
|
|
44455
|
+
if (isTriggerOrder || isTrailingPercentOrder) {
|
|
44380
44456
|
response = await this.privateMixPostV2MixOrderPlacePlanOrder(request);
|
|
44381
44457
|
}
|
|
44382
44458
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
@@ -44431,8 +44507,11 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44431
44507
|
const isTakeProfit = takeProfit !== undefined;
|
|
44432
44508
|
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
44433
44509
|
const isStopLossOrTakeProfit = isStopLoss || isTakeProfit;
|
|
44434
|
-
|
|
44435
|
-
|
|
44510
|
+
const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', price);
|
|
44511
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
|
|
44512
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
44513
|
+
if (this.sum(isTriggerOrder, isStopLossTriggerOrder, isTakeProfitTriggerOrder, isTrailingPercentOrder) > 1) {
|
|
44514
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
|
|
44436
44515
|
}
|
|
44437
44516
|
if (type === 'limit') {
|
|
44438
44517
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -44457,7 +44536,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44457
44536
|
else if (timeInForce === 'IOC') {
|
|
44458
44537
|
request['force'] = 'IOC';
|
|
44459
44538
|
}
|
|
44460
|
-
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'postOnly', 'reduceOnly', 'clientOrderId']);
|
|
44539
|
+
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'postOnly', 'reduceOnly', 'clientOrderId', 'trailingPercent', 'trailingTriggerPrice']);
|
|
44461
44540
|
if ((marketType === 'swap') || (marketType === 'future')) {
|
|
44462
44541
|
request['marginCoin'] = market['settleId'];
|
|
44463
44542
|
request['size'] = this.amountToPrecision(symbol, amount);
|
|
@@ -44467,34 +44546,21 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44467
44546
|
if (clientOrderId !== undefined) {
|
|
44468
44547
|
request['clientOid'] = clientOrderId;
|
|
44469
44548
|
}
|
|
44470
|
-
if (isTriggerOrder || isStopLossOrTakeProfitTrigger) {
|
|
44549
|
+
if (isTriggerOrder || isStopLossOrTakeProfitTrigger || isTrailingPercentOrder) {
|
|
44471
44550
|
request['triggerType'] = triggerType;
|
|
44472
44551
|
}
|
|
44473
|
-
if (
|
|
44552
|
+
if (isTrailingPercentOrder) {
|
|
44474
44553
|
if (!isMarketOrder) {
|
|
44475
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.
|
|
44476
|
-
}
|
|
44477
|
-
request['holdSide'] = (side === 'buy') ? 'long' : 'short';
|
|
44478
|
-
}
|
|
44479
|
-
else {
|
|
44480
|
-
if (marginMode === undefined) {
|
|
44481
|
-
marginMode = 'cross';
|
|
44554
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' createOrder() bitget trailing orders must be market orders');
|
|
44482
44555
|
}
|
|
44483
|
-
|
|
44484
|
-
|
|
44485
|
-
let requestSide = side;
|
|
44486
|
-
if (reduceOnly) {
|
|
44487
|
-
request['reduceOnly'] = 'YES';
|
|
44488
|
-
request['tradeSide'] = 'Close';
|
|
44489
|
-
// on bitget if the position is long the side is always buy, and if the position is short the side is always sell
|
|
44490
|
-
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
44491
|
-
}
|
|
44492
|
-
else {
|
|
44493
|
-
request['tradeSide'] = 'Open';
|
|
44556
|
+
if (trailingTriggerPrice === undefined) {
|
|
44557
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createOrder() bitget trailing orders must have a trailingTriggerPrice param');
|
|
44494
44558
|
}
|
|
44495
|
-
request['
|
|
44559
|
+
request['planType'] = 'track_plan';
|
|
44560
|
+
request['triggerPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
44561
|
+
request['callbackRatio'] = trailingPercent;
|
|
44496
44562
|
}
|
|
44497
|
-
if (isTriggerOrder) {
|
|
44563
|
+
else if (isTriggerOrder) {
|
|
44498
44564
|
request['planType'] = 'normal_plan';
|
|
44499
44565
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
44500
44566
|
if (price !== undefined) {
|
|
@@ -44518,6 +44584,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44518
44584
|
}
|
|
44519
44585
|
}
|
|
44520
44586
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
44587
|
+
if (!isMarketOrder) {
|
|
44588
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' createOrder() bitget stopLoss or takeProfit orders must be market orders');
|
|
44589
|
+
}
|
|
44590
|
+
request['holdSide'] = (side === 'buy') ? 'long' : 'short';
|
|
44521
44591
|
if (isStopLossTriggerOrder) {
|
|
44522
44592
|
request['triggerPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
44523
44593
|
request['planType'] = 'pos_loss';
|
|
@@ -44537,6 +44607,24 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44537
44607
|
request['presetStopSurplusPrice'] = this.priceToPrecision(symbol, tpTriggerPrice);
|
|
44538
44608
|
}
|
|
44539
44609
|
}
|
|
44610
|
+
if (!isStopLossOrTakeProfitTrigger) {
|
|
44611
|
+
if (marginMode === undefined) {
|
|
44612
|
+
marginMode = 'cross';
|
|
44613
|
+
}
|
|
44614
|
+
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
44615
|
+
request['marginMode'] = marginModeRequest;
|
|
44616
|
+
let requestSide = side;
|
|
44617
|
+
if (reduceOnly) {
|
|
44618
|
+
request['reduceOnly'] = 'YES';
|
|
44619
|
+
request['tradeSide'] = 'Close';
|
|
44620
|
+
// on bitget if the position is long the side is always buy, and if the position is short the side is always sell
|
|
44621
|
+
requestSide = (side === 'buy') ? 'sell' : 'buy';
|
|
44622
|
+
}
|
|
44623
|
+
else {
|
|
44624
|
+
request['tradeSide'] = 'Open';
|
|
44625
|
+
}
|
|
44626
|
+
request['side'] = requestSide;
|
|
44627
|
+
}
|
|
44540
44628
|
}
|
|
44541
44629
|
else if (marketType === 'spot') {
|
|
44542
44630
|
if (isStopLossOrTakeProfitTrigger || isStopLossOrTakeProfit) {
|
|
@@ -44743,6 +44831,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44743
44831
|
* @param {float} [params.takeProfit.price] *swap only* the execution price for a take profit attached to a trigger order
|
|
44744
44832
|
* @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'
|
|
44745
44833
|
* @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'
|
|
44834
|
+
* @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
|
|
44835
|
+
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
44836
|
+
* @param {string} [params.newTriggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
44746
44837
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
44747
44838
|
*/
|
|
44748
44839
|
await this.loadMarkets();
|
|
@@ -44769,14 +44860,17 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44769
44860
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
44770
44861
|
const isStopLoss = stopLoss !== undefined;
|
|
44771
44862
|
const isTakeProfit = takeProfit !== undefined;
|
|
44772
|
-
|
|
44773
|
-
|
|
44863
|
+
const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', price);
|
|
44864
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'newCallbackRatio');
|
|
44865
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
44866
|
+
if (this.sum(isTriggerOrder, isStopLossOrder, isTakeProfitOrder, isTrailingPercentOrder) > 1) {
|
|
44867
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' editOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
|
|
44774
44868
|
}
|
|
44775
44869
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
44776
44870
|
if (clientOrderId !== undefined) {
|
|
44777
44871
|
request['clientOid'] = clientOrderId;
|
|
44778
44872
|
}
|
|
44779
|
-
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId']);
|
|
44873
|
+
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId', 'trailingTriggerPrice', 'trailingPercent']);
|
|
44780
44874
|
let response = undefined;
|
|
44781
44875
|
if (market['spot']) {
|
|
44782
44876
|
const editMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'editMarketBuyOrderRequiresPrice', true);
|
|
@@ -44809,11 +44903,21 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44809
44903
|
request['productType'] = productType;
|
|
44810
44904
|
if (!isTakeProfitOrder && !isStopLossOrder) {
|
|
44811
44905
|
request['newSize'] = this.amountToPrecision(symbol, amount);
|
|
44812
|
-
if (price !== undefined) {
|
|
44906
|
+
if ((price !== undefined) && !isTrailingPercentOrder) {
|
|
44813
44907
|
request['newPrice'] = this.priceToPrecision(symbol, price);
|
|
44814
44908
|
}
|
|
44815
44909
|
}
|
|
44816
|
-
if (
|
|
44910
|
+
if (isTrailingPercentOrder) {
|
|
44911
|
+
if (!isMarketOrder) {
|
|
44912
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() bitget trailing orders must be market orders');
|
|
44913
|
+
}
|
|
44914
|
+
if (trailingTriggerPrice !== undefined) {
|
|
44915
|
+
request['newTriggerPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
44916
|
+
}
|
|
44917
|
+
request['newCallbackRatio'] = trailingPercent;
|
|
44918
|
+
response = await this.privateMixPostV2MixOrderModifyPlanOrder(this.extend(request, params));
|
|
44919
|
+
}
|
|
44920
|
+
else if (isTakeProfitOrder || isStopLossOrder) {
|
|
44817
44921
|
request['marginCoin'] = market['settleId'];
|
|
44818
44922
|
request['size'] = this.amountToPrecision(symbol, amount);
|
|
44819
44923
|
request['executePrice'] = this.priceToPrecision(symbol, price);
|
|
@@ -44892,6 +44996,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44892
44996
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
44893
44997
|
* @param {boolean} [params.stop] set to true for canceling trigger orders
|
|
44894
44998
|
* @param {string} [params.planType] *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
|
|
44999
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
44895
45000
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
44896
45001
|
*/
|
|
44897
45002
|
if (symbol === undefined) {
|
|
@@ -44911,8 +45016,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44911
45016
|
let response = undefined;
|
|
44912
45017
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
44913
45018
|
const request = {};
|
|
44914
|
-
const
|
|
44915
|
-
|
|
45019
|
+
const trailing = this.safeValue(params, 'trailing');
|
|
45020
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
45021
|
+
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
44916
45022
|
if (!(market['spot'] && stop)) {
|
|
44917
45023
|
request['symbol'] = market['id'];
|
|
44918
45024
|
}
|
|
@@ -44923,13 +45029,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44923
45029
|
let productType = undefined;
|
|
44924
45030
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
44925
45031
|
request['productType'] = productType;
|
|
44926
|
-
if (stop) {
|
|
45032
|
+
if (stop || trailing) {
|
|
44927
45033
|
const orderIdList = [];
|
|
44928
45034
|
const orderId = {
|
|
44929
45035
|
'orderId': id,
|
|
44930
45036
|
};
|
|
44931
45037
|
orderIdList.push(orderId);
|
|
44932
45038
|
request['orderIdList'] = orderIdList;
|
|
45039
|
+
}
|
|
45040
|
+
if (trailing) {
|
|
45041
|
+
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
45042
|
+
request['planType'] = planType;
|
|
45043
|
+
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
45044
|
+
}
|
|
45045
|
+
else if (stop) {
|
|
44933
45046
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
44934
45047
|
}
|
|
44935
45048
|
else {
|
|
@@ -45345,6 +45458,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45345
45458
|
* @param {boolean} [params.stop] set to true for fetching trigger orders
|
|
45346
45459
|
* @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)
|
|
45347
45460
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
45461
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
45348
45462
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
45349
45463
|
*/
|
|
45350
45464
|
await this.loadMarkets();
|
|
@@ -45386,8 +45500,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45386
45500
|
return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
|
|
45387
45501
|
}
|
|
45388
45502
|
let response = undefined;
|
|
45503
|
+
const trailing = this.safeValue(params, 'trailing');
|
|
45389
45504
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
45390
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
45505
|
+
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
45391
45506
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
45392
45507
|
if (since !== undefined) {
|
|
45393
45508
|
request['startTime'] = since;
|
|
@@ -45430,7 +45545,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45430
45545
|
let productType = undefined;
|
|
45431
45546
|
[productType, query] = this.handleProductTypeAndParams(market, query);
|
|
45432
45547
|
request['productType'] = productType;
|
|
45433
|
-
if (
|
|
45548
|
+
if (trailing) {
|
|
45549
|
+
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
45550
|
+
request['planType'] = planType;
|
|
45551
|
+
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
|
|
45552
|
+
}
|
|
45553
|
+
else if (stop) {
|
|
45434
45554
|
const planType = this.safeString(query, 'planType', 'normal_plan');
|
|
45435
45555
|
request['planType'] = planType;
|
|
45436
45556
|
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
|
|
@@ -45646,6 +45766,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45646
45766
|
* @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)
|
|
45647
45767
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
45648
45768
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
45769
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
45649
45770
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
45650
45771
|
*/
|
|
45651
45772
|
await this.loadMarkets();
|
|
@@ -45683,6 +45804,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45683
45804
|
* @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)
|
|
45684
45805
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
45685
45806
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
45807
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
45686
45808
|
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
45687
45809
|
*/
|
|
45688
45810
|
await this.loadMarkets();
|
|
@@ -45735,8 +45857,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45735
45857
|
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
|
|
45736
45858
|
}
|
|
45737
45859
|
let response = undefined;
|
|
45860
|
+
const trailing = this.safeValue(params, 'trailing');
|
|
45738
45861
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
45739
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
45862
|
+
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
45740
45863
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
45741
45864
|
if (since !== undefined) {
|
|
45742
45865
|
request['startTime'] = since;
|
|
@@ -45790,7 +45913,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45790
45913
|
let productType = undefined;
|
|
45791
45914
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
45792
45915
|
request['productType'] = productType;
|
|
45793
|
-
if (
|
|
45916
|
+
if (trailing) {
|
|
45917
|
+
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
45918
|
+
request['planType'] = planType;
|
|
45919
|
+
response = await this.privateMixGetV2MixOrderOrdersPlanHistory(this.extend(request, params));
|
|
45920
|
+
}
|
|
45921
|
+
else if (stop) {
|
|
45794
45922
|
const planType = this.safeString(params, 'planType', 'normal_plan');
|
|
45795
45923
|
request['planType'] = planType;
|
|
45796
45924
|
response = await this.privateMixGetV2MixOrderOrdersPlanHistory(this.extend(request, params));
|
|
@@ -51778,7 +51906,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51778
51906
|
if (priceString === 'market price') {
|
|
51779
51907
|
priceString = undefined;
|
|
51780
51908
|
}
|
|
51781
|
-
const
|
|
51909
|
+
const trailingActivationPrice = this.safeNumber(order, 'activation_price');
|
|
51782
51910
|
return this.safeOrder({
|
|
51783
51911
|
'id': id,
|
|
51784
51912
|
'clientOrderId': this.safeString(order, 'client_order_id'),
|
|
@@ -51792,8 +51920,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51792
51920
|
'postOnly': postOnly,
|
|
51793
51921
|
'side': this.parseOrderSide(this.safeString(order, 'side')),
|
|
51794
51922
|
'price': this.omitZero(priceString),
|
|
51795
|
-
'stopPrice':
|
|
51796
|
-
'triggerPrice':
|
|
51923
|
+
'stopPrice': trailingActivationPrice,
|
|
51924
|
+
'triggerPrice': trailingActivationPrice,
|
|
51797
51925
|
'amount': this.omitZero(this.safeString(order, 'size')),
|
|
51798
51926
|
'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
|
|
51799
51927
|
'average': this.safeStringN(order, ['price_avg', 'priceAvg', 'deal_avg_price']),
|
|
@@ -51865,6 +51993,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51865
51993
|
* @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
|
51866
51994
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
51867
51995
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
51996
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
51868
51997
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
51869
51998
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
51870
51999
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -51876,12 +52005,20 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51876
52005
|
* @param {string} [params.clientOrderId] client order id of the order
|
|
51877
52006
|
* @param {boolean} [params.reduceOnly] *swap only* reduce only
|
|
51878
52007
|
* @param {boolean} [params.postOnly] make sure the order is posted to the order book and not matched immediately
|
|
52008
|
+
* @param {string} [params.triggerPrice] *swap only* the price to trigger a stop order
|
|
52009
|
+
* @param {int} [params.price_type] *swap only* 1: last price, 2: fair price, default is 1
|
|
52010
|
+
* @param {int} [params.price_way] *swap only* 1: price way long, 2: price way short
|
|
52011
|
+
* @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
|
|
52012
|
+
* @param {string} [params.trailingPercent] *swap only* the percent to trail away from the current market price, min 0.1 max 5
|
|
52013
|
+
* @param {string} [params.trailingTriggerPrice] *swap only* the price to trigger a trailing order, default uses the price argument
|
|
51879
52014
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
51880
52015
|
*/
|
|
51881
52016
|
await this.loadMarkets();
|
|
51882
52017
|
const market = this.market(symbol);
|
|
51883
52018
|
const result = this.handleMarginModeAndParams('createOrder', params);
|
|
51884
52019
|
const marginMode = this.safeString(result, 0);
|
|
52020
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
52021
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
51885
52022
|
let response = undefined;
|
|
51886
52023
|
if (market['spot']) {
|
|
51887
52024
|
const spotRequest = this.createSpotOrderRequest(symbol, type, side, amount, price, params);
|
|
@@ -51894,7 +52031,12 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51894
52031
|
}
|
|
51895
52032
|
else {
|
|
51896
52033
|
const swapRequest = this.createSwapOrderRequest(symbol, type, side, amount, price, params);
|
|
51897
|
-
|
|
52034
|
+
if (isTriggerOrder) {
|
|
52035
|
+
response = await this.privatePostContractPrivateSubmitPlanOrder(swapRequest);
|
|
52036
|
+
}
|
|
52037
|
+
else {
|
|
52038
|
+
response = await this.privatePostContractPrivateSubmitOrder(swapRequest);
|
|
52039
|
+
}
|
|
51898
52040
|
}
|
|
51899
52041
|
//
|
|
51900
52042
|
// spot and margin
|
|
@@ -51926,6 +52068,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51926
52068
|
* @ignore
|
|
51927
52069
|
* @description create a trade order
|
|
51928
52070
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
52071
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
51929
52072
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
51930
52073
|
* @param {string} type 'market', 'limit' or 'trailing'
|
|
51931
52074
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -51936,8 +52079,12 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51936
52079
|
* @param {boolean} [params.reduceOnly] *swap only* reduce only
|
|
51937
52080
|
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
|
|
51938
52081
|
* @param {string} [params.clientOrderId] client order id of the order
|
|
52082
|
+
* @param {string} [params.triggerPrice] *swap only* the price to trigger a stop order
|
|
52083
|
+
* @param {int} [params.price_type] *swap only* 1: last price, 2: fair price, default is 1
|
|
52084
|
+
* @param {int} [params.price_way] *swap only* 1: price way long, 2: price way short
|
|
51939
52085
|
* @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
|
|
51940
|
-
* @param {string} [params.
|
|
52086
|
+
* @param {string} [params.trailingPercent] *swap only* the percent to trail away from the current market price, min 0.1 max 5
|
|
52087
|
+
* @param {string} [params.trailingTriggerPrice] *swap only* the price to trigger a trailing order, default uses the price argument
|
|
51941
52088
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
51942
52089
|
*/
|
|
51943
52090
|
const market = this.market(symbol);
|
|
@@ -51950,10 +52097,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51950
52097
|
const mode = this.safeInteger(params, 'mode'); // only for swap
|
|
51951
52098
|
const isMarketOrder = type === 'market';
|
|
51952
52099
|
let postOnly = undefined;
|
|
51953
|
-
|
|
52100
|
+
const reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
51954
52101
|
const isExchangeSpecificPo = (mode === 4);
|
|
51955
52102
|
[postOnly, params] = this.handlePostOnly(isMarketOrder, isExchangeSpecificPo, params);
|
|
51956
|
-
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly']);
|
|
51957
52103
|
const ioc = ((timeInForce === 'IOC') || (mode === 3));
|
|
51958
52104
|
const isLimitOrder = (type === 'limit') || postOnly || ioc;
|
|
51959
52105
|
if (timeInForce === 'GTC') {
|
|
@@ -51968,14 +52114,39 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51968
52114
|
if (postOnly) {
|
|
51969
52115
|
request['mode'] = 4;
|
|
51970
52116
|
}
|
|
52117
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
52118
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
52119
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activation_price', price);
|
|
52120
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callback_rate');
|
|
52121
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
51971
52122
|
if (isLimitOrder) {
|
|
51972
52123
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
51973
52124
|
}
|
|
51974
|
-
else if (type === 'trailing') {
|
|
51975
|
-
|
|
51976
|
-
request['activation_price'] = this.priceToPrecision(symbol,
|
|
52125
|
+
else if (type === 'trailing' || isTrailingPercentOrder) {
|
|
52126
|
+
request['callback_rate'] = trailingPercent;
|
|
52127
|
+
request['activation_price'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
51977
52128
|
request['activation_price_type'] = this.safeInteger(params, 'activation_price_type', 1);
|
|
51978
|
-
|
|
52129
|
+
}
|
|
52130
|
+
if (isTriggerOrder) {
|
|
52131
|
+
request['executive_price'] = this.priceToPrecision(symbol, price);
|
|
52132
|
+
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
52133
|
+
request['price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
52134
|
+
if (side === 'buy') {
|
|
52135
|
+
if (reduceOnly) {
|
|
52136
|
+
request['price_way'] = 2;
|
|
52137
|
+
}
|
|
52138
|
+
else {
|
|
52139
|
+
request['price_way'] = 1;
|
|
52140
|
+
}
|
|
52141
|
+
}
|
|
52142
|
+
else if (side === 'sell') {
|
|
52143
|
+
if (reduceOnly) {
|
|
52144
|
+
request['price_way'] = 1;
|
|
52145
|
+
}
|
|
52146
|
+
else {
|
|
52147
|
+
request['price_way'] = 2;
|
|
52148
|
+
}
|
|
52149
|
+
}
|
|
51979
52150
|
}
|
|
51980
52151
|
if (side === 'buy') {
|
|
51981
52152
|
if (reduceOnly) {
|
|
@@ -52002,7 +52173,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52002
52173
|
request['client_order_id'] = clientOrderId;
|
|
52003
52174
|
}
|
|
52004
52175
|
const leverage = this.safeInteger(params, 'leverage', 1);
|
|
52005
|
-
params = this.omit(params, 'leverage');
|
|
52176
|
+
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
|
|
52006
52177
|
request['leverage'] = this.numberToString(leverage);
|
|
52007
52178
|
return this.extend(request, params);
|
|
52008
52179
|
}
|
|
@@ -52084,10 +52255,11 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52084
52255
|
/**
|
|
52085
52256
|
* @method
|
|
52086
52257
|
* @name bitmart#cancelOrder
|
|
52258
|
+
* @description cancels an open order
|
|
52087
52259
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
|
52088
52260
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
|
52089
52261
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
52090
|
-
* @
|
|
52262
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
52091
52263
|
* @param {string} id order id
|
|
52092
52264
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
52093
52265
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -52297,6 +52469,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52297
52469
|
* @param {string} [params.type] *swap* order type, 'limit' or 'market'
|
|
52298
52470
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
52299
52471
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
52472
|
+
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
|
|
52300
52473
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
52301
52474
|
*/
|
|
52302
52475
|
await this.loadMarkets();
|
|
@@ -52329,8 +52502,12 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52329
52502
|
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
52330
52503
|
}
|
|
52331
52504
|
else if (type === 'swap') {
|
|
52332
|
-
const
|
|
52333
|
-
|
|
52505
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
52506
|
+
let orderType = this.safeString(params, 'orderType');
|
|
52507
|
+
params = this.omit(params, ['orderType', 'trailing']);
|
|
52508
|
+
if (trailing) {
|
|
52509
|
+
orderType = 'trailing';
|
|
52510
|
+
}
|
|
52334
52511
|
if (orderType !== undefined) {
|
|
52335
52512
|
request['type'] = orderType;
|
|
52336
52513
|
}
|
|
@@ -52476,6 +52653,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52476
52653
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52477
52654
|
* @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
|
|
52478
52655
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
|
|
52656
|
+
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
|
|
52479
52657
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
52480
52658
|
*/
|
|
52481
52659
|
await this.loadMarkets();
|
|
@@ -52503,8 +52681,12 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52503
52681
|
if (symbol === undefined) {
|
|
52504
52682
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
52505
52683
|
}
|
|
52506
|
-
const
|
|
52507
|
-
|
|
52684
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
52685
|
+
let orderType = this.safeString(params, 'orderType');
|
|
52686
|
+
params = this.omit(params, ['orderType', 'trailing']);
|
|
52687
|
+
if (trailing) {
|
|
52688
|
+
orderType = 'trailing';
|
|
52689
|
+
}
|
|
52508
52690
|
if (orderType !== undefined) {
|
|
52509
52691
|
request['type'] = orderType;
|
|
52510
52692
|
}
|
|
@@ -68739,7 +68921,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68739
68921
|
* @method
|
|
68740
68922
|
* @name bitvavo#createOrder
|
|
68741
68923
|
* @description create a trade order
|
|
68742
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
68924
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
|
|
68743
68925
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
68744
68926
|
* @param {string} type 'market' or 'limit'
|
|
68745
68927
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -68757,6 +68939,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68757
68939
|
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
68758
68940
|
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
68759
68941
|
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
68942
|
+
* @param {string} [params.clientOrderId] An ID supplied by the client that must be unique among all open orders for the same market
|
|
68760
68943
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
68761
68944
|
*/
|
|
68762
68945
|
await this.loadMarkets();
|
|
@@ -68867,25 +69050,54 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68867
69050
|
return this.parseOrder(response, market);
|
|
68868
69051
|
}
|
|
68869
69052
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
69053
|
+
/**
|
|
69054
|
+
* @method
|
|
69055
|
+
* @name bitvavo#editOrder
|
|
69056
|
+
* @description edit a trade order
|
|
69057
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/put
|
|
69058
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
69059
|
+
* @param {string} type 'market' or 'limit'
|
|
69060
|
+
* @param {string} side 'buy' or 'sell'
|
|
69061
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
69062
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
69063
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
69064
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
69065
|
+
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
69066
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
69067
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
69068
|
+
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
69069
|
+
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
69070
|
+
* @param {string} [params.clientOrderId] An ID supplied by the client
|
|
69071
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
69072
|
+
*/
|
|
68870
69073
|
await this.loadMarkets();
|
|
68871
69074
|
const market = this.market(symbol);
|
|
68872
|
-
|
|
69075
|
+
const request = {
|
|
69076
|
+
'market': market['id'],
|
|
69077
|
+
};
|
|
69078
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
69079
|
+
if (clientOrderId === undefined) {
|
|
69080
|
+
request['orderId'] = id;
|
|
69081
|
+
}
|
|
68873
69082
|
const amountRemaining = this.safeNumber(params, 'amountRemaining');
|
|
68874
|
-
|
|
69083
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
69084
|
+
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
69085
|
+
let updateRequest = {};
|
|
68875
69086
|
if (price !== undefined) {
|
|
68876
|
-
|
|
69087
|
+
updateRequest['price'] = this.priceToPrecision(symbol, price);
|
|
68877
69088
|
}
|
|
68878
69089
|
if (amount !== undefined) {
|
|
68879
|
-
|
|
69090
|
+
updateRequest['amount'] = this.amountToPrecision(symbol, amount);
|
|
68880
69091
|
}
|
|
68881
69092
|
if (amountRemaining !== undefined) {
|
|
68882
|
-
|
|
69093
|
+
updateRequest['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
68883
69094
|
}
|
|
68884
|
-
|
|
68885
|
-
|
|
68886
|
-
|
|
68887
|
-
|
|
68888
|
-
|
|
69095
|
+
if (triggerPrice !== undefined) {
|
|
69096
|
+
updateRequest['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
69097
|
+
}
|
|
69098
|
+
updateRequest = this.extend(updateRequest, params);
|
|
69099
|
+
if (Object.keys(updateRequest).length) {
|
|
69100
|
+
const response = await this.privatePutOrder(this.extend(request, updateRequest));
|
|
68889
69101
|
return this.parseOrder(response, market);
|
|
68890
69102
|
}
|
|
68891
69103
|
else {
|
|
@@ -68897,6 +69109,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68897
69109
|
* @method
|
|
68898
69110
|
* @name bitvavo#cancelOrder
|
|
68899
69111
|
* @description cancels an open order
|
|
69112
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
|
|
68900
69113
|
* @param {string} id order id
|
|
68901
69114
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
68902
69115
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -68908,9 +69121,12 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68908
69121
|
await this.loadMarkets();
|
|
68909
69122
|
const market = this.market(symbol);
|
|
68910
69123
|
const request = {
|
|
68911
|
-
'orderId': id,
|
|
68912
69124
|
'market': market['id'],
|
|
68913
69125
|
};
|
|
69126
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
69127
|
+
if (clientOrderId === undefined) {
|
|
69128
|
+
request['orderId'] = id;
|
|
69129
|
+
}
|
|
68914
69130
|
const response = await this.privateDeleteOrder(this.extend(request, params));
|
|
68915
69131
|
//
|
|
68916
69132
|
// {
|
|
@@ -68950,6 +69166,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68950
69166
|
* @method
|
|
68951
69167
|
* @name bitvavo#fetchOrder
|
|
68952
69168
|
* @description fetches information on an order made by the user
|
|
69169
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/get
|
|
68953
69170
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
68954
69171
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
68955
69172
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -68960,9 +69177,12 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
68960
69177
|
await this.loadMarkets();
|
|
68961
69178
|
const market = this.market(symbol);
|
|
68962
69179
|
const request = {
|
|
68963
|
-
'orderId': id,
|
|
68964
69180
|
'market': market['id'],
|
|
68965
69181
|
};
|
|
69182
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
69183
|
+
if (clientOrderId === undefined) {
|
|
69184
|
+
request['orderId'] = id;
|
|
69185
|
+
}
|
|
68966
69186
|
const response = await this.privateGetOrder(this.extend(request, params));
|
|
68967
69187
|
//
|
|
68968
69188
|
// {
|
|
@@ -69004,7 +69224,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
69004
69224
|
/**
|
|
69005
69225
|
* @method
|
|
69006
69226
|
* @name bitvavo#fetchOrders
|
|
69007
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
69227
|
+
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1orders/get
|
|
69008
69228
|
* @description fetches information on multiple orders made by the user
|
|
69009
69229
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
69010
69230
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -90573,6 +90793,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
90573
90793
|
},
|
|
90574
90794
|
'put': {
|
|
90575
90795
|
'balance/deposit/address/{coin_type}': 40,
|
|
90796
|
+
'sub_account/unfrozen': 40,
|
|
90797
|
+
'sub_account/frozen': 40,
|
|
90576
90798
|
'sub_account/auth/api/{user_auth_id}': 40,
|
|
90577
90799
|
'v1/account/settings': 40,
|
|
90578
90800
|
},
|
|
@@ -90582,7 +90804,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
90582
90804
|
'order/pending': 13.334,
|
|
90583
90805
|
'order/stop/pending': 40,
|
|
90584
90806
|
'order/stop/pending/{id}': 13.334,
|
|
90807
|
+
'order/pending/by_client_id': 40,
|
|
90808
|
+
'order/stop/pending/by_client_id': 40,
|
|
90585
90809
|
'sub_account/auth/api/{user_auth_id}': 40,
|
|
90810
|
+
'sub_account/authorize/{id}': 40,
|
|
90586
90811
|
},
|
|
90587
90812
|
},
|
|
90588
90813
|
'perpetualPublic': {
|
|
@@ -90596,12 +90821,12 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
90596
90821
|
'market/depth': 1,
|
|
90597
90822
|
'market/deals': 1,
|
|
90598
90823
|
'market/funding_history': 1,
|
|
90599
|
-
'market/user_deals': 1,
|
|
90600
90824
|
'market/kline': 1,
|
|
90601
90825
|
},
|
|
90602
90826
|
},
|
|
90603
90827
|
'perpetualPrivate': {
|
|
90604
90828
|
'get': {
|
|
90829
|
+
'market/user_deals': 1,
|
|
90605
90830
|
'asset/query': 40,
|
|
90606
90831
|
'order/pending': 8,
|
|
90607
90832
|
'order/finished': 40,
|
|
@@ -90609,8 +90834,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
90609
90834
|
'order/stop_pending': 8,
|
|
90610
90835
|
'order/status': 8,
|
|
90611
90836
|
'order/stop_status': 8,
|
|
90837
|
+
'position/finished': 40,
|
|
90612
90838
|
'position/pending': 40,
|
|
90613
90839
|
'position/funding': 40,
|
|
90840
|
+
'position/adl_history': 40,
|
|
90841
|
+
'market/preference': 40,
|
|
90842
|
+
'position/margin_history': 40,
|
|
90843
|
+
'position/settle_history': 40,
|
|
90614
90844
|
},
|
|
90615
90845
|
'post': {
|
|
90616
90846
|
'market/adjust_leverage': 1,
|
|
@@ -90632,6 +90862,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
90632
90862
|
'position/stop_loss': 20,
|
|
90633
90863
|
'position/take_profit': 20,
|
|
90634
90864
|
'position/market_close': 20,
|
|
90865
|
+
'order/cancel/by_client_id': 20,
|
|
90866
|
+
'order/cancel_stop/by_client_id': 20,
|
|
90867
|
+
'market/preference': 20,
|
|
90635
90868
|
},
|
|
90636
90869
|
},
|
|
90637
90870
|
},
|
|
@@ -91452,9 +91685,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
91452
91685
|
const priceString = this.safeString(trade, 'price');
|
|
91453
91686
|
const amountString = this.safeString(trade, 'amount');
|
|
91454
91687
|
const marketId = this.safeString(trade, 'market');
|
|
91455
|
-
const
|
|
91688
|
+
const marketType = this.safeString(trade, 'market_type');
|
|
91689
|
+
const defaultType = (marketType === undefined) ? 'spot' : 'swap';
|
|
91456
91690
|
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
91457
|
-
const symbol =
|
|
91691
|
+
const symbol = market['symbol'];
|
|
91458
91692
|
const costString = this.safeString(trade, 'deal_money');
|
|
91459
91693
|
let fee = undefined;
|
|
91460
91694
|
const feeCostString = this.safeString2(trade, 'fee', 'deal_fee');
|
|
@@ -92952,11 +93186,17 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92952
93186
|
* @description cancels an open order
|
|
92953
93187
|
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
|
92954
93188
|
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
|
93189
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade024_cancel_order_by_client_id
|
|
93190
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade025_cancel_stop_order_by_client_id
|
|
92955
93191
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
|
|
92956
93192
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
|
|
93193
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http042_cancel_order_by_client_id
|
|
93194
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http043_cancel_stop_order_by_client_id
|
|
92957
93195
|
* @param {string} id order id
|
|
92958
93196
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
92959
93197
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
93198
|
+
* @param {string} [params.clientOrderId] client order id, defaults to id if not passed
|
|
93199
|
+
* @param {boolean} [params.stop] if stop order = true, default = false
|
|
92960
93200
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
92961
93201
|
*/
|
|
92962
93202
|
if (symbol === undefined) {
|
|
@@ -92969,32 +93209,54 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92969
93209
|
const request = {
|
|
92970
93210
|
'market': market['id'],
|
|
92971
93211
|
};
|
|
92972
|
-
const idRequest = swap ? 'order_id' : 'id';
|
|
92973
|
-
request[idRequest] = id;
|
|
92974
93212
|
const accountId = this.safeInteger(params, 'account_id');
|
|
92975
93213
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
93214
|
+
const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
|
|
92976
93215
|
if (defaultType === 'margin') {
|
|
92977
93216
|
if (accountId === undefined) {
|
|
92978
93217
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' cancelOrder() requires an account_id parameter for margin orders');
|
|
92979
93218
|
}
|
|
92980
93219
|
request['account_id'] = accountId;
|
|
92981
93220
|
}
|
|
92982
|
-
const query = this.omit(params, ['stop', 'account_id']);
|
|
93221
|
+
const query = this.omit(params, ['stop', 'account_id', 'clientOrderId']);
|
|
92983
93222
|
let response = undefined;
|
|
92984
|
-
if (
|
|
92985
|
-
|
|
92986
|
-
|
|
93223
|
+
if (clientOrderId !== undefined) {
|
|
93224
|
+
request['client_id'] = clientOrderId;
|
|
93225
|
+
if (stop) {
|
|
93226
|
+
if (swap) {
|
|
93227
|
+
response = await this.perpetualPrivatePostOrderCancelStopByClientId(this.extend(request, query));
|
|
93228
|
+
}
|
|
93229
|
+
else {
|
|
93230
|
+
response = await this.privateDeleteOrderStopPendingByClientId(this.extend(request, query));
|
|
93231
|
+
}
|
|
92987
93232
|
}
|
|
92988
93233
|
else {
|
|
92989
|
-
|
|
93234
|
+
if (swap) {
|
|
93235
|
+
response = await this.perpetualPrivatePostOrderCancelByClientId(this.extend(request, query));
|
|
93236
|
+
}
|
|
93237
|
+
else {
|
|
93238
|
+
response = await this.privateDeleteOrderPendingByClientId(this.extend(request, query));
|
|
93239
|
+
}
|
|
92990
93240
|
}
|
|
92991
93241
|
}
|
|
92992
93242
|
else {
|
|
92993
|
-
|
|
92994
|
-
|
|
93243
|
+
const idRequest = swap ? 'order_id' : 'id';
|
|
93244
|
+
request[idRequest] = id;
|
|
93245
|
+
if (stop) {
|
|
93246
|
+
if (swap) {
|
|
93247
|
+
response = await this.perpetualPrivatePostOrderCancelStop(this.extend(request, query));
|
|
93248
|
+
}
|
|
93249
|
+
else {
|
|
93250
|
+
response = await this.privateDeleteOrderStopPendingId(this.extend(request, query));
|
|
93251
|
+
}
|
|
92995
93252
|
}
|
|
92996
93253
|
else {
|
|
92997
|
-
|
|
93254
|
+
if (swap) {
|
|
93255
|
+
response = await this.perpetualPrivatePostOrderCancel(this.extend(request, query));
|
|
93256
|
+
}
|
|
93257
|
+
else {
|
|
93258
|
+
response = await this.privateDeleteOrderPending(this.extend(request, query));
|
|
93259
|
+
}
|
|
92998
93260
|
}
|
|
92999
93261
|
}
|
|
93000
93262
|
//
|
|
@@ -93736,16 +93998,11 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93736
93998
|
}
|
|
93737
93999
|
let response = undefined;
|
|
93738
94000
|
if (swap) {
|
|
93739
|
-
const side = this.safeInteger(params, 'side');
|
|
93740
|
-
if (side === undefined) {
|
|
93741
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a side parameter for swap markets');
|
|
93742
|
-
}
|
|
93743
94001
|
if (since !== undefined) {
|
|
93744
94002
|
request['start_time'] = since;
|
|
93745
94003
|
}
|
|
93746
|
-
request['side'] =
|
|
93747
|
-
|
|
93748
|
-
response = await this.perpetualPublicGetMarketUserDeals(this.extend(request, params));
|
|
94004
|
+
request['side'] = 0;
|
|
94005
|
+
response = await this.perpetualPrivateGetMarketUserDeals(this.extend(request, params));
|
|
93749
94006
|
}
|
|
93750
94007
|
else {
|
|
93751
94008
|
request['page'] = 1;
|
|
@@ -95674,7 +95931,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95674
95931
|
}
|
|
95675
95932
|
}
|
|
95676
95933
|
}
|
|
95677
|
-
if (api === 'perpetualPrivate'
|
|
95934
|
+
if (api === 'perpetualPrivate') {
|
|
95678
95935
|
this.checkRequiredCredentials();
|
|
95679
95936
|
query = this.extend({
|
|
95680
95937
|
'access_id': this.apiKey,
|
|
@@ -151624,7 +151881,9 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151624
151881
|
* @param {bool} [params.reduceOnly] *margin only* indicates if this order is to reduce the size of a position
|
|
151625
151882
|
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
151626
151883
|
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
151627
|
-
* @param {string} [params.
|
|
151884
|
+
* @param {string} [params.trailingAmount] *margin only* the quote amount to trail away from the current market price
|
|
151885
|
+
* @param {string} [params.trailingLimitAmount] *margin only* the quote amount away from the trailingAmount
|
|
151886
|
+
* @param {string} [params.offset] *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-'
|
|
151628
151887
|
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
151629
151888
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
151630
151889
|
*/
|
|
@@ -151885,9 +152144,10 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151885
152144
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
151886
152145
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
151887
152146
|
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
151888
|
-
const
|
|
151889
|
-
const
|
|
151890
|
-
|
|
152147
|
+
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
152148
|
+
const trailingLimitAmount = this.safeString(params, 'trailingLimitAmount');
|
|
152149
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
152150
|
+
if ((type === 'limit') && !isTrailingAmountOrder) {
|
|
151891
152151
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
151892
152152
|
}
|
|
151893
152153
|
let reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
@@ -151903,19 +152163,19 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151903
152163
|
request['price2'] = this.priceToPrecision(symbol, price);
|
|
151904
152164
|
reduceOnly = true;
|
|
151905
152165
|
}
|
|
151906
|
-
else if (
|
|
151907
|
-
const
|
|
151908
|
-
const
|
|
151909
|
-
request['trigger'] =
|
|
151910
|
-
|
|
151911
|
-
|
|
151912
|
-
const
|
|
151913
|
-
request['price'] =
|
|
151914
|
-
request['price2'] =
|
|
152166
|
+
else if (isTrailingAmountOrder) {
|
|
152167
|
+
const trailingActivationPriceType = this.safeString(params, 'trigger', 'last');
|
|
152168
|
+
const trailingAmountString = '+' + trailingAmount;
|
|
152169
|
+
request['trigger'] = trailingActivationPriceType;
|
|
152170
|
+
if ((type === 'limit') || (trailingLimitAmount !== undefined)) {
|
|
152171
|
+
const offset = this.safeString(params, 'offset', '-');
|
|
152172
|
+
const trailingLimitAmountString = offset + this.numberToString(trailingLimitAmount);
|
|
152173
|
+
request['price'] = trailingAmountString;
|
|
152174
|
+
request['price2'] = trailingLimitAmountString;
|
|
151915
152175
|
request['ordertype'] = 'trailing-stop-limit';
|
|
151916
152176
|
}
|
|
151917
152177
|
else {
|
|
151918
|
-
request['price'] =
|
|
152178
|
+
request['price'] = trailingAmountString;
|
|
151919
152179
|
request['ordertype'] = 'trailing-stop';
|
|
151920
152180
|
}
|
|
151921
152181
|
}
|
|
@@ -151945,7 +152205,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151945
152205
|
if (postOnly) {
|
|
151946
152206
|
request['oflags'] = 'post';
|
|
151947
152207
|
}
|
|
151948
|
-
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', '
|
|
152208
|
+
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
|
|
151949
152209
|
return [request, params];
|
|
151950
152210
|
}
|
|
151951
152211
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -151963,7 +152223,9 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151963
152223
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
151964
152224
|
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
151965
152225
|
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
151966
|
-
* @param {string} [params.
|
|
152226
|
+
* @param {string} [params.trailingAmount] *margin only* the quote price away from the current market price
|
|
152227
|
+
* @param {string} [params.trailingLimitAmount] *margin only* the quote amount away from the trailingAmount
|
|
152228
|
+
* @param {string} [params.offset] *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-'
|
|
151967
152229
|
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
151968
152230
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
151969
152231
|
*/
|
|
@@ -205624,7 +205886,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
205624
205886
|
'watchBalance': true,
|
|
205625
205887
|
'watchMyTrades': true,
|
|
205626
205888
|
'watchOHLCV': true,
|
|
205627
|
-
'watchOHLCVForSymbols':
|
|
205889
|
+
'watchOHLCVForSymbols': false,
|
|
205628
205890
|
'watchOrderBook': true,
|
|
205629
205891
|
'watchOrderBookForSymbols': true,
|
|
205630
205892
|
'watchOrders': true,
|
|
@@ -211347,7 +211609,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
211347
211609
|
'watchBalance': true,
|
|
211348
211610
|
'watchMyTrades': true,
|
|
211349
211611
|
'watchOHLCV': true,
|
|
211350
|
-
'watchOHLCVForSymbols':
|
|
211612
|
+
'watchOHLCVForSymbols': false,
|
|
211351
211613
|
'watchOrderBook': true,
|
|
211352
211614
|
'watchOrderBookForSymbols': true,
|
|
211353
211615
|
'watchOrders': true,
|
|
@@ -220342,7 +220604,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
220342
220604
|
'watchBalance': true,
|
|
220343
220605
|
'watchMyTrades': true,
|
|
220344
220606
|
'watchOHLCV': true,
|
|
220345
|
-
'watchOHLCVForSymbols':
|
|
220607
|
+
'watchOHLCVForSymbols': false,
|
|
220346
220608
|
'watchOrderBook': true,
|
|
220347
220609
|
'watchOrderBookForSymbols': true,
|
|
220348
220610
|
'watchOrders': true,
|
|
@@ -288636,7 +288898,7 @@ SOFTWARE.
|
|
|
288636
288898
|
|
|
288637
288899
|
//-----------------------------------------------------------------------------
|
|
288638
288900
|
// this is updated by vss.js when building
|
|
288639
|
-
const version = '4.1.
|
|
288901
|
+
const version = '4.1.99';
|
|
288640
288902
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288641
288903
|
//-----------------------------------------------------------------------------
|
|
288642
288904
|
|