ccxt 4.4.64 → 4.4.65
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 +5 -6
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -6
- package/dist/cjs/src/cryptocom.js +2 -0
- package/dist/cjs/src/hyperliquid.js +120 -73
- package/dist/cjs/src/paradex.js +62 -14
- package/dist/cjs/src/pro/bybit.js +3 -2
- package/dist/cjs/src/pro/gate.js +5 -2
- package/dist/cjs/src/pro/hyperliquid.js +3 -3
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/cryptocom.js +2 -0
- package/js/src/hyperliquid.d.ts +12 -3
- package/js/src/hyperliquid.js +120 -73
- package/js/src/paradex.d.ts +2 -0
- package/js/src/paradex.js +62 -14
- package/js/src/pro/bybit.js +3 -2
- package/js/src/pro/gate.js +5 -2
- package/js/src/pro/hyperliquid.d.ts +0 -1
- package/js/src/pro/hyperliquid.js +3 -3
- package/package.json +1 -1
- package/js/src/abstract/currencycom.d.ts +0 -71
- package/js/src/abstract/currencycom.js +0 -11
- package/js/src/currencycom.d.ts +0 -284
- package/js/src/currencycom.js +0 -2123
- package/js/src/pro/currencycom.d.ts +0 -88
- package/js/src/pro/currencycom.js +0 -564
package/dist/cjs/ccxt.js
CHANGED
|
@@ -63,7 +63,6 @@ var coinone = require('./src/coinone.js');
|
|
|
63
63
|
var coinsph = require('./src/coinsph.js');
|
|
64
64
|
var coinspot = require('./src/coinspot.js');
|
|
65
65
|
var cryptocom = require('./src/cryptocom.js');
|
|
66
|
-
var currencycom = require('./src/currencycom.js');
|
|
67
66
|
var defx = require('./src/defx.js');
|
|
68
67
|
var delta = require('./src/delta.js');
|
|
69
68
|
var deribit = require('./src/deribit.js');
|
|
@@ -155,7 +154,6 @@ var coincheck$1 = require('./src/pro/coincheck.js');
|
|
|
155
154
|
var coinex$1 = require('./src/pro/coinex.js');
|
|
156
155
|
var coinone$1 = require('./src/pro/coinone.js');
|
|
157
156
|
var cryptocom$1 = require('./src/pro/cryptocom.js');
|
|
158
|
-
var currencycom$1 = require('./src/pro/currencycom.js');
|
|
159
157
|
var defx$1 = require('./src/pro/defx.js');
|
|
160
158
|
var deribit$1 = require('./src/pro/deribit.js');
|
|
161
159
|
var exmo$1 = require('./src/pro/exmo.js');
|
|
@@ -199,7 +197,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
199
197
|
|
|
200
198
|
//-----------------------------------------------------------------------------
|
|
201
199
|
// this is updated by vss.js when building
|
|
202
|
-
const version = '4.4.
|
|
200
|
+
const version = '4.4.65';
|
|
203
201
|
Exchange["default"].ccxtVersion = version;
|
|
204
202
|
const exchanges = {
|
|
205
203
|
'ace': ace,
|
|
@@ -253,7 +251,6 @@ const exchanges = {
|
|
|
253
251
|
'coinsph': coinsph,
|
|
254
252
|
'coinspot': coinspot,
|
|
255
253
|
'cryptocom': cryptocom,
|
|
256
|
-
'currencycom': currencycom,
|
|
257
254
|
'defx': defx,
|
|
258
255
|
'delta': delta,
|
|
259
256
|
'deribit': deribit,
|
|
@@ -347,7 +344,6 @@ const pro = {
|
|
|
347
344
|
'coinex': coinex$1,
|
|
348
345
|
'coinone': coinone$1,
|
|
349
346
|
'cryptocom': cryptocom$1,
|
|
350
|
-
'currencycom': currencycom$1,
|
|
351
347
|
'defx': defx$1,
|
|
352
348
|
'deribit': deribit$1,
|
|
353
349
|
'exmo': exmo$1,
|
|
@@ -490,7 +486,6 @@ exports.coinone = coinone;
|
|
|
490
486
|
exports.coinsph = coinsph;
|
|
491
487
|
exports.coinspot = coinspot;
|
|
492
488
|
exports.cryptocom = cryptocom;
|
|
493
|
-
exports.currencycom = currencycom;
|
|
494
489
|
exports.defx = defx;
|
|
495
490
|
exports.delta = delta;
|
|
496
491
|
exports.deribit = deribit;
|
|
@@ -453,6 +453,8 @@ class cryptocom extends cryptocom$1 {
|
|
|
453
453
|
'exact': {
|
|
454
454
|
'219': errors.InvalidOrder,
|
|
455
455
|
'314': errors.InvalidOrder,
|
|
456
|
+
'325': errors.InvalidOrder,
|
|
457
|
+
'415': errors.InvalidOrder,
|
|
456
458
|
'10001': errors.ExchangeError,
|
|
457
459
|
'10002': errors.PermissionDenied,
|
|
458
460
|
'10003': errors.PermissionDenied,
|
|
@@ -51,6 +51,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
51
51
|
'createStopOrder': true,
|
|
52
52
|
'createTriggerOrder': true,
|
|
53
53
|
'editOrder': true,
|
|
54
|
+
'editOrders': true,
|
|
54
55
|
'fetchAccounts': false,
|
|
55
56
|
'fetchBalance': true,
|
|
56
57
|
'fetchBorrowInterest': false,
|
|
@@ -1368,7 +1369,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1368
1369
|
*/
|
|
1369
1370
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1370
1371
|
await this.loadMarkets();
|
|
1371
|
-
const [order, globalParams] = this.
|
|
1372
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
1372
1373
|
const orders = await this.createOrders([order], globalParams);
|
|
1373
1374
|
return orders[0];
|
|
1374
1375
|
}
|
|
@@ -1757,84 +1758,112 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1757
1758
|
//
|
|
1758
1759
|
return response;
|
|
1759
1760
|
}
|
|
1760
|
-
|
|
1761
|
+
editOrdersRequest(orders, params = {}) {
|
|
1761
1762
|
this.checkRequiredCredentials();
|
|
1762
|
-
|
|
1763
|
-
|
|
1763
|
+
let hasClientOrderId = false;
|
|
1764
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1765
|
+
const rawOrder = orders[i];
|
|
1766
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1767
|
+
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
1768
|
+
if (clientOrderId !== undefined) {
|
|
1769
|
+
hasClientOrderId = true;
|
|
1770
|
+
}
|
|
1764
1771
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
if (postOnly) {
|
|
1775
|
-
defaultTimeInForce = 'alo';
|
|
1776
|
-
}
|
|
1777
|
-
let timeInForce = this.safeStringLower(params, 'timeInForce', defaultTimeInForce);
|
|
1778
|
-
timeInForce = this.capitalize(timeInForce);
|
|
1779
|
-
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_id');
|
|
1780
|
-
let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1781
|
-
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice);
|
|
1782
|
-
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
1783
|
-
const isTrigger = (stopLossPrice || takeProfitPrice);
|
|
1784
|
-
params = this.omit(params, ['slippage', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'clientOrderId', 'client_id']);
|
|
1785
|
-
let px = price.toString();
|
|
1786
|
-
if (isMarket) {
|
|
1787
|
-
px = (isBuy) ? Precise["default"].stringMul(price.toString(), Precise["default"].stringAdd('1', slippage)) : Precise["default"].stringMul(price.toString(), Precise["default"].stringSub('1', slippage));
|
|
1772
|
+
if (hasClientOrderId) {
|
|
1773
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1774
|
+
const rawOrder = orders[i];
|
|
1775
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1776
|
+
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
1777
|
+
if (clientOrderId === undefined) {
|
|
1778
|
+
throw new errors.ArgumentsRequired(this.id + ' editOrders() all orders must have clientOrderId if at least one has a clientOrderId');
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1788
1781
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1782
|
+
params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']);
|
|
1783
|
+
const modifies = [];
|
|
1784
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1785
|
+
const rawOrder = orders[i];
|
|
1786
|
+
const id = this.safeString(rawOrder, 'id');
|
|
1787
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
1788
|
+
const market = this.market(marketId);
|
|
1789
|
+
const symbol = market['symbol'];
|
|
1790
|
+
const type = this.safeStringUpper(rawOrder, 'type');
|
|
1791
|
+
const isMarket = (type === 'MARKET');
|
|
1792
|
+
const side = this.safeStringUpper(rawOrder, 'side');
|
|
1793
|
+
const isBuy = (side === 'BUY');
|
|
1794
|
+
const amount = this.safeString(rawOrder, 'amount');
|
|
1795
|
+
const price = this.safeString(rawOrder, 'price');
|
|
1796
|
+
let orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1797
|
+
const defaultSlippage = this.safeString(this.options, 'defaultSlippage');
|
|
1798
|
+
const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
|
|
1799
|
+
let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
|
|
1800
|
+
const postOnly = this.safeBool(orderParams, 'postOnly', false);
|
|
1801
|
+
if (postOnly) {
|
|
1802
|
+
defaultTimeInForce = 'alo';
|
|
1803
|
+
}
|
|
1804
|
+
let timeInForce = this.safeStringLower(orderParams, 'timeInForce', defaultTimeInForce);
|
|
1805
|
+
timeInForce = this.capitalize(timeInForce);
|
|
1806
|
+
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
1807
|
+
let triggerPrice = this.safeString2(orderParams, 'triggerPrice', 'stopPrice');
|
|
1808
|
+
const stopLossPrice = this.safeString(orderParams, 'stopLossPrice', triggerPrice);
|
|
1809
|
+
const takeProfitPrice = this.safeString(orderParams, 'takeProfitPrice');
|
|
1810
|
+
const isTrigger = (stopLossPrice || takeProfitPrice);
|
|
1811
|
+
const reduceOnly = this.safeBool(orderParams, 'reduceOnly', false);
|
|
1812
|
+
orderParams = this.omit(orderParams, ['slippage', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'clientOrderId', 'client_id', 'postOnly', 'reduceOnly']);
|
|
1813
|
+
let px = price.toString();
|
|
1814
|
+
if (isMarket) {
|
|
1815
|
+
px = (isBuy) ? Precise["default"].stringMul(price.toString(), Precise["default"].stringAdd('1', slippage)) : Precise["default"].stringMul(price.toString(), Precise["default"].stringSub('1', slippage));
|
|
1816
|
+
}
|
|
1817
|
+
else {
|
|
1818
|
+
px = this.priceToPrecision(symbol, price.toString());
|
|
1819
|
+
}
|
|
1820
|
+
const sz = this.amountToPrecision(symbol, amount);
|
|
1821
|
+
const orderType = {};
|
|
1822
|
+
if (isTrigger) {
|
|
1823
|
+
let isTp = false;
|
|
1824
|
+
if (takeProfitPrice !== undefined) {
|
|
1825
|
+
triggerPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1826
|
+
isTp = true;
|
|
1827
|
+
}
|
|
1828
|
+
else {
|
|
1829
|
+
triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
1830
|
+
}
|
|
1831
|
+
orderType['trigger'] = {
|
|
1832
|
+
'isMarket': isMarket,
|
|
1833
|
+
'triggerPx': triggerPrice,
|
|
1834
|
+
'tpsl': (isTp) ? 'tp' : 'sl',
|
|
1835
|
+
};
|
|
1800
1836
|
}
|
|
1801
1837
|
else {
|
|
1802
|
-
|
|
1838
|
+
orderType['limit'] = {
|
|
1839
|
+
'tif': timeInForce,
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
if (triggerPrice === undefined) {
|
|
1843
|
+
triggerPrice = '0';
|
|
1803
1844
|
}
|
|
1804
|
-
|
|
1805
|
-
'
|
|
1806
|
-
'
|
|
1807
|
-
'
|
|
1845
|
+
const orderReq = {
|
|
1846
|
+
'a': this.parseToInt(market['baseId']),
|
|
1847
|
+
'b': isBuy,
|
|
1848
|
+
'p': px,
|
|
1849
|
+
's': sz,
|
|
1850
|
+
'r': reduceOnly,
|
|
1851
|
+
't': orderType,
|
|
1852
|
+
// 'c': clientOrderId,
|
|
1808
1853
|
};
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1854
|
+
if (clientOrderId !== undefined) {
|
|
1855
|
+
orderReq['c'] = clientOrderId;
|
|
1856
|
+
}
|
|
1857
|
+
const modifyReq = {
|
|
1858
|
+
'oid': this.parseToInt(id),
|
|
1859
|
+
'order': orderReq,
|
|
1813
1860
|
};
|
|
1814
|
-
|
|
1815
|
-
if (triggerPrice === undefined) {
|
|
1816
|
-
triggerPrice = '0';
|
|
1861
|
+
modifies.push(modifyReq);
|
|
1817
1862
|
}
|
|
1818
1863
|
const nonce = this.milliseconds();
|
|
1819
|
-
const orderReq = {
|
|
1820
|
-
'a': this.parseToInt(market['baseId']),
|
|
1821
|
-
'b': isBuy,
|
|
1822
|
-
'p': px,
|
|
1823
|
-
's': sz,
|
|
1824
|
-
'r': reduceOnly,
|
|
1825
|
-
't': orderType,
|
|
1826
|
-
// 'c': clientOrderId,
|
|
1827
|
-
};
|
|
1828
|
-
if (clientOrderId !== undefined) {
|
|
1829
|
-
orderReq['c'] = clientOrderId;
|
|
1830
|
-
}
|
|
1831
|
-
const modifyReq = {
|
|
1832
|
-
'oid': this.parseToInt(id),
|
|
1833
|
-
'order': orderReq,
|
|
1834
|
-
};
|
|
1835
1864
|
const modifyAction = {
|
|
1836
1865
|
'type': 'batchModify',
|
|
1837
|
-
'modifies':
|
|
1866
|
+
'modifies': modifies,
|
|
1838
1867
|
};
|
|
1839
1868
|
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1840
1869
|
const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
|
|
@@ -1854,7 +1883,6 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1854
1883
|
* @method
|
|
1855
1884
|
* @name hyperliquid#editOrder
|
|
1856
1885
|
* @description edit a trade order
|
|
1857
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
1858
1886
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
1859
1887
|
* @param {string} id cancel order id
|
|
1860
1888
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -1873,8 +1901,25 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1873
1901
|
*/
|
|
1874
1902
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1875
1903
|
await this.loadMarkets();
|
|
1876
|
-
|
|
1877
|
-
|
|
1904
|
+
if (id === undefined) {
|
|
1905
|
+
throw new errors.ArgumentsRequired(this.id + ' editOrder() requires an id argument');
|
|
1906
|
+
}
|
|
1907
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(id, symbol, type, side, amount, price, params);
|
|
1908
|
+
const orders = await this.editOrders([order], globalParams);
|
|
1909
|
+
return orders[0];
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* @method
|
|
1913
|
+
* @name hyperliquid#editOrders
|
|
1914
|
+
* @description edit a list of trade orders
|
|
1915
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
1916
|
+
* @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
|
|
1917
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1918
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1919
|
+
*/
|
|
1920
|
+
async editOrders(orders, params = {}) {
|
|
1921
|
+
await this.loadMarkets();
|
|
1922
|
+
const request = this.editOrdersRequest(orders, params);
|
|
1878
1923
|
const response = await this.privatePostExchange(request);
|
|
1879
1924
|
//
|
|
1880
1925
|
// {
|
|
@@ -1914,8 +1959,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1914
1959
|
const responseObject = this.safeDict(response, 'response', {});
|
|
1915
1960
|
const dataObject = this.safeDict(responseObject, 'data', {});
|
|
1916
1961
|
const statuses = this.safeList(dataObject, 'statuses', []);
|
|
1917
|
-
|
|
1918
|
-
return this.parseOrder(first, market);
|
|
1962
|
+
return this.parseOrders(statuses);
|
|
1919
1963
|
}
|
|
1920
1964
|
/**
|
|
1921
1965
|
* @method
|
|
@@ -3535,7 +3579,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
3535
3579
|
}
|
|
3536
3580
|
return this.safeValue(config, 'cost', 1);
|
|
3537
3581
|
}
|
|
3538
|
-
|
|
3582
|
+
parseCreateEditOrderArgs(id, symbol, type, side, amount, price = undefined, params = {}) {
|
|
3539
3583
|
const market = this.market(symbol);
|
|
3540
3584
|
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
3541
3585
|
params = this.omit(params, 'vaultAddress');
|
|
@@ -3552,6 +3596,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
3552
3596
|
if (vaultAddress !== undefined) {
|
|
3553
3597
|
globalParams['vaultAddress'] = vaultAddress;
|
|
3554
3598
|
}
|
|
3599
|
+
if (id !== undefined) {
|
|
3600
|
+
order['id'] = id;
|
|
3601
|
+
}
|
|
3555
3602
|
return [order, globalParams];
|
|
3556
3603
|
}
|
|
3557
3604
|
}
|
package/dist/cjs/src/paradex.js
CHANGED
|
@@ -1184,6 +1184,11 @@ class paradex extends paradex$1 {
|
|
|
1184
1184
|
const average = this.omitZero(this.safeString(order, 'avg_fill_price'));
|
|
1185
1185
|
const remaining = this.omitZero(this.safeString(order, 'remaining_size'));
|
|
1186
1186
|
const lastUpdateTimestamp = this.safeInteger(order, 'last_updated_at');
|
|
1187
|
+
const flags = this.safeList(order, 'flags', []);
|
|
1188
|
+
let reduceOnly = undefined;
|
|
1189
|
+
if ('REDUCE_ONLY' in flags) {
|
|
1190
|
+
reduceOnly = true;
|
|
1191
|
+
}
|
|
1187
1192
|
return this.safeOrder({
|
|
1188
1193
|
'id': orderId,
|
|
1189
1194
|
'clientOrderId': clientOrderId,
|
|
@@ -1196,7 +1201,7 @@ class paradex extends paradex$1 {
|
|
|
1196
1201
|
'type': this.parseOrderType(orderType),
|
|
1197
1202
|
'timeInForce': this.parseTimeInForce(this.safeString(order, 'instrunction')),
|
|
1198
1203
|
'postOnly': undefined,
|
|
1199
|
-
'reduceOnly':
|
|
1204
|
+
'reduceOnly': reduceOnly,
|
|
1200
1205
|
'side': side,
|
|
1201
1206
|
'price': price,
|
|
1202
1207
|
'triggerPrice': this.safeString(order, 'trigger_price'),
|
|
@@ -1264,6 +1269,8 @@ class paradex extends paradex$1 {
|
|
|
1264
1269
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1265
1270
|
* @param {float} [params.stopPrice] alias for triggerPrice
|
|
1266
1271
|
* @param {float} [params.triggerPrice] The price a trigger order is triggered at
|
|
1272
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
1273
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
1267
1274
|
* @param {string} [params.timeInForce] "GTC", "IOC", or "POST_ONLY"
|
|
1268
1275
|
* @param {bool} [params.postOnly] true or false
|
|
1269
1276
|
* @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
|
|
@@ -1274,17 +1281,21 @@ class paradex extends paradex$1 {
|
|
|
1274
1281
|
await this.authenticateRest();
|
|
1275
1282
|
await this.loadMarkets();
|
|
1276
1283
|
const market = this.market(symbol);
|
|
1277
|
-
|
|
1284
|
+
let reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
|
|
1278
1285
|
const orderType = type.toUpperCase();
|
|
1279
1286
|
const orderSide = side.toUpperCase();
|
|
1280
1287
|
const request = {
|
|
1281
1288
|
'market': market['id'],
|
|
1282
1289
|
'side': orderSide,
|
|
1283
|
-
'type': orderType,
|
|
1284
|
-
'size': this.amountToPrecision(symbol, amount),
|
|
1290
|
+
'type': orderType, // LIMIT/MARKET/STOP_LIMIT/STOP_MARKET,STOP_LOSS_MARKET,STOP_LOSS_LIMIT,TAKE_PROFIT_MARKET,TAKE_PROFIT_LIMIT
|
|
1285
1291
|
};
|
|
1286
1292
|
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1293
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
1294
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
1287
1295
|
const isMarket = orderType === 'MARKET';
|
|
1296
|
+
const isTakeProfitOrder = (takeProfitPrice !== undefined);
|
|
1297
|
+
const isStopLossOrder = (stopLossPrice !== undefined);
|
|
1298
|
+
const isStopOrder = (triggerPrice !== undefined) || isTakeProfitOrder || isStopLossOrder;
|
|
1288
1299
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
1289
1300
|
const postOnly = this.isPostOnly(isMarket, undefined, params);
|
|
1290
1301
|
if (!isMarket) {
|
|
@@ -1295,11 +1306,6 @@ class paradex extends paradex$1 {
|
|
|
1295
1306
|
request['instruction'] = 'IOC';
|
|
1296
1307
|
}
|
|
1297
1308
|
}
|
|
1298
|
-
if (reduceOnly) {
|
|
1299
|
-
request['flags'] = [
|
|
1300
|
-
'REDUCE_ONLY',
|
|
1301
|
-
];
|
|
1302
|
-
}
|
|
1303
1309
|
if (price !== undefined) {
|
|
1304
1310
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1305
1311
|
}
|
|
@@ -1307,16 +1313,58 @@ class paradex extends paradex$1 {
|
|
|
1307
1313
|
if (clientOrderId !== undefined) {
|
|
1308
1314
|
request['client_id'] = clientOrderId;
|
|
1309
1315
|
}
|
|
1310
|
-
|
|
1316
|
+
let sizeString = '0';
|
|
1317
|
+
let stopPrice = undefined;
|
|
1318
|
+
if (isStopOrder) {
|
|
1319
|
+
// flags: Reduce_Only must be provided for TPSL orders.
|
|
1311
1320
|
if (isMarket) {
|
|
1312
|
-
|
|
1321
|
+
if (isStopLossOrder) {
|
|
1322
|
+
stopPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
1323
|
+
reduceOnly = true;
|
|
1324
|
+
request['type'] = 'STOP_LOSS_MARKET';
|
|
1325
|
+
}
|
|
1326
|
+
else if (isTakeProfitOrder) {
|
|
1327
|
+
stopPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1328
|
+
reduceOnly = true;
|
|
1329
|
+
request['type'] = 'TAKE_PROFIT_MARKET';
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
stopPrice = this.priceToPrecision(symbol, triggerPrice);
|
|
1333
|
+
sizeString = this.amountToPrecision(symbol, amount);
|
|
1334
|
+
request['type'] = 'STOP_MARKET';
|
|
1335
|
+
}
|
|
1313
1336
|
}
|
|
1314
1337
|
else {
|
|
1315
|
-
|
|
1338
|
+
if (isStopLossOrder) {
|
|
1339
|
+
stopPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
1340
|
+
reduceOnly = true;
|
|
1341
|
+
request['type'] = 'STOP_LOSS_LIMIT';
|
|
1342
|
+
}
|
|
1343
|
+
else if (isTakeProfitOrder) {
|
|
1344
|
+
stopPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1345
|
+
reduceOnly = true;
|
|
1346
|
+
request['type'] = 'TAKE_PROFIT_LIMIT';
|
|
1347
|
+
}
|
|
1348
|
+
else {
|
|
1349
|
+
stopPrice = this.priceToPrecision(symbol, triggerPrice);
|
|
1350
|
+
sizeString = this.amountToPrecision(symbol, amount);
|
|
1351
|
+
request['type'] = 'STOP_LIMIT';
|
|
1352
|
+
}
|
|
1316
1353
|
}
|
|
1317
|
-
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1318
1354
|
}
|
|
1319
|
-
|
|
1355
|
+
else {
|
|
1356
|
+
sizeString = this.amountToPrecision(symbol, amount);
|
|
1357
|
+
}
|
|
1358
|
+
if (stopPrice !== undefined) {
|
|
1359
|
+
request['trigger_price'] = stopPrice;
|
|
1360
|
+
}
|
|
1361
|
+
request['size'] = sizeString;
|
|
1362
|
+
if (reduceOnly) {
|
|
1363
|
+
request['flags'] = [
|
|
1364
|
+
'REDUCE_ONLY',
|
|
1365
|
+
];
|
|
1366
|
+
}
|
|
1367
|
+
params = this.omit(params, ['reduceOnly', 'reduce_only', 'clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
1320
1368
|
const account = await this.retrieveAccount();
|
|
1321
1369
|
const now = this.nonce();
|
|
1322
1370
|
const orderReq = {
|
|
@@ -780,7 +780,7 @@ class bybit extends bybit$1 {
|
|
|
780
780
|
}
|
|
781
781
|
const stored = this.ohlcvs[symbol][timeframe];
|
|
782
782
|
for (let i = 0; i < data.length; i++) {
|
|
783
|
-
const parsed = this.parseWsOHLCV(data[i]);
|
|
783
|
+
const parsed = this.parseWsOHLCV(data[i], market);
|
|
784
784
|
stored.append(parsed);
|
|
785
785
|
}
|
|
786
786
|
const messageHash = 'ohlcv::' + symbol + '::' + timeframe;
|
|
@@ -803,13 +803,14 @@ class bybit extends bybit$1 {
|
|
|
803
803
|
// "timestamp": 1670363219614
|
|
804
804
|
// }
|
|
805
805
|
//
|
|
806
|
+
const volumeIndex = (market['inverse']) ? 'turnover' : 'volume';
|
|
806
807
|
return [
|
|
807
808
|
this.safeInteger(ohlcv, 'start'),
|
|
808
809
|
this.safeNumber(ohlcv, 'open'),
|
|
809
810
|
this.safeNumber(ohlcv, 'high'),
|
|
810
811
|
this.safeNumber(ohlcv, 'low'),
|
|
811
812
|
this.safeNumber(ohlcv, 'close'),
|
|
812
|
-
this.
|
|
813
|
+
this.safeNumber(ohlcv, volumeIndex),
|
|
813
814
|
];
|
|
814
815
|
}
|
|
815
816
|
/**
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -1190,7 +1190,10 @@ class gate extends gate$1 {
|
|
|
1190
1190
|
const cache = this.positions[type];
|
|
1191
1191
|
for (let i = 0; i < positions.length; i++) {
|
|
1192
1192
|
const position = positions[i];
|
|
1193
|
-
|
|
1193
|
+
const contracts = this.safeNumber(position, 'contracts', 0);
|
|
1194
|
+
if (contracts > 0) {
|
|
1195
|
+
cache.append(position);
|
|
1196
|
+
}
|
|
1194
1197
|
}
|
|
1195
1198
|
// don't remove the future from the .futures cache
|
|
1196
1199
|
const future = client.futures[messageHash];
|
|
@@ -2023,7 +2026,7 @@ class gate extends gate$1 {
|
|
|
2023
2026
|
};
|
|
2024
2027
|
if ((channel === 'spot.order_place') || (channel === 'futures.order_place')) {
|
|
2025
2028
|
payload['req_header'] = {
|
|
2026
|
-
'
|
|
2029
|
+
'X-Gate-Channel-Id': 'ccxt',
|
|
2027
2030
|
};
|
|
2028
2031
|
}
|
|
2029
2032
|
const request = {
|
|
@@ -93,7 +93,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
93
93
|
*/
|
|
94
94
|
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
95
95
|
await this.loadMarkets();
|
|
96
|
-
const [order, globalParams] = this.
|
|
96
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
97
97
|
const orders = await this.createOrdersWs([order], globalParams);
|
|
98
98
|
return orders[0];
|
|
99
99
|
}
|
|
@@ -101,7 +101,6 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
101
101
|
* @method
|
|
102
102
|
* @name hyperliquid#editOrderWs
|
|
103
103
|
* @description edit a trade order
|
|
104
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
105
104
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
106
105
|
* @param {string} id cancel order id
|
|
107
106
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -122,7 +121,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
122
121
|
await this.loadMarkets();
|
|
123
122
|
const market = this.market(symbol);
|
|
124
123
|
const url = this.urls['api']['ws']['public'];
|
|
125
|
-
const
|
|
124
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(id, symbol, type, side, amount, price, params);
|
|
125
|
+
const postRequest = this.editOrdersRequest([order], globalParams);
|
|
126
126
|
const wrapped = this.wrapAsPostAction(postRequest);
|
|
127
127
|
const request = this.safeDict(wrapped, 'request', {});
|
|
128
128
|
const requestId = this.safeString(wrapped, 'requestId');
|
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 type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.64";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -56,7 +56,6 @@ import coinone from './src/coinone.js';
|
|
|
56
56
|
import coinsph from './src/coinsph.js';
|
|
57
57
|
import coinspot from './src/coinspot.js';
|
|
58
58
|
import cryptocom from './src/cryptocom.js';
|
|
59
|
-
import currencycom from './src/currencycom.js';
|
|
60
59
|
import defx from './src/defx.js';
|
|
61
60
|
import delta from './src/delta.js';
|
|
62
61
|
import deribit from './src/deribit.js';
|
|
@@ -148,7 +147,6 @@ import coincheckPro from './src/pro/coincheck.js';
|
|
|
148
147
|
import coinexPro from './src/pro/coinex.js';
|
|
149
148
|
import coinonePro from './src/pro/coinone.js';
|
|
150
149
|
import cryptocomPro from './src/pro/cryptocom.js';
|
|
151
|
-
import currencycomPro from './src/pro/currencycom.js';
|
|
152
150
|
import defxPro from './src/pro/defx.js';
|
|
153
151
|
import deribitPro from './src/pro/deribit.js';
|
|
154
152
|
import exmoPro from './src/pro/exmo.js';
|
|
@@ -241,7 +239,6 @@ declare const exchanges: {
|
|
|
241
239
|
coinsph: typeof coinsph;
|
|
242
240
|
coinspot: typeof coinspot;
|
|
243
241
|
cryptocom: typeof cryptocom;
|
|
244
|
-
currencycom: typeof currencycom;
|
|
245
242
|
defx: typeof defx;
|
|
246
243
|
delta: typeof delta;
|
|
247
244
|
deribit: typeof deribit;
|
|
@@ -335,7 +332,6 @@ declare const pro: {
|
|
|
335
332
|
coinex: typeof coinexPro;
|
|
336
333
|
coinone: typeof coinonePro;
|
|
337
334
|
cryptocom: typeof cryptocomPro;
|
|
338
|
-
currencycom: typeof currencycomPro;
|
|
339
335
|
defx: typeof defxPro;
|
|
340
336
|
deribit: typeof deribitPro;
|
|
341
337
|
exmo: typeof exmoPro;
|
|
@@ -416,7 +412,6 @@ declare const ccxt: {
|
|
|
416
412
|
coinex: typeof coinexPro;
|
|
417
413
|
coinone: typeof coinonePro;
|
|
418
414
|
cryptocom: typeof cryptocomPro;
|
|
419
|
-
currencycom: typeof currencycomPro;
|
|
420
415
|
defx: typeof defxPro;
|
|
421
416
|
deribit: typeof deribitPro;
|
|
422
417
|
exmo: typeof exmoPro;
|
|
@@ -510,7 +505,6 @@ declare const ccxt: {
|
|
|
510
505
|
coinsph: typeof coinsph;
|
|
511
506
|
coinspot: typeof coinspot;
|
|
512
507
|
cryptocom: typeof cryptocom;
|
|
513
|
-
currencycom: typeof currencycom;
|
|
514
508
|
defx: typeof defx;
|
|
515
509
|
delta: typeof delta;
|
|
516
510
|
deribit: typeof deribit;
|
|
@@ -570,5 +564,5 @@ declare const ccxt: {
|
|
|
570
564
|
zaif: typeof zaif;
|
|
571
565
|
zonda: typeof zonda;
|
|
572
566
|
} & typeof functions & typeof errors;
|
|
573
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, OrderBooks, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitcoincom, bitfinex, bitfinex1, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom,
|
|
567
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, OrderBooks, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitcoincom, bitfinex, bitfinex1, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, defx, delta, deribit, digifinex, ellipx, exmo, fmfwio, gate, gateio, gemini, hashkey, hitbtc, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, mercado, mexc, myokx, ndax, novadax, oceanex, okcoin, okx, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, vertex, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zonda, };
|
|
574
568
|
export default ccxt;
|