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/dist/cjs/ccxt.js
CHANGED
|
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
180
180
|
|
|
181
181
|
//-----------------------------------------------------------------------------
|
|
182
182
|
// this is updated by vss.js when building
|
|
183
|
-
const version = '4.1.
|
|
183
|
+
const version = '4.1.38';
|
|
184
184
|
Exchange["default"].ccxtVersion = version;
|
|
185
185
|
const exchanges = {
|
|
186
186
|
'ace': ace,
|
package/dist/cjs/src/bitforex.js
CHANGED
|
@@ -26,26 +26,45 @@ class bitforex extends bitforex$1 {
|
|
|
26
26
|
'swap': false,
|
|
27
27
|
'future': false,
|
|
28
28
|
'option': false,
|
|
29
|
+
'addMargin': false,
|
|
30
|
+
'borrowMargin': false,
|
|
29
31
|
'cancelOrder': true,
|
|
30
32
|
'createOrder': true,
|
|
33
|
+
'createReduceOnlyOrder': false,
|
|
31
34
|
'createStopLimitOrder': false,
|
|
32
35
|
'createStopMarketOrder': false,
|
|
33
36
|
'createStopOrder': false,
|
|
34
37
|
'fetchBalance': true,
|
|
38
|
+
'fetchBorrowInterest': false,
|
|
35
39
|
'fetchBorrowRate': false,
|
|
36
40
|
'fetchBorrowRateHistories': false,
|
|
37
41
|
'fetchBorrowRateHistory': false,
|
|
38
42
|
'fetchBorrowRates': false,
|
|
39
43
|
'fetchBorrowRatesPerSymbol': false,
|
|
40
44
|
'fetchClosedOrders': true,
|
|
45
|
+
'fetchFundingHistory': false,
|
|
46
|
+
'fetchFundingRate': false,
|
|
47
|
+
'fetchFundingRateHistory': false,
|
|
48
|
+
'fetchFundingRates': false,
|
|
49
|
+
'fetchIndexOHLCV': false,
|
|
50
|
+
'fetchIsolatedPositions': false,
|
|
51
|
+
'fetchLeverage': false,
|
|
52
|
+
'fetchLeverageTiers': false,
|
|
41
53
|
'fetchMarginMode': false,
|
|
54
|
+
'fetchMarketLeverageTiers': false,
|
|
42
55
|
'fetchMarkets': true,
|
|
56
|
+
'fetchMarkOHLCV': false,
|
|
43
57
|
'fetchMyTrades': true,
|
|
44
58
|
'fetchOHLCV': true,
|
|
59
|
+
'fetchOpenInterestHistory': false,
|
|
45
60
|
'fetchOpenOrders': true,
|
|
46
61
|
'fetchOrder': true,
|
|
47
62
|
'fetchOrderBook': true,
|
|
63
|
+
'fetchPosition': false,
|
|
48
64
|
'fetchPositionMode': false,
|
|
65
|
+
'fetchPositions': false,
|
|
66
|
+
'fetchPositionsRisk': false,
|
|
67
|
+
'fetchPremiumIndexOHLCV': false,
|
|
49
68
|
'fetchTicker': true,
|
|
50
69
|
'fetchTickers': false,
|
|
51
70
|
'fetchTrades': true,
|
|
@@ -54,6 +73,12 @@ class bitforex extends bitforex$1 {
|
|
|
54
73
|
'fetchTransfers': false,
|
|
55
74
|
'fetchWithdrawal': false,
|
|
56
75
|
'fetchWithdrawals': false,
|
|
76
|
+
'reduceMargin': false,
|
|
77
|
+
'repayMargin': false,
|
|
78
|
+
'setLeverage': false,
|
|
79
|
+
'setMargin': false,
|
|
80
|
+
'setMarginMode': false,
|
|
81
|
+
'setPositionMode': false,
|
|
57
82
|
'transfer': false,
|
|
58
83
|
'withdraw': false,
|
|
59
84
|
},
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -427,6 +427,7 @@ class bybit extends bybit$1 {
|
|
|
427
427
|
'v5/user/query-api': 5,
|
|
428
428
|
'v5/user/get-member-type': 5,
|
|
429
429
|
'v5/user/aff-customer-info': 5,
|
|
430
|
+
'v5/user/del-submember': 5,
|
|
430
431
|
// spot leverage token
|
|
431
432
|
'v5/spot-lever-token/order-record': 1,
|
|
432
433
|
// spot margin trade
|
|
@@ -31,6 +31,7 @@ class digifinex extends digifinex$1 {
|
|
|
31
31
|
'cancelOrder': true,
|
|
32
32
|
'cancelOrders': true,
|
|
33
33
|
'createOrder': true,
|
|
34
|
+
'createOrders': true,
|
|
34
35
|
'createPostOnlyOrder': true,
|
|
35
36
|
'createReduceOnlyOrder': true,
|
|
36
37
|
'createStopLimitOrder': false,
|
|
@@ -288,6 +289,7 @@ class digifinex extends digifinex$1 {
|
|
|
288
289
|
'options': {
|
|
289
290
|
'defaultType': 'spot',
|
|
290
291
|
'types': ['spot', 'margin', 'otc'],
|
|
292
|
+
'createMarketBuyOrderRequiresPrice': true,
|
|
291
293
|
'accountsByType': {
|
|
292
294
|
'spot': '1',
|
|
293
295
|
'margin': '2',
|
|
@@ -1551,28 +1553,173 @@ class digifinex extends digifinex$1 {
|
|
|
1551
1553
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1552
1554
|
* @param {string} type 'market' or 'limit'
|
|
1553
1555
|
* @param {string} side 'buy' or 'sell'
|
|
1554
|
-
* @param {float} amount how much
|
|
1556
|
+
* @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
|
|
1555
1557
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1556
1558
|
* @param {object} [params] extra parameters specific to the digifinex api endpoint
|
|
1557
1559
|
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1558
1560
|
* @param {bool} [params.postOnly] true or false
|
|
1559
1561
|
* @param {bool} [params.reduceOnly] true or false
|
|
1562
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
1560
1563
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1561
1564
|
*/
|
|
1562
1565
|
await this.loadMarkets();
|
|
1563
1566
|
const market = this.market(symbol);
|
|
1564
|
-
|
|
1567
|
+
const marginResult = this.handleMarginModeAndParams('createOrder', params);
|
|
1568
|
+
const marginMode = marginResult[0];
|
|
1569
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1570
|
+
let response = undefined;
|
|
1571
|
+
if (market['swap']) {
|
|
1572
|
+
response = await this.privateSwapPostTradeOrderPlace(request);
|
|
1573
|
+
}
|
|
1574
|
+
else {
|
|
1575
|
+
if (marginMode !== undefined) {
|
|
1576
|
+
response = await this.privateSpotPostMarginOrderNew(request);
|
|
1577
|
+
}
|
|
1578
|
+
else {
|
|
1579
|
+
response = await this.privateSpotPostSpotOrderNew(request);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
//
|
|
1583
|
+
// spot and margin
|
|
1584
|
+
//
|
|
1585
|
+
// {
|
|
1586
|
+
// "code": 0,
|
|
1587
|
+
// "order_id": "198361cecdc65f9c8c9bb2fa68faec40"
|
|
1588
|
+
// }
|
|
1589
|
+
//
|
|
1590
|
+
// swap
|
|
1591
|
+
//
|
|
1592
|
+
// {
|
|
1593
|
+
// "code": 0,
|
|
1594
|
+
// "data": "1590873693003714560"
|
|
1595
|
+
// }
|
|
1596
|
+
//
|
|
1597
|
+
const order = this.parseOrder(response, market);
|
|
1598
|
+
order['symbol'] = market['symbol'];
|
|
1599
|
+
order['type'] = type;
|
|
1600
|
+
order['side'] = side;
|
|
1601
|
+
order['amount'] = amount;
|
|
1602
|
+
order['price'] = price;
|
|
1603
|
+
return order;
|
|
1604
|
+
}
|
|
1605
|
+
async createOrders(orders, params = {}) {
|
|
1606
|
+
/**
|
|
1607
|
+
* @method
|
|
1608
|
+
* @name digifinex#createOrders
|
|
1609
|
+
* @description create a list of trade orders (all orders should be of the same symbol)
|
|
1610
|
+
* @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order
|
|
1611
|
+
* @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder
|
|
1612
|
+
* @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
|
|
1613
|
+
* @param {object} [params] extra parameters specific to the digifinex api endpoint
|
|
1614
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1615
|
+
*/
|
|
1616
|
+
await this.loadMarkets();
|
|
1617
|
+
const ordersRequests = [];
|
|
1618
|
+
let symbol = undefined;
|
|
1619
|
+
let marginMode = undefined;
|
|
1620
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1621
|
+
const rawOrder = orders[i];
|
|
1622
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
1623
|
+
if (symbol === undefined) {
|
|
1624
|
+
symbol = marketId;
|
|
1625
|
+
}
|
|
1626
|
+
else {
|
|
1627
|
+
if (symbol !== marketId) {
|
|
1628
|
+
throw new errors.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
const type = this.safeString(rawOrder, 'type');
|
|
1632
|
+
const side = this.safeString(rawOrder, 'side');
|
|
1633
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
1634
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
1635
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
1636
|
+
const marginResult = this.handleMarginModeAndParams('createOrders', params);
|
|
1637
|
+
const currentMarginMode = marginResult[0];
|
|
1638
|
+
if (currentMarginMode !== undefined) {
|
|
1639
|
+
if (marginMode === undefined) {
|
|
1640
|
+
marginMode = currentMarginMode;
|
|
1641
|
+
}
|
|
1642
|
+
else {
|
|
1643
|
+
if (marginMode !== currentMarginMode) {
|
|
1644
|
+
throw new errors.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
1649
|
+
ordersRequests.push(orderRequest);
|
|
1650
|
+
}
|
|
1651
|
+
const market = this.market(symbol);
|
|
1652
|
+
const request = {};
|
|
1653
|
+
let response = undefined;
|
|
1654
|
+
if (market['swap']) {
|
|
1655
|
+
response = await this.privateSwapPostTradeBatchOrder(ordersRequests);
|
|
1656
|
+
}
|
|
1657
|
+
else {
|
|
1658
|
+
request['market'] = (marginMode !== undefined) ? 'margin' : 'spot';
|
|
1659
|
+
request['symbol'] = market['id'];
|
|
1660
|
+
request['list'] = this.json(ordersRequests);
|
|
1661
|
+
response = await this.privateSpotPostMarketOrderBatchNew(request);
|
|
1662
|
+
}
|
|
1663
|
+
//
|
|
1664
|
+
// spot
|
|
1665
|
+
//
|
|
1666
|
+
// {
|
|
1667
|
+
// "code": 0,
|
|
1668
|
+
// "order_ids": [
|
|
1669
|
+
// "064290fbe2d26e7b28d7e6c0a5cf70a5",
|
|
1670
|
+
// "24c8f9b73d81e4d9d8d7e3280281c258"
|
|
1671
|
+
// ]
|
|
1672
|
+
// }
|
|
1673
|
+
//
|
|
1674
|
+
// swap
|
|
1675
|
+
//
|
|
1676
|
+
// {
|
|
1677
|
+
// "code": 0,
|
|
1678
|
+
// "data": [
|
|
1679
|
+
// "1720297963537829888",
|
|
1680
|
+
// "1720297963537829889"
|
|
1681
|
+
// ]
|
|
1682
|
+
// }
|
|
1683
|
+
//
|
|
1684
|
+
let data = [];
|
|
1685
|
+
if (market['swap']) {
|
|
1686
|
+
data = this.safeValue(response, 'data', []);
|
|
1687
|
+
}
|
|
1688
|
+
else {
|
|
1689
|
+
data = this.safeValue(response, 'order_ids', []);
|
|
1690
|
+
}
|
|
1691
|
+
const result = [];
|
|
1692
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1693
|
+
const rawOrder = orders[i];
|
|
1694
|
+
const individualOrder = {};
|
|
1695
|
+
individualOrder['order_id'] = data[i];
|
|
1696
|
+
individualOrder['instrument_id'] = market['id'];
|
|
1697
|
+
individualOrder['amount'] = this.safeNumber(rawOrder, 'amount');
|
|
1698
|
+
individualOrder['price'] = this.safeNumber(rawOrder, 'price');
|
|
1699
|
+
result.push(individualOrder);
|
|
1700
|
+
}
|
|
1701
|
+
return this.parseOrders(result, market);
|
|
1702
|
+
}
|
|
1703
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1704
|
+
/**
|
|
1705
|
+
* @method
|
|
1706
|
+
* @ignore
|
|
1707
|
+
* @name digifinex#createOrderRequest
|
|
1708
|
+
* @description helper function to build request
|
|
1709
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1710
|
+
* @param {string} type 'market' or 'limit'
|
|
1711
|
+
* @param {string} side 'buy' or 'sell'
|
|
1712
|
+
* @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
|
|
1713
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1714
|
+
* @param {object} [params] extra parameters specific to the digifinex api endpoint
|
|
1715
|
+
* @returns {object} request to be sent to the exchange
|
|
1716
|
+
*/
|
|
1717
|
+
const market = this.market(symbol);
|
|
1565
1718
|
let marketType = undefined;
|
|
1566
1719
|
let marginMode = undefined;
|
|
1567
|
-
[marketType, params] = this.handleMarketTypeAndParams('
|
|
1568
|
-
|
|
1569
|
-
'spot': 'privateSpotPostSpotOrderNew',
|
|
1570
|
-
'margin': 'privateSpotPostMarginOrderNew',
|
|
1571
|
-
'swap': 'privateSwapPostTradeOrderPlace',
|
|
1572
|
-
});
|
|
1573
|
-
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
1720
|
+
[marketType, params] = this.handleMarketTypeAndParams('createOrderRequest', market, params);
|
|
1721
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrderRequest', params);
|
|
1574
1722
|
if (marginMode !== undefined) {
|
|
1575
|
-
method = 'privateSpotPostMarginOrderNew';
|
|
1576
1723
|
marketType = 'margin';
|
|
1577
1724
|
}
|
|
1578
1725
|
const request = {};
|
|
@@ -1629,40 +1776,34 @@ class digifinex extends digifinex$1 {
|
|
|
1629
1776
|
}
|
|
1630
1777
|
request['type'] = side + suffix;
|
|
1631
1778
|
// limit orders require the amount in the base currency, market orders require the amount in the quote currency
|
|
1632
|
-
|
|
1779
|
+
let quantity = undefined;
|
|
1780
|
+
const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
1781
|
+
if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
|
|
1782
|
+
if (price === undefined) {
|
|
1783
|
+
throw new errors.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');
|
|
1784
|
+
}
|
|
1785
|
+
else {
|
|
1786
|
+
const amountString = this.numberToString(amount);
|
|
1787
|
+
const priceString = this.numberToString(price);
|
|
1788
|
+
const cost = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
|
|
1789
|
+
quantity = this.priceToPrecision(symbol, cost);
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
quantity = this.amountToPrecision(symbol, amount);
|
|
1794
|
+
}
|
|
1795
|
+
request['amount'] = quantity;
|
|
1633
1796
|
}
|
|
1634
1797
|
if (postOnly) {
|
|
1635
1798
|
if (postOnlyParsed) {
|
|
1636
|
-
request['
|
|
1799
|
+
request['post_only'] = postOnlyParsed;
|
|
1637
1800
|
}
|
|
1638
1801
|
else {
|
|
1639
|
-
request['
|
|
1802
|
+
request['post_only'] = postOnly;
|
|
1640
1803
|
}
|
|
1641
1804
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
//
|
|
1645
|
-
// spot and margin
|
|
1646
|
-
//
|
|
1647
|
-
// {
|
|
1648
|
-
// "code": 0,
|
|
1649
|
-
// "order_id": "198361cecdc65f9c8c9bb2fa68faec40"
|
|
1650
|
-
// }
|
|
1651
|
-
//
|
|
1652
|
-
// swap
|
|
1653
|
-
//
|
|
1654
|
-
// {
|
|
1655
|
-
// "code": 0,
|
|
1656
|
-
// "data": "1590873693003714560"
|
|
1657
|
-
// }
|
|
1658
|
-
//
|
|
1659
|
-
const order = this.parseOrder(response, market);
|
|
1660
|
-
order['symbol'] = symbol;
|
|
1661
|
-
order['type'] = type;
|
|
1662
|
-
order['side'] = side;
|
|
1663
|
-
order['amount'] = amount;
|
|
1664
|
-
order['price'] = price;
|
|
1665
|
-
return order;
|
|
1805
|
+
params = this.omit(params, ['postOnly']);
|
|
1806
|
+
return this.extend(request, params);
|
|
1666
1807
|
}
|
|
1667
1808
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1668
1809
|
/**
|
|
@@ -1799,6 +1940,15 @@ class digifinex extends digifinex$1 {
|
|
|
1799
1940
|
// "data": "1590873693003714560"
|
|
1800
1941
|
// }
|
|
1801
1942
|
//
|
|
1943
|
+
// spot and swap: createOrders
|
|
1944
|
+
//
|
|
1945
|
+
// {
|
|
1946
|
+
// "order_id": "d64d92a5e0a120f792f385485bc3d95b",
|
|
1947
|
+
// "instrument_id": "BTC_USDT",
|
|
1948
|
+
// "amount": 0.0001,
|
|
1949
|
+
// "price": 27000
|
|
1950
|
+
// }
|
|
1951
|
+
//
|
|
1802
1952
|
// spot: fetchOrder, fetchOpenOrders, fetchOrders
|
|
1803
1953
|
//
|
|
1804
1954
|
// {
|
|
@@ -1844,24 +1994,26 @@ class digifinex extends digifinex$1 {
|
|
|
1844
1994
|
let type = undefined;
|
|
1845
1995
|
let side = this.safeString(order, 'type');
|
|
1846
1996
|
const marketId = this.safeString2(order, 'symbol', 'instrument_id');
|
|
1847
|
-
const symbol = this.safeSymbol(marketId, market
|
|
1997
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
1848
1998
|
market = this.market(symbol);
|
|
1849
1999
|
if (market['type'] === 'swap') {
|
|
1850
2000
|
const orderType = this.safeInteger(order, 'order_type');
|
|
1851
|
-
if (
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
2001
|
+
if (orderType !== undefined) {
|
|
2002
|
+
if ((orderType === 9) || (orderType === 10) || (orderType === 11) || (orderType === 12) || (orderType === 15)) {
|
|
2003
|
+
timeInForce = 'FOK';
|
|
2004
|
+
}
|
|
2005
|
+
else if ((orderType === 1) || (orderType === 2) || (orderType === 3) || (orderType === 4) || (orderType === 13)) {
|
|
2006
|
+
timeInForce = 'IOC';
|
|
2007
|
+
}
|
|
2008
|
+
else if ((orderType === 6) || (orderType === 7) || (orderType === 8) || (orderType === 14)) {
|
|
2009
|
+
timeInForce = 'GTC';
|
|
2010
|
+
}
|
|
2011
|
+
if ((orderType === 0) || (orderType === 1) || (orderType === 4) || (orderType === 5) || (orderType === 9) || (orderType === 10)) {
|
|
2012
|
+
type = 'limit';
|
|
2013
|
+
}
|
|
2014
|
+
else {
|
|
2015
|
+
type = 'market';
|
|
2016
|
+
}
|
|
1865
2017
|
}
|
|
1866
2018
|
if (side === '1') {
|
|
1867
2019
|
side = 'open long';
|
package/dist/cjs/src/huobi.js
CHANGED
|
@@ -4820,6 +4820,7 @@ class huobi extends huobi$1 {
|
|
|
4820
4820
|
* @param {string} [params.offset] *contract only* 'open', 'close', or 'both', required in hedge mode
|
|
4821
4821
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
4822
4822
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
4823
|
+
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
4823
4824
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4824
4825
|
*/
|
|
4825
4826
|
await this.loadMarkets();
|
|
@@ -4892,6 +4893,13 @@ class huobi extends huobi$1 {
|
|
|
4892
4893
|
if (postOnly) {
|
|
4893
4894
|
orderType = 'limit-maker';
|
|
4894
4895
|
}
|
|
4896
|
+
const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
|
|
4897
|
+
if (timeInForce === 'FOK') {
|
|
4898
|
+
orderType = orderType + '-fok';
|
|
4899
|
+
}
|
|
4900
|
+
else if (timeInForce === 'IOC') {
|
|
4901
|
+
orderType = 'ioc';
|
|
4902
|
+
}
|
|
4895
4903
|
request['type'] = side + '-' + orderType;
|
|
4896
4904
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client-order-id'); // must be 64 chars max and unique within 24 hours
|
|
4897
4905
|
if (clientOrderId === undefined) {
|
|
@@ -4939,7 +4947,7 @@ class huobi extends huobi$1 {
|
|
|
4939
4947
|
if (orderType in limitOrderTypes) {
|
|
4940
4948
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
4941
4949
|
}
|
|
4942
|
-
params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator']);
|
|
4950
|
+
params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator', 'timeInForce']);
|
|
4943
4951
|
const response = await this.spotPrivatePostV1OrderOrdersPlace(this.extend(request, params));
|
|
4944
4952
|
//
|
|
4945
4953
|
// spot
|
|
@@ -4984,6 +4992,7 @@ class huobi extends huobi$1 {
|
|
|
4984
4992
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
4985
4993
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
4986
4994
|
* @param {object} params extra parameters specific to the huobi api endpoint
|
|
4995
|
+
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
4987
4996
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4988
4997
|
*/
|
|
4989
4998
|
const market = this.market(symbol);
|
|
@@ -4997,6 +5006,13 @@ class huobi extends huobi$1 {
|
|
|
4997
5006
|
if (postOnly) {
|
|
4998
5007
|
type = 'post_only';
|
|
4999
5008
|
}
|
|
5009
|
+
const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
|
|
5010
|
+
if (timeInForce === 'FOK') {
|
|
5011
|
+
type = 'fok';
|
|
5012
|
+
}
|
|
5013
|
+
else if (timeInForce === 'IOC') {
|
|
5014
|
+
type = 'ioc';
|
|
5015
|
+
}
|
|
5000
5016
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
|
|
5001
5017
|
const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
|
|
5002
5018
|
const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
|
|
@@ -5049,7 +5065,7 @@ class huobi extends huobi$1 {
|
|
|
5049
5065
|
request['lever_rate'] = leverRate;
|
|
5050
5066
|
request['order_price_type'] = type;
|
|
5051
5067
|
}
|
|
5052
|
-
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate']);
|
|
5068
|
+
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce']);
|
|
5053
5069
|
const broker = this.safeValue(this.options, 'broker', {});
|
|
5054
5070
|
const brokerId = this.safeString(broker, 'id');
|
|
5055
5071
|
request['channel_code'] = brokerId;
|
|
@@ -754,6 +754,9 @@ class bitget extends bitget$1 {
|
|
|
754
754
|
/**
|
|
755
755
|
* @method
|
|
756
756
|
* @name bitget#watchOrders
|
|
757
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#order-channel
|
|
758
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#order-channel
|
|
759
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#plan-order-channel
|
|
757
760
|
* @description watches information on multiple orders made by the user
|
|
758
761
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
759
762
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -764,7 +767,9 @@ class bitget extends bitget$1 {
|
|
|
764
767
|
await this.loadMarkets();
|
|
765
768
|
let market = undefined;
|
|
766
769
|
let marketId = undefined;
|
|
767
|
-
|
|
770
|
+
const isStop = this.safeValue(params, 'stop', false);
|
|
771
|
+
params = this.omit(params, 'stop');
|
|
772
|
+
let messageHash = (isStop) ? 'triggerOrder' : 'order';
|
|
768
773
|
let subscriptionHash = 'order:trades';
|
|
769
774
|
if (symbol !== undefined) {
|
|
770
775
|
market = this.market(symbol);
|
|
@@ -772,8 +777,6 @@ class bitget extends bitget$1 {
|
|
|
772
777
|
marketId = market['id'];
|
|
773
778
|
messageHash = messageHash + ':' + symbol;
|
|
774
779
|
}
|
|
775
|
-
const isStop = this.safeValue(params, 'stop', false);
|
|
776
|
-
params = this.omit(params, 'stop');
|
|
777
780
|
let type = undefined;
|
|
778
781
|
[type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
|
|
779
782
|
if ((type === 'spot') && (symbol === undefined)) {
|
|
@@ -796,6 +799,9 @@ class bitget extends bitget$1 {
|
|
|
796
799
|
instType = 'SUMCBL';
|
|
797
800
|
}
|
|
798
801
|
}
|
|
802
|
+
if (isStop) {
|
|
803
|
+
subscriptionHash = subscriptionHash + ':stop'; // we don't want to re-use the same subscription hash for stop orders
|
|
804
|
+
}
|
|
799
805
|
const instId = (type === 'spot') ? marketId : 'default'; // different from other streams here the 'rest' id is required for spot markets, contract markets require default here
|
|
800
806
|
const channel = isStop ? 'ordersAlgo' : 'orders';
|
|
801
807
|
const args = {
|
|
@@ -837,7 +843,42 @@ class bitget extends bitget$1 {
|
|
|
837
843
|
// ]
|
|
838
844
|
// }
|
|
839
845
|
//
|
|
846
|
+
// {
|
|
847
|
+
// action: 'snapshot',
|
|
848
|
+
// arg: { instType: 'umcbl', channel: 'ordersAlgo', instId: 'default' },
|
|
849
|
+
// data: [
|
|
850
|
+
// {
|
|
851
|
+
// actualPx: '55.000000000',
|
|
852
|
+
// actualSz: '0.000000000',
|
|
853
|
+
// cOid: '1104372235724890112',
|
|
854
|
+
// cTime: '1699028779917',
|
|
855
|
+
// eps: 'web',
|
|
856
|
+
// hM: 'double_hold',
|
|
857
|
+
// id: '1104372235724890113',
|
|
858
|
+
// instId: 'BTCUSDT_UMCBL',
|
|
859
|
+
// key: '1104372235724890113',
|
|
860
|
+
// ordPx: '55.000000000',
|
|
861
|
+
// ordType: 'limit',
|
|
862
|
+
// planType: 'pl',
|
|
863
|
+
// posSide: 'long',
|
|
864
|
+
// side: 'buy',
|
|
865
|
+
// state: 'not_trigger',
|
|
866
|
+
// sz: '3.557000000',
|
|
867
|
+
// tS: 'open_long',
|
|
868
|
+
// tgtCcy: 'USDT',
|
|
869
|
+
// triggerPx: '55.000000000',
|
|
870
|
+
// triggerPxType: 'last',
|
|
871
|
+
// triggerTime: '1699028779917',
|
|
872
|
+
// uTime: '1699028779917',
|
|
873
|
+
// userId: '3704614084',
|
|
874
|
+
// version: 1104372235586478100
|
|
875
|
+
// }
|
|
876
|
+
// ],
|
|
877
|
+
// ts: 1699028780327
|
|
878
|
+
// }
|
|
879
|
+
//
|
|
840
880
|
const arg = this.safeValue(message, 'arg', {});
|
|
881
|
+
const channel = this.safeString(arg, 'channel');
|
|
841
882
|
const instType = this.safeString(arg, 'instType');
|
|
842
883
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
843
884
|
const isContractUpdate = (!sandboxMode) ? (instType === 'umcbl') : (instType === 'sumcbl');
|
|
@@ -845,8 +886,10 @@ class bitget extends bitget$1 {
|
|
|
845
886
|
if (this.orders === undefined) {
|
|
846
887
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
847
888
|
this.orders = new Cache.ArrayCacheBySymbolById(limit);
|
|
889
|
+
this.triggerOrders = new Cache.ArrayCacheBySymbolById(limit);
|
|
848
890
|
}
|
|
849
|
-
const stored = this.orders;
|
|
891
|
+
const stored = (channel === 'ordersAlgo') ? this.triggerOrders : this.orders;
|
|
892
|
+
const messageHash = (channel === 'ordersAlgo') ? 'triggerOrder' : 'order';
|
|
850
893
|
const marketSymbols = {};
|
|
851
894
|
for (let i = 0; i < data.length; i++) {
|
|
852
895
|
const order = data[i];
|
|
@@ -863,10 +906,10 @@ class bitget extends bitget$1 {
|
|
|
863
906
|
const keys = Object.keys(marketSymbols);
|
|
864
907
|
for (let i = 0; i < keys.length; i++) {
|
|
865
908
|
const symbol = keys[i];
|
|
866
|
-
const
|
|
867
|
-
client.resolve(stored,
|
|
909
|
+
const innerMessageHash = messageHash + ':' + symbol;
|
|
910
|
+
client.resolve(stored, innerMessageHash);
|
|
868
911
|
}
|
|
869
|
-
client.resolve(stored,
|
|
912
|
+
client.resolve(stored, messageHash);
|
|
870
913
|
}
|
|
871
914
|
parseWsOrder(order, market = undefined) {
|
|
872
915
|
//
|
package/dist/cjs/src/wazirx.js
CHANGED
|
@@ -26,14 +26,23 @@ class wazirx extends wazirx$1 {
|
|
|
26
26
|
'swap': false,
|
|
27
27
|
'future': false,
|
|
28
28
|
'option': false,
|
|
29
|
+
'addMargin': false,
|
|
30
|
+
'borrowMargin': false,
|
|
29
31
|
'cancelAllOrders': true,
|
|
30
32
|
'cancelOrder': true,
|
|
31
33
|
'createOrder': true,
|
|
34
|
+
'createReduceOnlyOrder': false,
|
|
32
35
|
'createStopLimitOrder': true,
|
|
33
36
|
'createStopMarketOrder': true,
|
|
34
37
|
'createStopOrder': true,
|
|
35
38
|
'fetchBalance': true,
|
|
36
39
|
'fetchBidsAsks': false,
|
|
40
|
+
'fetchBorrowInterest': false,
|
|
41
|
+
'fetchBorrowRate': false,
|
|
42
|
+
'fetchBorrowRateHistories': false,
|
|
43
|
+
'fetchBorrowRateHistory': false,
|
|
44
|
+
'fetchBorrowRates': false,
|
|
45
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
37
46
|
'fetchClosedOrders': false,
|
|
38
47
|
'fetchCurrencies': false,
|
|
39
48
|
'fetchDepositAddress': false,
|
|
@@ -45,7 +54,11 @@ class wazirx extends wazirx$1 {
|
|
|
45
54
|
'fetchFundingRateHistory': false,
|
|
46
55
|
'fetchFundingRates': false,
|
|
47
56
|
'fetchIndexOHLCV': false,
|
|
57
|
+
'fetchIsolatedPositions': false,
|
|
58
|
+
'fetchLeverage': false,
|
|
59
|
+
'fetchLeverageTiers': false,
|
|
48
60
|
'fetchMarginMode': false,
|
|
61
|
+
'fetchMarketLeverageTiers': false,
|
|
49
62
|
'fetchMarkets': true,
|
|
50
63
|
'fetchMarkOHLCV': false,
|
|
51
64
|
'fetchMyTrades': false,
|
|
@@ -55,7 +68,10 @@ class wazirx extends wazirx$1 {
|
|
|
55
68
|
'fetchOrder': false,
|
|
56
69
|
'fetchOrderBook': true,
|
|
57
70
|
'fetchOrders': true,
|
|
71
|
+
'fetchPosition': false,
|
|
58
72
|
'fetchPositionMode': false,
|
|
73
|
+
'fetchPositions': false,
|
|
74
|
+
'fetchPositionsRisk': false,
|
|
59
75
|
'fetchPremiumIndexOHLCV': false,
|
|
60
76
|
'fetchStatus': true,
|
|
61
77
|
'fetchTicker': true,
|
|
@@ -68,6 +84,12 @@ class wazirx extends wazirx$1 {
|
|
|
68
84
|
'fetchTransactions': false,
|
|
69
85
|
'fetchTransfers': false,
|
|
70
86
|
'fetchWithdrawals': false,
|
|
87
|
+
'reduceMargin': false,
|
|
88
|
+
'repayMargin': false,
|
|
89
|
+
'setLeverage': false,
|
|
90
|
+
'setMargin': false,
|
|
91
|
+
'setMarginMode': false,
|
|
92
|
+
'setPositionMode': false,
|
|
71
93
|
'transfer': false,
|
|
72
94
|
'withdraw': false,
|
|
73
95
|
},
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.1.
|
|
7
|
+
declare const version = "4.1.37";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.1.
|
|
41
|
+
const version = '4.1.38';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -257,6 +257,7 @@ interface Exchange {
|
|
|
257
257
|
privateGetV5UserQueryApi(params?: {}): Promise<implicitReturnType>;
|
|
258
258
|
privateGetV5UserGetMemberType(params?: {}): Promise<implicitReturnType>;
|
|
259
259
|
privateGetV5UserAffCustomerInfo(params?: {}): Promise<implicitReturnType>;
|
|
260
|
+
privateGetV5UserDelSubmember(params?: {}): Promise<implicitReturnType>;
|
|
260
261
|
privateGetV5SpotLeverTokenOrderRecord(params?: {}): Promise<implicitReturnType>;
|
|
261
262
|
privateGetV5SpotMarginTradeState(params?: {}): Promise<implicitReturnType>;
|
|
262
263
|
privateGetV5SpotCrossMarginTradeLoanInfo(params?: {}): Promise<implicitReturnType>;
|