ccxt 4.1.37 → 4.1.38
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 +321 -62
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitforex.js +25 -0
- package/dist/cjs/src/bybit.js +1 -0
- package/dist/cjs/src/digifinex.js +204 -52
- package/dist/cjs/src/huobi.js +18 -2
- package/dist/cjs/src/pro/bitget.js +50 -7
- package/dist/cjs/src/wazirx.js +22 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/bitforex.js +25 -0
- package/js/src/bybit.js +1 -0
- package/js/src/digifinex.d.ts +3 -1
- package/js/src/digifinex.js +204 -52
- package/js/src/huobi.js +18 -2
- package/js/src/pro/bitget.js +50 -7
- package/js/src/wazirx.js +22 -0
- package/package.json +1 -1
- package/skip-tests.json +6 -1
package/README.md
CHANGED
|
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
215
215
|
|
|
216
216
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
217
217
|
|
|
218
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
219
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
|
218
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.38/dist/ccxt.browser.js
|
|
219
|
+
* unpkg: https://unpkg.com/ccxt@4.1.38/dist/ccxt.browser.js
|
|
220
220
|
|
|
221
221
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
222
222
|
|
|
223
223
|
```HTML
|
|
224
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
224
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.38/dist/ccxt.browser.js"></script>
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -38242,26 +38242,45 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
38242
38242
|
'swap': false,
|
|
38243
38243
|
'future': false,
|
|
38244
38244
|
'option': false,
|
|
38245
|
+
'addMargin': false,
|
|
38246
|
+
'borrowMargin': false,
|
|
38245
38247
|
'cancelOrder': true,
|
|
38246
38248
|
'createOrder': true,
|
|
38249
|
+
'createReduceOnlyOrder': false,
|
|
38247
38250
|
'createStopLimitOrder': false,
|
|
38248
38251
|
'createStopMarketOrder': false,
|
|
38249
38252
|
'createStopOrder': false,
|
|
38250
38253
|
'fetchBalance': true,
|
|
38254
|
+
'fetchBorrowInterest': false,
|
|
38251
38255
|
'fetchBorrowRate': false,
|
|
38252
38256
|
'fetchBorrowRateHistories': false,
|
|
38253
38257
|
'fetchBorrowRateHistory': false,
|
|
38254
38258
|
'fetchBorrowRates': false,
|
|
38255
38259
|
'fetchBorrowRatesPerSymbol': false,
|
|
38256
38260
|
'fetchClosedOrders': true,
|
|
38261
|
+
'fetchFundingHistory': false,
|
|
38262
|
+
'fetchFundingRate': false,
|
|
38263
|
+
'fetchFundingRateHistory': false,
|
|
38264
|
+
'fetchFundingRates': false,
|
|
38265
|
+
'fetchIndexOHLCV': false,
|
|
38266
|
+
'fetchIsolatedPositions': false,
|
|
38267
|
+
'fetchLeverage': false,
|
|
38268
|
+
'fetchLeverageTiers': false,
|
|
38257
38269
|
'fetchMarginMode': false,
|
|
38270
|
+
'fetchMarketLeverageTiers': false,
|
|
38258
38271
|
'fetchMarkets': true,
|
|
38272
|
+
'fetchMarkOHLCV': false,
|
|
38259
38273
|
'fetchMyTrades': true,
|
|
38260
38274
|
'fetchOHLCV': true,
|
|
38275
|
+
'fetchOpenInterestHistory': false,
|
|
38261
38276
|
'fetchOpenOrders': true,
|
|
38262
38277
|
'fetchOrder': true,
|
|
38263
38278
|
'fetchOrderBook': true,
|
|
38279
|
+
'fetchPosition': false,
|
|
38264
38280
|
'fetchPositionMode': false,
|
|
38281
|
+
'fetchPositions': false,
|
|
38282
|
+
'fetchPositionsRisk': false,
|
|
38283
|
+
'fetchPremiumIndexOHLCV': false,
|
|
38265
38284
|
'fetchTicker': true,
|
|
38266
38285
|
'fetchTickers': false,
|
|
38267
38286
|
'fetchTrades': true,
|
|
@@ -38270,6 +38289,12 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
38270
38289
|
'fetchTransfers': false,
|
|
38271
38290
|
'fetchWithdrawal': false,
|
|
38272
38291
|
'fetchWithdrawals': false,
|
|
38292
|
+
'reduceMargin': false,
|
|
38293
|
+
'repayMargin': false,
|
|
38294
|
+
'setLeverage': false,
|
|
38295
|
+
'setMargin': false,
|
|
38296
|
+
'setMarginMode': false,
|
|
38297
|
+
'setPositionMode': false,
|
|
38273
38298
|
'transfer': false,
|
|
38274
38299
|
'withdraw': false,
|
|
38275
38300
|
},
|
|
@@ -74639,6 +74664,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74639
74664
|
'v5/user/query-api': 5,
|
|
74640
74665
|
'v5/user/get-member-type': 5,
|
|
74641
74666
|
'v5/user/aff-customer-info': 5,
|
|
74667
|
+
'v5/user/del-submember': 5,
|
|
74642
74668
|
// spot leverage token
|
|
74643
74669
|
'v5/spot-lever-token/order-record': 1,
|
|
74644
74670
|
// spot margin trade
|
|
@@ -111220,6 +111246,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
111220
111246
|
'cancelOrder': true,
|
|
111221
111247
|
'cancelOrders': true,
|
|
111222
111248
|
'createOrder': true,
|
|
111249
|
+
'createOrders': true,
|
|
111223
111250
|
'createPostOnlyOrder': true,
|
|
111224
111251
|
'createReduceOnlyOrder': true,
|
|
111225
111252
|
'createStopLimitOrder': false,
|
|
@@ -111477,6 +111504,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
111477
111504
|
'options': {
|
|
111478
111505
|
'defaultType': 'spot',
|
|
111479
111506
|
'types': ['spot', 'margin', 'otc'],
|
|
111507
|
+
'createMarketBuyOrderRequiresPrice': true,
|
|
111480
111508
|
'accountsByType': {
|
|
111481
111509
|
'spot': '1',
|
|
111482
111510
|
'margin': '2',
|
|
@@ -112740,28 +112768,173 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
112740
112768
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
112741
112769
|
* @param {string} type 'market' or 'limit'
|
|
112742
112770
|
* @param {string} side 'buy' or 'sell'
|
|
112743
|
-
* @param {float} amount how much
|
|
112771
|
+
* @param {float} amount how much you want to trade in units of the base currency, spot market orders use the quote currency, swap requires the number of contracts
|
|
112744
112772
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
112745
112773
|
* @param {object} [params] extra parameters specific to the digifinex api endpoint
|
|
112746
112774
|
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
112747
112775
|
* @param {bool} [params.postOnly] true or false
|
|
112748
112776
|
* @param {bool} [params.reduceOnly] true or false
|
|
112777
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
112749
112778
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
112750
112779
|
*/
|
|
112751
112780
|
await this.loadMarkets();
|
|
112752
112781
|
const market = this.market(symbol);
|
|
112753
|
-
|
|
112782
|
+
const marginResult = this.handleMarginModeAndParams('createOrder', params);
|
|
112783
|
+
const marginMode = marginResult[0];
|
|
112784
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
112785
|
+
let response = undefined;
|
|
112786
|
+
if (market['swap']) {
|
|
112787
|
+
response = await this.privateSwapPostTradeOrderPlace(request);
|
|
112788
|
+
}
|
|
112789
|
+
else {
|
|
112790
|
+
if (marginMode !== undefined) {
|
|
112791
|
+
response = await this.privateSpotPostMarginOrderNew(request);
|
|
112792
|
+
}
|
|
112793
|
+
else {
|
|
112794
|
+
response = await this.privateSpotPostSpotOrderNew(request);
|
|
112795
|
+
}
|
|
112796
|
+
}
|
|
112797
|
+
//
|
|
112798
|
+
// spot and margin
|
|
112799
|
+
//
|
|
112800
|
+
// {
|
|
112801
|
+
// "code": 0,
|
|
112802
|
+
// "order_id": "198361cecdc65f9c8c9bb2fa68faec40"
|
|
112803
|
+
// }
|
|
112804
|
+
//
|
|
112805
|
+
// swap
|
|
112806
|
+
//
|
|
112807
|
+
// {
|
|
112808
|
+
// "code": 0,
|
|
112809
|
+
// "data": "1590873693003714560"
|
|
112810
|
+
// }
|
|
112811
|
+
//
|
|
112812
|
+
const order = this.parseOrder(response, market);
|
|
112813
|
+
order['symbol'] = market['symbol'];
|
|
112814
|
+
order['type'] = type;
|
|
112815
|
+
order['side'] = side;
|
|
112816
|
+
order['amount'] = amount;
|
|
112817
|
+
order['price'] = price;
|
|
112818
|
+
return order;
|
|
112819
|
+
}
|
|
112820
|
+
async createOrders(orders, params = {}) {
|
|
112821
|
+
/**
|
|
112822
|
+
* @method
|
|
112823
|
+
* @name digifinex#createOrders
|
|
112824
|
+
* @description create a list of trade orders (all orders should be of the same symbol)
|
|
112825
|
+
* @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order
|
|
112826
|
+
* @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder
|
|
112827
|
+
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
112828
|
+
* @param {object} [params] extra parameters specific to the digifinex api endpoint
|
|
112829
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
112830
|
+
*/
|
|
112831
|
+
await this.loadMarkets();
|
|
112832
|
+
const ordersRequests = [];
|
|
112833
|
+
let symbol = undefined;
|
|
112834
|
+
let marginMode = undefined;
|
|
112835
|
+
for (let i = 0; i < orders.length; i++) {
|
|
112836
|
+
const rawOrder = orders[i];
|
|
112837
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
112838
|
+
if (symbol === undefined) {
|
|
112839
|
+
symbol = marketId;
|
|
112840
|
+
}
|
|
112841
|
+
else {
|
|
112842
|
+
if (symbol !== marketId) {
|
|
112843
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
112844
|
+
}
|
|
112845
|
+
}
|
|
112846
|
+
const type = this.safeString(rawOrder, 'type');
|
|
112847
|
+
const side = this.safeString(rawOrder, 'side');
|
|
112848
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
112849
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
112850
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
112851
|
+
const marginResult = this.handleMarginModeAndParams('createOrders', params);
|
|
112852
|
+
const currentMarginMode = marginResult[0];
|
|
112853
|
+
if (currentMarginMode !== undefined) {
|
|
112854
|
+
if (marginMode === undefined) {
|
|
112855
|
+
marginMode = currentMarginMode;
|
|
112856
|
+
}
|
|
112857
|
+
else {
|
|
112858
|
+
if (marginMode !== currentMarginMode) {
|
|
112859
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
|
|
112860
|
+
}
|
|
112861
|
+
}
|
|
112862
|
+
}
|
|
112863
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
112864
|
+
ordersRequests.push(orderRequest);
|
|
112865
|
+
}
|
|
112866
|
+
const market = this.market(symbol);
|
|
112867
|
+
const request = {};
|
|
112868
|
+
let response = undefined;
|
|
112869
|
+
if (market['swap']) {
|
|
112870
|
+
response = await this.privateSwapPostTradeBatchOrder(ordersRequests);
|
|
112871
|
+
}
|
|
112872
|
+
else {
|
|
112873
|
+
request['market'] = (marginMode !== undefined) ? 'margin' : 'spot';
|
|
112874
|
+
request['symbol'] = market['id'];
|
|
112875
|
+
request['list'] = this.json(ordersRequests);
|
|
112876
|
+
response = await this.privateSpotPostMarketOrderBatchNew(request);
|
|
112877
|
+
}
|
|
112878
|
+
//
|
|
112879
|
+
// spot
|
|
112880
|
+
//
|
|
112881
|
+
// {
|
|
112882
|
+
// "code": 0,
|
|
112883
|
+
// "order_ids": [
|
|
112884
|
+
// "064290fbe2d26e7b28d7e6c0a5cf70a5",
|
|
112885
|
+
// "24c8f9b73d81e4d9d8d7e3280281c258"
|
|
112886
|
+
// ]
|
|
112887
|
+
// }
|
|
112888
|
+
//
|
|
112889
|
+
// swap
|
|
112890
|
+
//
|
|
112891
|
+
// {
|
|
112892
|
+
// "code": 0,
|
|
112893
|
+
// "data": [
|
|
112894
|
+
// "1720297963537829888",
|
|
112895
|
+
// "1720297963537829889"
|
|
112896
|
+
// ]
|
|
112897
|
+
// }
|
|
112898
|
+
//
|
|
112899
|
+
let data = [];
|
|
112900
|
+
if (market['swap']) {
|
|
112901
|
+
data = this.safeValue(response, 'data', []);
|
|
112902
|
+
}
|
|
112903
|
+
else {
|
|
112904
|
+
data = this.safeValue(response, 'order_ids', []);
|
|
112905
|
+
}
|
|
112906
|
+
const result = [];
|
|
112907
|
+
for (let i = 0; i < orders.length; i++) {
|
|
112908
|
+
const rawOrder = orders[i];
|
|
112909
|
+
const individualOrder = {};
|
|
112910
|
+
individualOrder['order_id'] = data[i];
|
|
112911
|
+
individualOrder['instrument_id'] = market['id'];
|
|
112912
|
+
individualOrder['amount'] = this.safeNumber(rawOrder, 'amount');
|
|
112913
|
+
individualOrder['price'] = this.safeNumber(rawOrder, 'price');
|
|
112914
|
+
result.push(individualOrder);
|
|
112915
|
+
}
|
|
112916
|
+
return this.parseOrders(result, market);
|
|
112917
|
+
}
|
|
112918
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
112919
|
+
/**
|
|
112920
|
+
* @method
|
|
112921
|
+
* @ignore
|
|
112922
|
+
* @name digifinex#createOrderRequest
|
|
112923
|
+
* @description helper function to build request
|
|
112924
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
112925
|
+
* @param {string} type 'market' or 'limit'
|
|
112926
|
+
* @param {string} side 'buy' or 'sell'
|
|
112927
|
+
* @param {float} amount how much you want to trade in units of the base currency, spot market orders use the quote currency, swap requires the number of contracts
|
|
112928
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
112929
|
+
* @param {object} [params] extra parameters specific to the digifinex api endpoint
|
|
112930
|
+
* @returns {object} request to be sent to the exchange
|
|
112931
|
+
*/
|
|
112932
|
+
const market = this.market(symbol);
|
|
112754
112933
|
let marketType = undefined;
|
|
112755
112934
|
let marginMode = undefined;
|
|
112756
|
-
[marketType, params] = this.handleMarketTypeAndParams('
|
|
112757
|
-
|
|
112758
|
-
'spot': 'privateSpotPostSpotOrderNew',
|
|
112759
|
-
'margin': 'privateSpotPostMarginOrderNew',
|
|
112760
|
-
'swap': 'privateSwapPostTradeOrderPlace',
|
|
112761
|
-
});
|
|
112762
|
-
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
112935
|
+
[marketType, params] = this.handleMarketTypeAndParams('createOrderRequest', market, params);
|
|
112936
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrderRequest', params);
|
|
112763
112937
|
if (marginMode !== undefined) {
|
|
112764
|
-
method = 'privateSpotPostMarginOrderNew';
|
|
112765
112938
|
marketType = 'margin';
|
|
112766
112939
|
}
|
|
112767
112940
|
const request = {};
|
|
@@ -112818,40 +112991,34 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
112818
112991
|
}
|
|
112819
112992
|
request['type'] = side + suffix;
|
|
112820
112993
|
// limit orders require the amount in the base currency, market orders require the amount in the quote currency
|
|
112821
|
-
|
|
112994
|
+
let quantity = undefined;
|
|
112995
|
+
const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
112996
|
+
if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
|
|
112997
|
+
if (price === undefined) {
|
|
112998
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
|
|
112999
|
+
}
|
|
113000
|
+
else {
|
|
113001
|
+
const amountString = this.numberToString(amount);
|
|
113002
|
+
const priceString = this.numberToString(price);
|
|
113003
|
+
const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(amountString, priceString));
|
|
113004
|
+
quantity = this.priceToPrecision(symbol, cost);
|
|
113005
|
+
}
|
|
113006
|
+
}
|
|
113007
|
+
else {
|
|
113008
|
+
quantity = this.amountToPrecision(symbol, amount);
|
|
113009
|
+
}
|
|
113010
|
+
request['amount'] = quantity;
|
|
112822
113011
|
}
|
|
112823
113012
|
if (postOnly) {
|
|
112824
113013
|
if (postOnlyParsed) {
|
|
112825
|
-
request['
|
|
113014
|
+
request['post_only'] = postOnlyParsed;
|
|
112826
113015
|
}
|
|
112827
113016
|
else {
|
|
112828
|
-
request['
|
|
113017
|
+
request['post_only'] = postOnly;
|
|
112829
113018
|
}
|
|
112830
113019
|
}
|
|
112831
|
-
|
|
112832
|
-
|
|
112833
|
-
//
|
|
112834
|
-
// spot and margin
|
|
112835
|
-
//
|
|
112836
|
-
// {
|
|
112837
|
-
// "code": 0,
|
|
112838
|
-
// "order_id": "198361cecdc65f9c8c9bb2fa68faec40"
|
|
112839
|
-
// }
|
|
112840
|
-
//
|
|
112841
|
-
// swap
|
|
112842
|
-
//
|
|
112843
|
-
// {
|
|
112844
|
-
// "code": 0,
|
|
112845
|
-
// "data": "1590873693003714560"
|
|
112846
|
-
// }
|
|
112847
|
-
//
|
|
112848
|
-
const order = this.parseOrder(response, market);
|
|
112849
|
-
order['symbol'] = symbol;
|
|
112850
|
-
order['type'] = type;
|
|
112851
|
-
order['side'] = side;
|
|
112852
|
-
order['amount'] = amount;
|
|
112853
|
-
order['price'] = price;
|
|
112854
|
-
return order;
|
|
113020
|
+
params = this.omit(params, ['postOnly']);
|
|
113021
|
+
return this.extend(request, params);
|
|
112855
113022
|
}
|
|
112856
113023
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
112857
113024
|
/**
|
|
@@ -112988,6 +113155,15 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
112988
113155
|
// "data": "1590873693003714560"
|
|
112989
113156
|
// }
|
|
112990
113157
|
//
|
|
113158
|
+
// spot and swap: createOrders
|
|
113159
|
+
//
|
|
113160
|
+
// {
|
|
113161
|
+
// "order_id": "d64d92a5e0a120f792f385485bc3d95b",
|
|
113162
|
+
// "instrument_id": "BTC_USDT",
|
|
113163
|
+
// "amount": 0.0001,
|
|
113164
|
+
// "price": 27000
|
|
113165
|
+
// }
|
|
113166
|
+
//
|
|
112991
113167
|
// spot: fetchOrder, fetchOpenOrders, fetchOrders
|
|
112992
113168
|
//
|
|
112993
113169
|
// {
|
|
@@ -113033,24 +113209,26 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
113033
113209
|
let type = undefined;
|
|
113034
113210
|
let side = this.safeString(order, 'type');
|
|
113035
113211
|
const marketId = this.safeString2(order, 'symbol', 'instrument_id');
|
|
113036
|
-
const symbol = this.safeSymbol(marketId, market
|
|
113212
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
113037
113213
|
market = this.market(symbol);
|
|
113038
113214
|
if (market['type'] === 'swap') {
|
|
113039
113215
|
const orderType = this.safeInteger(order, 'order_type');
|
|
113040
|
-
if (
|
|
113041
|
-
|
|
113042
|
-
|
|
113043
|
-
|
|
113044
|
-
|
|
113045
|
-
|
|
113046
|
-
|
|
113047
|
-
|
|
113048
|
-
|
|
113049
|
-
|
|
113050
|
-
|
|
113051
|
-
|
|
113052
|
-
|
|
113053
|
-
|
|
113216
|
+
if (orderType !== undefined) {
|
|
113217
|
+
if ((orderType === 9) || (orderType === 10) || (orderType === 11) || (orderType === 12) || (orderType === 15)) {
|
|
113218
|
+
timeInForce = 'FOK';
|
|
113219
|
+
}
|
|
113220
|
+
else if ((orderType === 1) || (orderType === 2) || (orderType === 3) || (orderType === 4) || (orderType === 13)) {
|
|
113221
|
+
timeInForce = 'IOC';
|
|
113222
|
+
}
|
|
113223
|
+
else if ((orderType === 6) || (orderType === 7) || (orderType === 8) || (orderType === 14)) {
|
|
113224
|
+
timeInForce = 'GTC';
|
|
113225
|
+
}
|
|
113226
|
+
if ((orderType === 0) || (orderType === 1) || (orderType === 4) || (orderType === 5) || (orderType === 9) || (orderType === 10)) {
|
|
113227
|
+
type = 'limit';
|
|
113228
|
+
}
|
|
113229
|
+
else {
|
|
113230
|
+
type = 'market';
|
|
113231
|
+
}
|
|
113054
113232
|
}
|
|
113055
113233
|
if (side === '1') {
|
|
113056
113234
|
side = 'open long';
|
|
@@ -136372,6 +136550,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136372
136550
|
* @param {string} [params.offset] *contract only* 'open', 'close', or 'both', required in hedge mode
|
|
136373
136551
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
136374
136552
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
136553
|
+
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
136375
136554
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
136376
136555
|
*/
|
|
136377
136556
|
await this.loadMarkets();
|
|
@@ -136444,6 +136623,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136444
136623
|
if (postOnly) {
|
|
136445
136624
|
orderType = 'limit-maker';
|
|
136446
136625
|
}
|
|
136626
|
+
const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
|
|
136627
|
+
if (timeInForce === 'FOK') {
|
|
136628
|
+
orderType = orderType + '-fok';
|
|
136629
|
+
}
|
|
136630
|
+
else if (timeInForce === 'IOC') {
|
|
136631
|
+
orderType = 'ioc';
|
|
136632
|
+
}
|
|
136447
136633
|
request['type'] = side + '-' + orderType;
|
|
136448
136634
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client-order-id'); // must be 64 chars max and unique within 24 hours
|
|
136449
136635
|
if (clientOrderId === undefined) {
|
|
@@ -136491,7 +136677,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136491
136677
|
if (orderType in limitOrderTypes) {
|
|
136492
136678
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
136493
136679
|
}
|
|
136494
|
-
params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator']);
|
|
136680
|
+
params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator', 'timeInForce']);
|
|
136495
136681
|
const response = await this.spotPrivatePostV1OrderOrdersPlace(this.extend(request, params));
|
|
136496
136682
|
//
|
|
136497
136683
|
// spot
|
|
@@ -136536,6 +136722,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136536
136722
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
136537
136723
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
136538
136724
|
* @param {object} params extra parameters specific to the huobi api endpoint
|
|
136725
|
+
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
136539
136726
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
136540
136727
|
*/
|
|
136541
136728
|
const market = this.market(symbol);
|
|
@@ -136549,6 +136736,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136549
136736
|
if (postOnly) {
|
|
136550
136737
|
type = 'post_only';
|
|
136551
136738
|
}
|
|
136739
|
+
const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
|
|
136740
|
+
if (timeInForce === 'FOK') {
|
|
136741
|
+
type = 'fok';
|
|
136742
|
+
}
|
|
136743
|
+
else if (timeInForce === 'IOC') {
|
|
136744
|
+
type = 'ioc';
|
|
136745
|
+
}
|
|
136552
136746
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
|
|
136553
136747
|
const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
|
|
136554
136748
|
const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
|
|
@@ -136601,7 +136795,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136601
136795
|
request['lever_rate'] = leverRate;
|
|
136602
136796
|
request['order_price_type'] = type;
|
|
136603
136797
|
}
|
|
136604
|
-
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate']);
|
|
136798
|
+
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce']);
|
|
136605
136799
|
const broker = this.safeValue(this.options, 'broker', {});
|
|
136606
136800
|
const brokerId = this.safeString(broker, 'id');
|
|
136607
136801
|
request['channel_code'] = brokerId;
|
|
@@ -205806,6 +206000,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205806
206000
|
/**
|
|
205807
206001
|
* @method
|
|
205808
206002
|
* @name bitget#watchOrders
|
|
206003
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#order-channel
|
|
206004
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#order-channel
|
|
206005
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#plan-order-channel
|
|
205809
206006
|
* @description watches information on multiple orders made by the user
|
|
205810
206007
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
205811
206008
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -205816,7 +206013,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205816
206013
|
await this.loadMarkets();
|
|
205817
206014
|
let market = undefined;
|
|
205818
206015
|
let marketId = undefined;
|
|
205819
|
-
|
|
206016
|
+
const isStop = this.safeValue(params, 'stop', false);
|
|
206017
|
+
params = this.omit(params, 'stop');
|
|
206018
|
+
let messageHash = (isStop) ? 'triggerOrder' : 'order';
|
|
205820
206019
|
let subscriptionHash = 'order:trades';
|
|
205821
206020
|
if (symbol !== undefined) {
|
|
205822
206021
|
market = this.market(symbol);
|
|
@@ -205824,8 +206023,6 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205824
206023
|
marketId = market['id'];
|
|
205825
206024
|
messageHash = messageHash + ':' + symbol;
|
|
205826
206025
|
}
|
|
205827
|
-
const isStop = this.safeValue(params, 'stop', false);
|
|
205828
|
-
params = this.omit(params, 'stop');
|
|
205829
206026
|
let type = undefined;
|
|
205830
206027
|
[type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
|
|
205831
206028
|
if ((type === 'spot') && (symbol === undefined)) {
|
|
@@ -205848,6 +206045,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205848
206045
|
instType = 'SUMCBL';
|
|
205849
206046
|
}
|
|
205850
206047
|
}
|
|
206048
|
+
if (isStop) {
|
|
206049
|
+
subscriptionHash = subscriptionHash + ':stop'; // we don't want to re-use the same subscription hash for stop orders
|
|
206050
|
+
}
|
|
205851
206051
|
const instId = (type === 'spot') ? marketId : 'default'; // different from other streams here the 'rest' id is required for spot markets, contract markets require default here
|
|
205852
206052
|
const channel = isStop ? 'ordersAlgo' : 'orders';
|
|
205853
206053
|
const args = {
|
|
@@ -205889,7 +206089,42 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205889
206089
|
// ]
|
|
205890
206090
|
// }
|
|
205891
206091
|
//
|
|
206092
|
+
// {
|
|
206093
|
+
// action: 'snapshot',
|
|
206094
|
+
// arg: { instType: 'umcbl', channel: 'ordersAlgo', instId: 'default' },
|
|
206095
|
+
// data: [
|
|
206096
|
+
// {
|
|
206097
|
+
// actualPx: '55.000000000',
|
|
206098
|
+
// actualSz: '0.000000000',
|
|
206099
|
+
// cOid: '1104372235724890112',
|
|
206100
|
+
// cTime: '1699028779917',
|
|
206101
|
+
// eps: 'web',
|
|
206102
|
+
// hM: 'double_hold',
|
|
206103
|
+
// id: '1104372235724890113',
|
|
206104
|
+
// instId: 'BTCUSDT_UMCBL',
|
|
206105
|
+
// key: '1104372235724890113',
|
|
206106
|
+
// ordPx: '55.000000000',
|
|
206107
|
+
// ordType: 'limit',
|
|
206108
|
+
// planType: 'pl',
|
|
206109
|
+
// posSide: 'long',
|
|
206110
|
+
// side: 'buy',
|
|
206111
|
+
// state: 'not_trigger',
|
|
206112
|
+
// sz: '3.557000000',
|
|
206113
|
+
// tS: 'open_long',
|
|
206114
|
+
// tgtCcy: 'USDT',
|
|
206115
|
+
// triggerPx: '55.000000000',
|
|
206116
|
+
// triggerPxType: 'last',
|
|
206117
|
+
// triggerTime: '1699028779917',
|
|
206118
|
+
// uTime: '1699028779917',
|
|
206119
|
+
// userId: '3704614084',
|
|
206120
|
+
// version: 1104372235586478100
|
|
206121
|
+
// }
|
|
206122
|
+
// ],
|
|
206123
|
+
// ts: 1699028780327
|
|
206124
|
+
// }
|
|
206125
|
+
//
|
|
205892
206126
|
const arg = this.safeValue(message, 'arg', {});
|
|
206127
|
+
const channel = this.safeString(arg, 'channel');
|
|
205893
206128
|
const instType = this.safeString(arg, 'instType');
|
|
205894
206129
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
205895
206130
|
const isContractUpdate = (!sandboxMode) ? (instType === 'umcbl') : (instType === 'sumcbl');
|
|
@@ -205897,8 +206132,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205897
206132
|
if (this.orders === undefined) {
|
|
205898
206133
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
205899
206134
|
this.orders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
206135
|
+
this.triggerOrders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
205900
206136
|
}
|
|
205901
|
-
const stored = this.orders;
|
|
206137
|
+
const stored = (channel === 'ordersAlgo') ? this.triggerOrders : this.orders;
|
|
206138
|
+
const messageHash = (channel === 'ordersAlgo') ? 'triggerOrder' : 'order';
|
|
205902
206139
|
const marketSymbols = {};
|
|
205903
206140
|
for (let i = 0; i < data.length; i++) {
|
|
205904
206141
|
const order = data[i];
|
|
@@ -205915,10 +206152,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
205915
206152
|
const keys = Object.keys(marketSymbols);
|
|
205916
206153
|
for (let i = 0; i < keys.length; i++) {
|
|
205917
206154
|
const symbol = keys[i];
|
|
205918
|
-
const
|
|
205919
|
-
client.resolve(stored,
|
|
206155
|
+
const innerMessageHash = messageHash + ':' + symbol;
|
|
206156
|
+
client.resolve(stored, innerMessageHash);
|
|
205920
206157
|
}
|
|
205921
|
-
client.resolve(stored,
|
|
206158
|
+
client.resolve(stored, messageHash);
|
|
205922
206159
|
}
|
|
205923
206160
|
parseWsOrder(order, market = undefined) {
|
|
205924
206161
|
//
|
|
@@ -265957,14 +266194,23 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
265957
266194
|
'swap': false,
|
|
265958
266195
|
'future': false,
|
|
265959
266196
|
'option': false,
|
|
266197
|
+
'addMargin': false,
|
|
266198
|
+
'borrowMargin': false,
|
|
265960
266199
|
'cancelAllOrders': true,
|
|
265961
266200
|
'cancelOrder': true,
|
|
265962
266201
|
'createOrder': true,
|
|
266202
|
+
'createReduceOnlyOrder': false,
|
|
265963
266203
|
'createStopLimitOrder': true,
|
|
265964
266204
|
'createStopMarketOrder': true,
|
|
265965
266205
|
'createStopOrder': true,
|
|
265966
266206
|
'fetchBalance': true,
|
|
265967
266207
|
'fetchBidsAsks': false,
|
|
266208
|
+
'fetchBorrowInterest': false,
|
|
266209
|
+
'fetchBorrowRate': false,
|
|
266210
|
+
'fetchBorrowRateHistories': false,
|
|
266211
|
+
'fetchBorrowRateHistory': false,
|
|
266212
|
+
'fetchBorrowRates': false,
|
|
266213
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
265968
266214
|
'fetchClosedOrders': false,
|
|
265969
266215
|
'fetchCurrencies': false,
|
|
265970
266216
|
'fetchDepositAddress': false,
|
|
@@ -265976,7 +266222,11 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
265976
266222
|
'fetchFundingRateHistory': false,
|
|
265977
266223
|
'fetchFundingRates': false,
|
|
265978
266224
|
'fetchIndexOHLCV': false,
|
|
266225
|
+
'fetchIsolatedPositions': false,
|
|
266226
|
+
'fetchLeverage': false,
|
|
266227
|
+
'fetchLeverageTiers': false,
|
|
265979
266228
|
'fetchMarginMode': false,
|
|
266229
|
+
'fetchMarketLeverageTiers': false,
|
|
265980
266230
|
'fetchMarkets': true,
|
|
265981
266231
|
'fetchMarkOHLCV': false,
|
|
265982
266232
|
'fetchMyTrades': false,
|
|
@@ -265986,7 +266236,10 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
265986
266236
|
'fetchOrder': false,
|
|
265987
266237
|
'fetchOrderBook': true,
|
|
265988
266238
|
'fetchOrders': true,
|
|
266239
|
+
'fetchPosition': false,
|
|
265989
266240
|
'fetchPositionMode': false,
|
|
266241
|
+
'fetchPositions': false,
|
|
266242
|
+
'fetchPositionsRisk': false,
|
|
265990
266243
|
'fetchPremiumIndexOHLCV': false,
|
|
265991
266244
|
'fetchStatus': true,
|
|
265992
266245
|
'fetchTicker': true,
|
|
@@ -265999,6 +266252,12 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
265999
266252
|
'fetchTransactions': false,
|
|
266000
266253
|
'fetchTransfers': false,
|
|
266001
266254
|
'fetchWithdrawals': false,
|
|
266255
|
+
'reduceMargin': false,
|
|
266256
|
+
'repayMargin': false,
|
|
266257
|
+
'setLeverage': false,
|
|
266258
|
+
'setMargin': false,
|
|
266259
|
+
'setMarginMode': false,
|
|
266260
|
+
'setPositionMode': false,
|
|
266002
266261
|
'transfer': false,
|
|
266003
266262
|
'withdraw': false,
|
|
266004
266263
|
},
|
|
@@ -281318,7 +281577,7 @@ SOFTWARE.
|
|
|
281318
281577
|
|
|
281319
281578
|
//-----------------------------------------------------------------------------
|
|
281320
281579
|
// this is updated by vss.js when building
|
|
281321
|
-
const version = '4.1.
|
|
281580
|
+
const version = '4.1.38';
|
|
281322
281581
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
281323
281582
|
//-----------------------------------------------------------------------------
|
|
281324
281583
|
|