ccxt 4.1.95 → 4.1.96
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/build.sh +16 -16
- package/dist/ccxt.browser.js +385 -251
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +145 -135
- package/dist/cjs/src/bingx.js +8 -7
- package/dist/cjs/src/bit2c.js +2 -3
- package/dist/cjs/src/bitfinex2.js +2 -3
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/btcbox.js +2 -3
- package/dist/cjs/src/coinbase.js +11 -5
- package/dist/cjs/src/cryptocom.js +2 -1
- package/dist/cjs/src/delta.js +25 -0
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/kraken.js +46 -45
- package/dist/cjs/src/krakenfutures.js +53 -26
- package/dist/cjs/src/kucoin.js +73 -3
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/binance.js +2 -3
- package/dist/cjs/src/pro/bitfinex.js +2 -3
- package/dist/cjs/src/pro/cex.js +1 -1
- package/dist/cjs/src/pro/gate.js +2 -2
- package/dist/cjs/src/pro/kraken.js +2 -3
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +2 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kucoin.d.ts +12 -0
- package/js/src/abstract/kucoinfutures.d.ts +12 -1
- package/js/src/binance.js +145 -135
- package/js/src/bingx.js +8 -7
- package/js/src/bit2c.js +2 -3
- package/js/src/bitfinex2.js +2 -3
- package/js/src/bitmart.js +1 -1
- package/js/src/btcbox.js +2 -3
- package/js/src/coinbase.js +11 -5
- package/js/src/cryptocom.js +2 -1
- package/js/src/delta.d.ts +5 -4
- package/js/src/delta.js +25 -0
- package/js/src/gate.js +2 -2
- package/js/src/kraken.js +46 -45
- package/js/src/krakenfutures.js +53 -26
- package/js/src/kucoin.d.ts +3 -0
- package/js/src/kucoin.js +73 -3
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/pro/binance.js +2 -3
- package/js/src/pro/bitfinex.js +2 -3
- package/js/src/pro/cex.js +1 -1
- package/js/src/pro/gate.js +2 -2
- package/js/src/pro/kraken.js +2 -3
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/woo.js +2 -3
- package/package.json +2 -2
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -2363,6 +2363,12 @@ class coinbase extends coinbase$1 {
|
|
|
2363
2363
|
// "base_size": "0.2",
|
|
2364
2364
|
// "limit_price": "0.006",
|
|
2365
2365
|
// "post_only": false
|
|
2366
|
+
// },
|
|
2367
|
+
// "stop_limit_stop_limit_gtc": {
|
|
2368
|
+
// "base_size": "48.54",
|
|
2369
|
+
// "limit_price": "6.998",
|
|
2370
|
+
// "stop_price": "7.0687",
|
|
2371
|
+
// "stop_direction": "STOP_DIRECTION_STOP_DOWN"
|
|
2366
2372
|
// }
|
|
2367
2373
|
// },
|
|
2368
2374
|
// "side": "SELL",
|
|
@@ -2396,11 +2402,11 @@ class coinbase extends coinbase$1 {
|
|
|
2396
2402
|
market = this.market(symbol);
|
|
2397
2403
|
}
|
|
2398
2404
|
const orderConfiguration = this.safeValue(order, 'order_configuration', {});
|
|
2399
|
-
const limitGTC = this.safeValue(orderConfiguration, 'limit_limit_gtc'
|
|
2400
|
-
const limitGTD = this.safeValue(orderConfiguration, 'limit_limit_gtd'
|
|
2401
|
-
const stopLimitGTC = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtc'
|
|
2402
|
-
const stopLimitGTD = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtd'
|
|
2403
|
-
const marketIOC = this.safeValue(orderConfiguration, 'market_market_ioc'
|
|
2405
|
+
const limitGTC = this.safeValue(orderConfiguration, 'limit_limit_gtc');
|
|
2406
|
+
const limitGTD = this.safeValue(orderConfiguration, 'limit_limit_gtd');
|
|
2407
|
+
const stopLimitGTC = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtc');
|
|
2408
|
+
const stopLimitGTD = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtd');
|
|
2409
|
+
const marketIOC = this.safeValue(orderConfiguration, 'market_market_ioc');
|
|
2404
2410
|
const isLimit = ((limitGTC !== undefined) || (limitGTD !== undefined));
|
|
2405
2411
|
const isStop = ((stopLimitGTC !== undefined) || (stopLimitGTD !== undefined));
|
|
2406
2412
|
let price = undefined;
|
|
@@ -1907,6 +1907,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1907
1907
|
const timestamp = this.safeInteger(ticker, 't');
|
|
1908
1908
|
const marketId = this.safeString(ticker, 'i');
|
|
1909
1909
|
market = this.safeMarket(marketId, market, '_');
|
|
1910
|
+
const quote = this.safeString(market, 'quote');
|
|
1910
1911
|
const last = this.safeString(ticker, 'a');
|
|
1911
1912
|
return this.safeTicker({
|
|
1912
1913
|
'symbol': market['symbol'],
|
|
@@ -1927,7 +1928,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1927
1928
|
'percentage': this.safeString(ticker, 'c'),
|
|
1928
1929
|
'average': undefined,
|
|
1929
1930
|
'baseVolume': this.safeString(ticker, 'v'),
|
|
1930
|
-
'quoteVolume': this.safeString(ticker, 'vv'),
|
|
1931
|
+
'quoteVolume': (quote === 'USD') ? this.safeString(ticker, 'vv') : undefined,
|
|
1931
1932
|
'info': ticker,
|
|
1932
1933
|
}, market);
|
|
1933
1934
|
}
|
package/dist/cjs/src/delta.js
CHANGED
|
@@ -31,6 +31,8 @@ class delta extends delta$1 {
|
|
|
31
31
|
'addMargin': true,
|
|
32
32
|
'cancelAllOrders': true,
|
|
33
33
|
'cancelOrder': true,
|
|
34
|
+
'closeAllPositions': true,
|
|
35
|
+
'closePosition': false,
|
|
34
36
|
'createOrder': true,
|
|
35
37
|
'createReduceOnlyOrder': true,
|
|
36
38
|
'editOrder': true,
|
|
@@ -3175,6 +3177,29 @@ class delta extends delta$1 {
|
|
|
3175
3177
|
'info': greeks,
|
|
3176
3178
|
};
|
|
3177
3179
|
}
|
|
3180
|
+
async closeAllPositions(params = {}) {
|
|
3181
|
+
/**
|
|
3182
|
+
* @method
|
|
3183
|
+
* @name delta#closeAllPositions
|
|
3184
|
+
* @description closes all open positions for a market type
|
|
3185
|
+
* @see https://docs.delta.exchange/#close-all-positions
|
|
3186
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3187
|
+
* @param {int} [params.user_id] the users id
|
|
3188
|
+
* @returns {object[]} A list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
3189
|
+
*/
|
|
3190
|
+
await this.loadMarkets();
|
|
3191
|
+
const request = {
|
|
3192
|
+
'close_all_portfolio': true,
|
|
3193
|
+
'close_all_isolated': true,
|
|
3194
|
+
// 'user_id': 12345,
|
|
3195
|
+
};
|
|
3196
|
+
const response = await this.privatePostPositionsCloseAll(this.extend(request, params));
|
|
3197
|
+
//
|
|
3198
|
+
// {"result":{},"success":true}
|
|
3199
|
+
//
|
|
3200
|
+
const position = this.parsePosition(this.safeValue(response, 'result', {}));
|
|
3201
|
+
return [position];
|
|
3202
|
+
}
|
|
3178
3203
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3179
3204
|
const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
|
|
3180
3205
|
let url = this.urls['api'][api] + requestPath;
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -6992,7 +6992,7 @@ class gate extends gate$1 {
|
|
|
6992
6992
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
6993
6993
|
/**
|
|
6994
6994
|
* @method
|
|
6995
|
-
* @name gate#
|
|
6995
|
+
* @name gate#closePosition
|
|
6996
6996
|
* @description closes open positions for a market
|
|
6997
6997
|
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
|
6998
6998
|
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
@@ -7000,7 +7000,7 @@ class gate extends gate$1 {
|
|
|
7000
7000
|
* @param {string} symbol Unified CCXT market symbol
|
|
7001
7001
|
* @param {string} side 'buy' or 'sell'
|
|
7002
7002
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
7003
|
-
* @returns {[
|
|
7003
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7004
7004
|
*/
|
|
7005
7005
|
const request = {
|
|
7006
7006
|
'close': true,
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -824,7 +824,6 @@ class kraken extends kraken$1 {
|
|
|
824
824
|
// "o":"2571.56000"
|
|
825
825
|
// }
|
|
826
826
|
//
|
|
827
|
-
const timestamp = this.milliseconds();
|
|
828
827
|
const symbol = this.safeSymbol(undefined, market);
|
|
829
828
|
const v = this.safeValue(ticker, 'v', []);
|
|
830
829
|
const baseVolume = this.safeString(v, 1);
|
|
@@ -839,8 +838,8 @@ class kraken extends kraken$1 {
|
|
|
839
838
|
const ask = this.safeValue(ticker, 'a', []);
|
|
840
839
|
return this.safeTicker({
|
|
841
840
|
'symbol': symbol,
|
|
842
|
-
'timestamp':
|
|
843
|
-
'datetime':
|
|
841
|
+
'timestamp': undefined,
|
|
842
|
+
'datetime': undefined,
|
|
844
843
|
'high': this.safeString(high, 1),
|
|
845
844
|
'low': this.safeString(low, 1),
|
|
846
845
|
'bid': this.safeString(bid, 0),
|
|
@@ -1354,8 +1353,12 @@ class kraken extends kraken$1 {
|
|
|
1354
1353
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1355
1354
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1356
1355
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1357
|
-
* @param {bool} params.postOnly
|
|
1358
|
-
* @param {bool} params.reduceOnly
|
|
1356
|
+
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
1357
|
+
* @param {bool} [params.reduceOnly] *margin only* indicates if this order is to reduce the size of a position
|
|
1358
|
+
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
1359
|
+
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
1360
|
+
* @param {string} [params.trailingStopPrice] *margin only* the quote amount to trail away from the current market price
|
|
1361
|
+
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
1359
1362
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1360
1363
|
*/
|
|
1361
1364
|
await this.loadMarkets();
|
|
@@ -1610,50 +1613,48 @@ class kraken extends kraken$1 {
|
|
|
1610
1613
|
if (clientOrderId !== undefined) {
|
|
1611
1614
|
request['userref'] = clientOrderId;
|
|
1612
1615
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
// settle-position
|
|
1621
|
-
//
|
|
1616
|
+
const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
|
|
1617
|
+
const takeProfitTriggerPrice = this.safeString(params, 'takeProfitPrice');
|
|
1618
|
+
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
1619
|
+
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
1620
|
+
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
1621
|
+
const trailingStopPrice = this.safeString(params, 'trailingStopPrice');
|
|
1622
|
+
const isTrailingStopPriceOrder = trailingStopPrice !== undefined;
|
|
1622
1623
|
if (type === 'limit') {
|
|
1623
1624
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1624
1625
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
if (
|
|
1628
|
-
|
|
1626
|
+
let reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
1627
|
+
if (isStopLossOrTakeProfitTrigger) {
|
|
1628
|
+
if (isStopLossTriggerOrder) {
|
|
1629
|
+
request['price'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
1630
|
+
request['ordertype'] = 'stop-loss-limit';
|
|
1629
1631
|
}
|
|
1630
|
-
else {
|
|
1631
|
-
request['price'] = this.priceToPrecision(symbol,
|
|
1632
|
+
else if (isTakeProfitTriggerOrder) {
|
|
1633
|
+
request['price'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
1634
|
+
request['ordertype'] = 'take-profit-limit';
|
|
1632
1635
|
}
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
const
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1636
|
+
request['price2'] = this.priceToPrecision(symbol, price);
|
|
1637
|
+
reduceOnly = true;
|
|
1638
|
+
}
|
|
1639
|
+
else if (isTrailingStopPriceOrder) {
|
|
1640
|
+
const trailingStopActivationPriceType = this.safeString(params, 'trigger', 'last');
|
|
1641
|
+
const trailingStopPriceString = '+' + trailingStopPrice;
|
|
1642
|
+
request['trigger'] = trailingStopActivationPriceType;
|
|
1643
|
+
reduceOnly = true;
|
|
1644
|
+
if (type === 'limit') {
|
|
1645
|
+
const trailingStopLimitPriceString = '+' + this.numberToString(price);
|
|
1646
|
+
request['price'] = trailingStopPriceString;
|
|
1647
|
+
request['price2'] = trailingStopLimitPriceString;
|
|
1648
|
+
request['ordertype'] = 'trailing-stop-limit';
|
|
1645
1649
|
}
|
|
1646
1650
|
else {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
request['price2'] = this.priceToPrecision(symbol, price);
|
|
1650
|
-
}
|
|
1651
|
-
else if (limitPriceDefined) {
|
|
1652
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
1653
|
-
request['price2'] = this.priceToPrecision(symbol, limitPrice);
|
|
1654
|
-
}
|
|
1651
|
+
request['price'] = trailingStopPriceString;
|
|
1652
|
+
request['ordertype'] = 'trailing-stop';
|
|
1655
1653
|
}
|
|
1656
1654
|
}
|
|
1655
|
+
if (reduceOnly) {
|
|
1656
|
+
request['reduce_only'] = 'true'; // not using boolean in this case, because the urlencodedNested transforms it into 'True' string
|
|
1657
|
+
}
|
|
1657
1658
|
let close = this.safeValue(params, 'close');
|
|
1658
1659
|
if (close !== undefined) {
|
|
1659
1660
|
close = this.extend({}, close);
|
|
@@ -1677,11 +1678,7 @@ class kraken extends kraken$1 {
|
|
|
1677
1678
|
if (postOnly) {
|
|
1678
1679
|
request['oflags'] = 'post';
|
|
1679
1680
|
}
|
|
1680
|
-
|
|
1681
|
-
if (reduceOnly) {
|
|
1682
|
-
request['reduce_only'] = true;
|
|
1683
|
-
}
|
|
1684
|
-
params = this.omit(params, ['price', 'stopPrice', 'price2', 'close', 'timeInForce', 'reduceOnly']);
|
|
1681
|
+
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingStopPrice']);
|
|
1685
1682
|
return [request, params];
|
|
1686
1683
|
}
|
|
1687
1684
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -1697,6 +1694,10 @@ class kraken extends kraken$1 {
|
|
|
1697
1694
|
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
1698
1695
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1699
1696
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1697
|
+
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
1698
|
+
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
1699
|
+
* @param {string} [params.trailingStopPrice] *margin only* the quote price away from the current market price
|
|
1700
|
+
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
1700
1701
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1701
1702
|
*/
|
|
1702
1703
|
await this.loadMarkets();
|
|
@@ -841,20 +841,12 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
841
841
|
});
|
|
842
842
|
}
|
|
843
843
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
844
|
+
const market = this.market(symbol);
|
|
844
845
|
type = this.safeString(params, 'orderType', type);
|
|
845
846
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
846
|
-
const stopPrice = this.safeString(params, 'stopPrice');
|
|
847
847
|
let postOnly = false;
|
|
848
848
|
[postOnly, params] = this.handlePostOnly(type === 'market', type === 'post', params);
|
|
849
|
-
|
|
850
|
-
params = this.omit(params, ['clientOrderId', 'cliOrdId']);
|
|
851
|
-
if ((type === 'stp' || type === 'take_profit') && stopPrice === undefined) {
|
|
852
|
-
throw new errors.ArgumentsRequired(this.id + ' createOrder requires params.stopPrice when type is ' + type);
|
|
853
|
-
}
|
|
854
|
-
if (stopPrice !== undefined && type !== 'take_profit') {
|
|
855
|
-
type = 'stp';
|
|
856
|
-
}
|
|
857
|
-
else if (postOnly) {
|
|
849
|
+
if (postOnly) {
|
|
858
850
|
type = 'post';
|
|
859
851
|
}
|
|
860
852
|
else if (timeInForce === 'ioc') {
|
|
@@ -867,17 +859,49 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
867
859
|
type = 'mkt';
|
|
868
860
|
}
|
|
869
861
|
const request = {
|
|
870
|
-
'
|
|
871
|
-
'symbol': this.marketId(symbol),
|
|
862
|
+
'symbol': market['id'],
|
|
872
863
|
'side': side,
|
|
873
864
|
'size': amount,
|
|
874
865
|
};
|
|
875
|
-
|
|
876
|
-
request['limitPrice'] = price;
|
|
877
|
-
}
|
|
866
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'cliOrdId');
|
|
878
867
|
if (clientOrderId !== undefined) {
|
|
879
868
|
request['cliOrdId'] = clientOrderId;
|
|
880
869
|
}
|
|
870
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
871
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
872
|
+
const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
|
|
873
|
+
const takeProfitTriggerPrice = this.safeString(params, 'takeProfitPrice');
|
|
874
|
+
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
875
|
+
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
876
|
+
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
877
|
+
const triggerSignal = this.safeString(params, 'triggerSignal', 'last');
|
|
878
|
+
let reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
879
|
+
if (isStopLossOrTakeProfitTrigger || isTriggerOrder) {
|
|
880
|
+
request['triggerSignal'] = triggerSignal;
|
|
881
|
+
}
|
|
882
|
+
if (isTriggerOrder) {
|
|
883
|
+
type = 'stp';
|
|
884
|
+
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
885
|
+
}
|
|
886
|
+
else if (isStopLossOrTakeProfitTrigger) {
|
|
887
|
+
reduceOnly = true;
|
|
888
|
+
if (isStopLossTriggerOrder) {
|
|
889
|
+
type = 'stp';
|
|
890
|
+
request['stopPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
891
|
+
}
|
|
892
|
+
else if (isTakeProfitTriggerOrder) {
|
|
893
|
+
type = 'take_profit';
|
|
894
|
+
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
if (reduceOnly) {
|
|
898
|
+
request['reduceOnly'] = true;
|
|
899
|
+
}
|
|
900
|
+
request['orderType'] = type;
|
|
901
|
+
if (price !== undefined) {
|
|
902
|
+
request['limitPrice'] = price;
|
|
903
|
+
}
|
|
904
|
+
params = this.omit(params, ['clientOrderId', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
881
905
|
return this.extend(request, params);
|
|
882
906
|
}
|
|
883
907
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -885,19 +909,22 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
885
909
|
* @method
|
|
886
910
|
* @name krakenfutures#createOrder
|
|
887
911
|
* @description Create an order on the exchange
|
|
888
|
-
* @
|
|
889
|
-
* @param {string}
|
|
890
|
-
* @param {string}
|
|
891
|
-
* @param {
|
|
892
|
-
* @param {float}
|
|
893
|
-
* @param {float} [
|
|
894
|
-
* @param {bool} [params.reduceOnly]
|
|
895
|
-
* @param {bool} [params.postOnly]
|
|
896
|
-
* @param {string} [params.triggerSignal] If placing a stp or take_profit, the signal used for trigger, One of: 'mark', 'index', 'last', last is market price
|
|
897
|
-
* @param {string} [params.cliOrdId] UUID The order identity that is specified from the user, It must be globally unique
|
|
912
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-send-order
|
|
913
|
+
* @param {string} symbol unified market symbol
|
|
914
|
+
* @param {string} type 'limit' or 'market'
|
|
915
|
+
* @param {string} side 'buy' or 'sell'
|
|
916
|
+
* @param {float} amount number of contracts
|
|
917
|
+
* @param {float} [price] limit order price
|
|
918
|
+
* @param {bool} [params.reduceOnly] set as true if you wish the order to only reduce an existing position, any order which increases an existing position will be rejected, default is false
|
|
919
|
+
* @param {bool} [params.postOnly] set as true if you wish to make a postOnly order, default is false
|
|
898
920
|
* @param {string} [params.clientOrderId] UUID The order identity that is specified from the user, It must be globally unique
|
|
921
|
+
* @param {float} [params.triggerPrice] the price that a stop order is triggered at
|
|
922
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
923
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
924
|
+
* @param {string} [params.triggerSignal] for triggerPrice, stopLossPrice and takeProfitPrice orders, the trigger price type, 'last', 'mark' or 'index', default is 'last'
|
|
899
925
|
*/
|
|
900
926
|
await this.loadMarkets();
|
|
927
|
+
const market = this.market(symbol);
|
|
901
928
|
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
902
929
|
const response = await this.privatePostSendorder(orderRequest);
|
|
903
930
|
//
|
|
@@ -933,7 +960,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
933
960
|
const sendStatus = this.safeValue(response, 'sendStatus');
|
|
934
961
|
const status = this.safeString(sendStatus, 'status');
|
|
935
962
|
this.verifyOrderActionSuccess(status, 'createOrder', ['filled']);
|
|
936
|
-
return this.parseOrder(sendStatus);
|
|
963
|
+
return this.parseOrder(sendStatus, market);
|
|
937
964
|
}
|
|
938
965
|
async createOrders(orders, params = {}) {
|
|
939
966
|
/**
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -44,6 +44,9 @@ class kucoin extends kucoin$1 {
|
|
|
44
44
|
'createStopLimitOrder': true,
|
|
45
45
|
'createStopMarketOrder': true,
|
|
46
46
|
'createStopOrder': true,
|
|
47
|
+
'createMarketBuyOrderWithCost': true,
|
|
48
|
+
'createMarketOrderWithCost': true,
|
|
49
|
+
'createMarketSellOrderWithCost': true,
|
|
47
50
|
'editOrder': true,
|
|
48
51
|
'fetchAccounts': true,
|
|
49
52
|
'fetchBalance': true,
|
|
@@ -205,6 +208,10 @@ class kucoin extends kucoin$1 {
|
|
|
205
208
|
'stop-order': 8,
|
|
206
209
|
'stop-order/{orderId}': 3,
|
|
207
210
|
'stop-order/queryOrderByClientOid': 3,
|
|
211
|
+
'oco/order/{orderId}': 2,
|
|
212
|
+
'oco/order/details/{orderId}': 2,
|
|
213
|
+
'oco/client-order/{clientOid}': 2,
|
|
214
|
+
'oco/orders': 2,
|
|
208
215
|
// margin trading
|
|
209
216
|
'hf/margin/orders/active': 4,
|
|
210
217
|
'hf/margin/orders/done': 10,
|
|
@@ -212,6 +219,7 @@ class kucoin extends kucoin$1 {
|
|
|
212
219
|
'hf/margin/orders/client-order/{clientOid}': 5,
|
|
213
220
|
'hf/margin/fills': 5,
|
|
214
221
|
'etf/info': 25,
|
|
222
|
+
'margin/currencies': 20,
|
|
215
223
|
'risk/limit/strategy': 20,
|
|
216
224
|
'isolated/symbols': 20,
|
|
217
225
|
'isolated/account/{symbol}': 50,
|
|
@@ -247,6 +255,7 @@ class kucoin extends kucoin$1 {
|
|
|
247
255
|
'orders/test': 2,
|
|
248
256
|
'orders/multi': 3,
|
|
249
257
|
'stop-order': 2,
|
|
258
|
+
'oco/order': 2,
|
|
250
259
|
// margin trading
|
|
251
260
|
'hf/margin/order': 5,
|
|
252
261
|
'hf/margin/order/test': 5,
|
|
@@ -272,12 +281,16 @@ class kucoin extends kucoin$1 {
|
|
|
272
281
|
'hf/orders/sync/client-order/{clientOid}': 1,
|
|
273
282
|
'hf/orders/cancel/{orderId}': 2,
|
|
274
283
|
'hf/orders': 2,
|
|
284
|
+
'hf/orders/cancelAll': 30,
|
|
275
285
|
'orders/{orderId}': 3,
|
|
276
286
|
'order/client-order/{clientOid}': 5,
|
|
277
287
|
'orders': 20,
|
|
278
288
|
'stop-order/{orderId}': 3,
|
|
279
289
|
'stop-order/cancelOrderByClientOid': 5,
|
|
280
290
|
'stop-order/cancel': 3,
|
|
291
|
+
'oco/order/{orderId}': 3,
|
|
292
|
+
'oco/client-order/{clientOid}': 3,
|
|
293
|
+
'oco/orders': 3,
|
|
281
294
|
// margin trading
|
|
282
295
|
'hf/margin/orders/{orderId}': 5,
|
|
283
296
|
'hf/margin/orders/client-order/{clientOid}': 5,
|
|
@@ -298,6 +311,7 @@ class kucoin extends kucoin$1 {
|
|
|
298
311
|
'index/query': 3,
|
|
299
312
|
'mark-price/{symbol}/current': 4.5,
|
|
300
313
|
'premium/query': 4.5,
|
|
314
|
+
'trade-statistics': 4.5,
|
|
301
315
|
'funding-rate/{symbol}/current': 3,
|
|
302
316
|
'timestamp': 3,
|
|
303
317
|
'status': 6,
|
|
@@ -346,6 +360,7 @@ class kucoin extends kucoin$1 {
|
|
|
346
360
|
},
|
|
347
361
|
'delete': {
|
|
348
362
|
'orders/{orderId}': 1.5,
|
|
363
|
+
'orders/client-order/{clientOid}': 1.5,
|
|
349
364
|
'orders': 45,
|
|
350
365
|
'stopOrders': 22.5, // 15FW
|
|
351
366
|
},
|
|
@@ -533,6 +548,10 @@ class kucoin extends kucoin$1 {
|
|
|
533
548
|
'market/orderbook/level2': 'v3',
|
|
534
549
|
'market/orderbook/level3': 'v3',
|
|
535
550
|
'market/orderbook/level{level}': 'v3',
|
|
551
|
+
'oco/order/{orderId}': 'v3',
|
|
552
|
+
'oco/order/details/{orderId}': 'v3',
|
|
553
|
+
'oco/client-order/{clientOid}': 'v3',
|
|
554
|
+
'oco/orders': 'v3',
|
|
536
555
|
// margin trading
|
|
537
556
|
'hf/margin/orders/active': 'v3',
|
|
538
557
|
'hf/margin/orders/done': 'v3',
|
|
@@ -540,6 +559,7 @@ class kucoin extends kucoin$1 {
|
|
|
540
559
|
'hf/margin/orders/client-order/{clientOid}': 'v3',
|
|
541
560
|
'hf/margin/fills': 'v3',
|
|
542
561
|
'etf/info': 'v3',
|
|
562
|
+
'margin/currencies': 'v3',
|
|
543
563
|
'margin/borrow': 'v3',
|
|
544
564
|
'margin/repay': 'v3',
|
|
545
565
|
'project/list': 'v3',
|
|
@@ -556,6 +576,7 @@ class kucoin extends kucoin$1 {
|
|
|
556
576
|
'accounts/inner-transfer': 'v2',
|
|
557
577
|
'transfer-out': 'v3',
|
|
558
578
|
// spot trading
|
|
579
|
+
'oco/order': 'v3',
|
|
559
580
|
// margin trading
|
|
560
581
|
'hf/margin/order': 'v3',
|
|
561
582
|
'hf/margin/order/test': 'v3',
|
|
@@ -572,6 +593,9 @@ class kucoin extends kucoin$1 {
|
|
|
572
593
|
'hf/margin/orders/{orderId}': 'v3',
|
|
573
594
|
'hf/margin/orders/client-order/{clientOid}': 'v3',
|
|
574
595
|
'hf/margin/orders': 'v3',
|
|
596
|
+
'oco/order/{orderId}': 'v3',
|
|
597
|
+
'oco/client-order/{clientOid}': 'v3',
|
|
598
|
+
'oco/orders': 'v3',
|
|
575
599
|
// margin trading
|
|
576
600
|
},
|
|
577
601
|
},
|
|
@@ -1927,6 +1951,50 @@ class kucoin extends kucoin$1 {
|
|
|
1927
1951
|
const data = this.safeValue(response, 'data', {});
|
|
1928
1952
|
return this.parseOrder(data, market);
|
|
1929
1953
|
}
|
|
1954
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
1955
|
+
/**
|
|
1956
|
+
* @method
|
|
1957
|
+
* @name kucoin#createMarketOrderWithCost
|
|
1958
|
+
* @description create a market order by providing the symbol, side and cost
|
|
1959
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
|
|
1960
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1961
|
+
* @param {string} side 'buy' or 'sell'
|
|
1962
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1963
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1964
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1965
|
+
*/
|
|
1966
|
+
await this.loadMarkets();
|
|
1967
|
+
params['cost'] = cost;
|
|
1968
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
1969
|
+
}
|
|
1970
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1971
|
+
/**
|
|
1972
|
+
* @method
|
|
1973
|
+
* @name kucoin#createMarketBuyOrderWithCost
|
|
1974
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1975
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
|
|
1976
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1977
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1978
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1979
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1980
|
+
*/
|
|
1981
|
+
await this.loadMarkets();
|
|
1982
|
+
return await this.createMarketOrderWithCost(symbol, 'buy', cost, params);
|
|
1983
|
+
}
|
|
1984
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
1985
|
+
/**
|
|
1986
|
+
* @method
|
|
1987
|
+
* @name kucoin#createMarketSellOrderWithCost
|
|
1988
|
+
* @description create a market sell order by providing the symbol and cost
|
|
1989
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
|
|
1990
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1991
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1992
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1993
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1994
|
+
*/
|
|
1995
|
+
await this.loadMarkets();
|
|
1996
|
+
return await this.createMarketOrderWithCost(symbol, 'sell', cost, params);
|
|
1997
|
+
}
|
|
1930
1998
|
async createOrders(orders, params = {}) {
|
|
1931
1999
|
/**
|
|
1932
2000
|
* @method
|
|
@@ -2225,9 +2293,11 @@ class kucoin extends kucoin$1 {
|
|
|
2225
2293
|
}
|
|
2226
2294
|
else if (hf) {
|
|
2227
2295
|
if (symbol === undefined) {
|
|
2228
|
-
|
|
2296
|
+
response = await this.privateDeleteHfOrdersCancelAll(this.extend(request, query));
|
|
2297
|
+
}
|
|
2298
|
+
else {
|
|
2299
|
+
response = await this.privateDeleteHfOrders(this.extend(request, query));
|
|
2229
2300
|
}
|
|
2230
|
-
response = await this.privateDeleteHfOrders(this.extend(request, query));
|
|
2231
2301
|
}
|
|
2232
2302
|
else {
|
|
2233
2303
|
response = await this.privateDeleteOrders(this.extend(request, query));
|
|
@@ -2484,7 +2554,7 @@ class kucoin extends kucoin$1 {
|
|
|
2484
2554
|
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
2485
2555
|
}
|
|
2486
2556
|
}
|
|
2487
|
-
let responseData = this.safeValue(response, 'data');
|
|
2557
|
+
let responseData = this.safeValue(response, 'data', {});
|
|
2488
2558
|
if (Array.isArray(responseData)) {
|
|
2489
2559
|
responseData = this.safeValue(responseData, 0);
|
|
2490
2560
|
}
|
|
@@ -2440,7 +2440,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2440
2440
|
* @param {string} side not used by kucoinfutures closePositions
|
|
2441
2441
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2442
2442
|
* @param {string} [params.clientOrderId] client order id of the order
|
|
2443
|
-
* @returns {[
|
|
2443
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
2444
2444
|
*/
|
|
2445
2445
|
await this.loadMarkets();
|
|
2446
2446
|
const market = this.market(symbol);
|
|
@@ -942,14 +942,13 @@ class binance extends binance$1 {
|
|
|
942
942
|
event = 'ticker';
|
|
943
943
|
}
|
|
944
944
|
let timestamp = undefined;
|
|
945
|
-
const now = this.milliseconds();
|
|
946
945
|
if (event === 'bookTicker') {
|
|
947
946
|
// take the event timestamp, if available, for spot tickers it is not
|
|
948
|
-
timestamp = this.safeInteger(message, 'E'
|
|
947
|
+
timestamp = this.safeInteger(message, 'E');
|
|
949
948
|
}
|
|
950
949
|
else {
|
|
951
950
|
// take the timestamp of the closing price for candlestick streams
|
|
952
|
-
timestamp = this.safeInteger(message, 'C'
|
|
951
|
+
timestamp = this.safeInteger(message, 'C');
|
|
953
952
|
}
|
|
954
953
|
const marketId = this.safeString(message, 's');
|
|
955
954
|
const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
|
|
@@ -209,7 +209,6 @@ class bitfinex extends bitfinex$1 {
|
|
|
209
209
|
// 220.05, // 10 LOW float Daily low
|
|
210
210
|
// ]
|
|
211
211
|
//
|
|
212
|
-
const timestamp = this.milliseconds();
|
|
213
212
|
const marketId = this.safeString(subscription, 'pair');
|
|
214
213
|
const symbol = this.safeSymbol(marketId);
|
|
215
214
|
const channel = 'ticker';
|
|
@@ -222,8 +221,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
222
221
|
}
|
|
223
222
|
const result = {
|
|
224
223
|
'symbol': symbol,
|
|
225
|
-
'timestamp':
|
|
226
|
-
'datetime':
|
|
224
|
+
'timestamp': undefined,
|
|
225
|
+
'datetime': undefined,
|
|
227
226
|
'high': this.safeFloat(message, 9),
|
|
228
227
|
'low': this.safeFloat(message, 10),
|
|
229
228
|
'bid': this.safeFloat(message, 1),
|
package/dist/cjs/src/pro/cex.js
CHANGED
|
@@ -732,7 +732,7 @@ class cex extends cex$1 {
|
|
|
732
732
|
'rate': undefined,
|
|
733
733
|
};
|
|
734
734
|
}
|
|
735
|
-
const timestamp = this.safeInteger(data, 'time'
|
|
735
|
+
const timestamp = this.safeInteger(data, 'time');
|
|
736
736
|
order['timestamp'] = timestamp;
|
|
737
737
|
order['datetime'] = this.iso8601(timestamp);
|
|
738
738
|
order = this.safeOrder(order);
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -720,7 +720,7 @@ class gate extends gate$1 {
|
|
|
720
720
|
// }
|
|
721
721
|
//
|
|
722
722
|
const result = this.safeValue(message, 'result', []);
|
|
723
|
-
const timestamp = this.safeInteger(message, '
|
|
723
|
+
const timestamp = this.safeInteger(message, 'time_ms');
|
|
724
724
|
this.balance['info'] = result;
|
|
725
725
|
this.balance['timestamp'] = timestamp;
|
|
726
726
|
this.balance['datetime'] = this.iso8601(timestamp);
|
|
@@ -796,7 +796,7 @@ class gate extends gate$1 {
|
|
|
796
796
|
if (this.newUpdates) {
|
|
797
797
|
return positions;
|
|
798
798
|
}
|
|
799
|
-
return this.filterBySymbolsSinceLimit(this.positions, symbols, since, limit, true);
|
|
799
|
+
return this.filterBySymbolsSinceLimit(this.positions[type], symbols, since, limit, true);
|
|
800
800
|
}
|
|
801
801
|
setPositionsCache(client, type, symbols = undefined) {
|
|
802
802
|
if (this.positions === undefined) {
|
|
@@ -322,11 +322,10 @@ class kraken extends kraken$1 {
|
|
|
322
322
|
quoteVolume = Precise["default"].stringMul(baseVolume, vwap);
|
|
323
323
|
}
|
|
324
324
|
const last = this.safeString(ticker['c'], 0);
|
|
325
|
-
const timestamp = this.milliseconds();
|
|
326
325
|
const result = this.safeTicker({
|
|
327
326
|
'symbol': symbol,
|
|
328
|
-
'timestamp':
|
|
329
|
-
'datetime':
|
|
327
|
+
'timestamp': undefined,
|
|
328
|
+
'datetime': undefined,
|
|
330
329
|
'high': this.safeString(ticker['h'], 0),
|
|
331
330
|
'low': this.safeString(ticker['l'], 0),
|
|
332
331
|
'bid': this.safeString(ticker['b'], 0),
|