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/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
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';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.65';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -92,7 +92,6 @@ import coinone from './src/coinone.js';
|
|
|
92
92
|
import coinsph from './src/coinsph.js';
|
|
93
93
|
import coinspot from './src/coinspot.js';
|
|
94
94
|
import cryptocom from './src/cryptocom.js';
|
|
95
|
-
import currencycom from './src/currencycom.js';
|
|
96
95
|
import defx from './src/defx.js';
|
|
97
96
|
import delta from './src/delta.js';
|
|
98
97
|
import deribit from './src/deribit.js';
|
|
@@ -185,7 +184,6 @@ import coincheckPro from './src/pro/coincheck.js';
|
|
|
185
184
|
import coinexPro from './src/pro/coinex.js';
|
|
186
185
|
import coinonePro from './src/pro/coinone.js';
|
|
187
186
|
import cryptocomPro from './src/pro/cryptocom.js';
|
|
188
|
-
import currencycomPro from './src/pro/currencycom.js';
|
|
189
187
|
import defxPro from './src/pro/defx.js';
|
|
190
188
|
import deribitPro from './src/pro/deribit.js';
|
|
191
189
|
import exmoPro from './src/pro/exmo.js';
|
|
@@ -278,7 +276,6 @@ const exchanges = {
|
|
|
278
276
|
'coinsph': coinsph,
|
|
279
277
|
'coinspot': coinspot,
|
|
280
278
|
'cryptocom': cryptocom,
|
|
281
|
-
'currencycom': currencycom,
|
|
282
279
|
'defx': defx,
|
|
283
280
|
'delta': delta,
|
|
284
281
|
'deribit': deribit,
|
|
@@ -372,7 +369,6 @@ const pro = {
|
|
|
372
369
|
'coinex': coinexPro,
|
|
373
370
|
'coinone': coinonePro,
|
|
374
371
|
'cryptocom': cryptocomPro,
|
|
375
|
-
'currencycom': currencycomPro,
|
|
376
372
|
'defx': defxPro,
|
|
377
373
|
'deribit': deribitPro,
|
|
378
374
|
'exmo': exmoPro,
|
|
@@ -426,6 +422,6 @@ pro.exchanges = Object.keys(pro);
|
|
|
426
422
|
pro['Exchange'] = Exchange; // now the same for rest and ts
|
|
427
423
|
//-----------------------------------------------------------------------------
|
|
428
424
|
const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
|
|
429
|
-
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, 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,
|
|
425
|
+
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, 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, };
|
|
430
426
|
export default ccxt;
|
|
431
427
|
//-----------------------------------------------------------------------------
|
package/js/src/cryptocom.js
CHANGED
|
@@ -456,6 +456,8 @@ export default class cryptocom extends Exchange {
|
|
|
456
456
|
'exact': {
|
|
457
457
|
'219': InvalidOrder,
|
|
458
458
|
'314': InvalidOrder,
|
|
459
|
+
'325': InvalidOrder,
|
|
460
|
+
'415': InvalidOrder,
|
|
459
461
|
'10001': ExchangeError,
|
|
460
462
|
'10002': PermissionDenied,
|
|
461
463
|
'10003': PermissionDenied,
|
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -254,12 +254,11 @@ export default class hyperliquid extends Exchange {
|
|
|
254
254
|
* @returns {object} the api result
|
|
255
255
|
*/
|
|
256
256
|
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
257
|
-
|
|
257
|
+
editOrdersRequest(orders: any, params?: {}): Dict;
|
|
258
258
|
/**
|
|
259
259
|
* @method
|
|
260
260
|
* @name hyperliquid#editOrder
|
|
261
261
|
* @description edit a trade order
|
|
262
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
263
262
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
264
263
|
* @param {string} id cancel order id
|
|
265
264
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -277,6 +276,16 @@ export default class hyperliquid extends Exchange {
|
|
|
277
276
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
278
277
|
*/
|
|
279
278
|
editOrder(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
279
|
+
/**
|
|
280
|
+
* @method
|
|
281
|
+
* @name hyperliquid#editOrders
|
|
282
|
+
* @description edit a list of trade orders
|
|
283
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
284
|
+
* @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
|
|
285
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
286
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
287
|
+
*/
|
|
288
|
+
editOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
280
289
|
/**
|
|
281
290
|
* @method
|
|
282
291
|
* @name hyperliquid#fetchFundingRateHistory
|
|
@@ -583,5 +592,5 @@ export default class hyperliquid extends Exchange {
|
|
|
583
592
|
headers: any;
|
|
584
593
|
};
|
|
585
594
|
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
586
|
-
|
|
595
|
+
parseCreateEditOrderArgs(id: Str, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): {}[];
|
|
587
596
|
}
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -54,6 +54,7 @@ export default class hyperliquid extends Exchange {
|
|
|
54
54
|
'createStopOrder': true,
|
|
55
55
|
'createTriggerOrder': true,
|
|
56
56
|
'editOrder': true,
|
|
57
|
+
'editOrders': true,
|
|
57
58
|
'fetchAccounts': false,
|
|
58
59
|
'fetchBalance': true,
|
|
59
60
|
'fetchBorrowInterest': false,
|
|
@@ -1371,7 +1372,7 @@ export default class hyperliquid extends Exchange {
|
|
|
1371
1372
|
*/
|
|
1372
1373
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1373
1374
|
await this.loadMarkets();
|
|
1374
|
-
const [order, globalParams] = this.
|
|
1375
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
1375
1376
|
const orders = await this.createOrders([order], globalParams);
|
|
1376
1377
|
return orders[0];
|
|
1377
1378
|
}
|
|
@@ -1760,84 +1761,112 @@ export default class hyperliquid extends Exchange {
|
|
|
1760
1761
|
//
|
|
1761
1762
|
return response;
|
|
1762
1763
|
}
|
|
1763
|
-
|
|
1764
|
+
editOrdersRequest(orders, params = {}) {
|
|
1764
1765
|
this.checkRequiredCredentials();
|
|
1765
|
-
|
|
1766
|
-
|
|
1766
|
+
let hasClientOrderId = false;
|
|
1767
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1768
|
+
const rawOrder = orders[i];
|
|
1769
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1770
|
+
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
1771
|
+
if (clientOrderId !== undefined) {
|
|
1772
|
+
hasClientOrderId = true;
|
|
1773
|
+
}
|
|
1767
1774
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
if (postOnly) {
|
|
1778
|
-
defaultTimeInForce = 'alo';
|
|
1779
|
-
}
|
|
1780
|
-
let timeInForce = this.safeStringLower(params, 'timeInForce', defaultTimeInForce);
|
|
1781
|
-
timeInForce = this.capitalize(timeInForce);
|
|
1782
|
-
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_id');
|
|
1783
|
-
let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1784
|
-
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice);
|
|
1785
|
-
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
1786
|
-
const isTrigger = (stopLossPrice || takeProfitPrice);
|
|
1787
|
-
params = this.omit(params, ['slippage', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'clientOrderId', 'client_id']);
|
|
1788
|
-
let px = price.toString();
|
|
1789
|
-
if (isMarket) {
|
|
1790
|
-
px = (isBuy) ? Precise.stringMul(price.toString(), Precise.stringAdd('1', slippage)) : Precise.stringMul(price.toString(), Precise.stringSub('1', slippage));
|
|
1775
|
+
if (hasClientOrderId) {
|
|
1776
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1777
|
+
const rawOrder = orders[i];
|
|
1778
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1779
|
+
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
1780
|
+
if (clientOrderId === undefined) {
|
|
1781
|
+
throw new ArgumentsRequired(this.id + ' editOrders() all orders must have clientOrderId if at least one has a clientOrderId');
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1791
1784
|
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1785
|
+
params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']);
|
|
1786
|
+
const modifies = [];
|
|
1787
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1788
|
+
const rawOrder = orders[i];
|
|
1789
|
+
const id = this.safeString(rawOrder, 'id');
|
|
1790
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
1791
|
+
const market = this.market(marketId);
|
|
1792
|
+
const symbol = market['symbol'];
|
|
1793
|
+
const type = this.safeStringUpper(rawOrder, 'type');
|
|
1794
|
+
const isMarket = (type === 'MARKET');
|
|
1795
|
+
const side = this.safeStringUpper(rawOrder, 'side');
|
|
1796
|
+
const isBuy = (side === 'BUY');
|
|
1797
|
+
const amount = this.safeString(rawOrder, 'amount');
|
|
1798
|
+
const price = this.safeString(rawOrder, 'price');
|
|
1799
|
+
let orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1800
|
+
const defaultSlippage = this.safeString(this.options, 'defaultSlippage');
|
|
1801
|
+
const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
|
|
1802
|
+
let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
|
|
1803
|
+
const postOnly = this.safeBool(orderParams, 'postOnly', false);
|
|
1804
|
+
if (postOnly) {
|
|
1805
|
+
defaultTimeInForce = 'alo';
|
|
1806
|
+
}
|
|
1807
|
+
let timeInForce = this.safeStringLower(orderParams, 'timeInForce', defaultTimeInForce);
|
|
1808
|
+
timeInForce = this.capitalize(timeInForce);
|
|
1809
|
+
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
1810
|
+
let triggerPrice = this.safeString2(orderParams, 'triggerPrice', 'stopPrice');
|
|
1811
|
+
const stopLossPrice = this.safeString(orderParams, 'stopLossPrice', triggerPrice);
|
|
1812
|
+
const takeProfitPrice = this.safeString(orderParams, 'takeProfitPrice');
|
|
1813
|
+
const isTrigger = (stopLossPrice || takeProfitPrice);
|
|
1814
|
+
const reduceOnly = this.safeBool(orderParams, 'reduceOnly', false);
|
|
1815
|
+
orderParams = this.omit(orderParams, ['slippage', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'clientOrderId', 'client_id', 'postOnly', 'reduceOnly']);
|
|
1816
|
+
let px = price.toString();
|
|
1817
|
+
if (isMarket) {
|
|
1818
|
+
px = (isBuy) ? Precise.stringMul(price.toString(), Precise.stringAdd('1', slippage)) : Precise.stringMul(price.toString(), Precise.stringSub('1', slippage));
|
|
1819
|
+
}
|
|
1820
|
+
else {
|
|
1821
|
+
px = this.priceToPrecision(symbol, price.toString());
|
|
1822
|
+
}
|
|
1823
|
+
const sz = this.amountToPrecision(symbol, amount);
|
|
1824
|
+
const orderType = {};
|
|
1825
|
+
if (isTrigger) {
|
|
1826
|
+
let isTp = false;
|
|
1827
|
+
if (takeProfitPrice !== undefined) {
|
|
1828
|
+
triggerPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1829
|
+
isTp = true;
|
|
1830
|
+
}
|
|
1831
|
+
else {
|
|
1832
|
+
triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
1833
|
+
}
|
|
1834
|
+
orderType['trigger'] = {
|
|
1835
|
+
'isMarket': isMarket,
|
|
1836
|
+
'triggerPx': triggerPrice,
|
|
1837
|
+
'tpsl': (isTp) ? 'tp' : 'sl',
|
|
1838
|
+
};
|
|
1803
1839
|
}
|
|
1804
1840
|
else {
|
|
1805
|
-
|
|
1841
|
+
orderType['limit'] = {
|
|
1842
|
+
'tif': timeInForce,
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
if (triggerPrice === undefined) {
|
|
1846
|
+
triggerPrice = '0';
|
|
1806
1847
|
}
|
|
1807
|
-
|
|
1808
|
-
'
|
|
1809
|
-
'
|
|
1810
|
-
'
|
|
1848
|
+
const orderReq = {
|
|
1849
|
+
'a': this.parseToInt(market['baseId']),
|
|
1850
|
+
'b': isBuy,
|
|
1851
|
+
'p': px,
|
|
1852
|
+
's': sz,
|
|
1853
|
+
'r': reduceOnly,
|
|
1854
|
+
't': orderType,
|
|
1855
|
+
// 'c': clientOrderId,
|
|
1811
1856
|
};
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1857
|
+
if (clientOrderId !== undefined) {
|
|
1858
|
+
orderReq['c'] = clientOrderId;
|
|
1859
|
+
}
|
|
1860
|
+
const modifyReq = {
|
|
1861
|
+
'oid': this.parseToInt(id),
|
|
1862
|
+
'order': orderReq,
|
|
1816
1863
|
};
|
|
1817
|
-
|
|
1818
|
-
if (triggerPrice === undefined) {
|
|
1819
|
-
triggerPrice = '0';
|
|
1864
|
+
modifies.push(modifyReq);
|
|
1820
1865
|
}
|
|
1821
1866
|
const nonce = this.milliseconds();
|
|
1822
|
-
const orderReq = {
|
|
1823
|
-
'a': this.parseToInt(market['baseId']),
|
|
1824
|
-
'b': isBuy,
|
|
1825
|
-
'p': px,
|
|
1826
|
-
's': sz,
|
|
1827
|
-
'r': reduceOnly,
|
|
1828
|
-
't': orderType,
|
|
1829
|
-
// 'c': clientOrderId,
|
|
1830
|
-
};
|
|
1831
|
-
if (clientOrderId !== undefined) {
|
|
1832
|
-
orderReq['c'] = clientOrderId;
|
|
1833
|
-
}
|
|
1834
|
-
const modifyReq = {
|
|
1835
|
-
'oid': this.parseToInt(id),
|
|
1836
|
-
'order': orderReq,
|
|
1837
|
-
};
|
|
1838
1867
|
const modifyAction = {
|
|
1839
1868
|
'type': 'batchModify',
|
|
1840
|
-
'modifies':
|
|
1869
|
+
'modifies': modifies,
|
|
1841
1870
|
};
|
|
1842
1871
|
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1843
1872
|
const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
|
|
@@ -1857,7 +1886,6 @@ export default class hyperliquid extends Exchange {
|
|
|
1857
1886
|
* @method
|
|
1858
1887
|
* @name hyperliquid#editOrder
|
|
1859
1888
|
* @description edit a trade order
|
|
1860
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
1861
1889
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
1862
1890
|
* @param {string} id cancel order id
|
|
1863
1891
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -1876,8 +1904,25 @@ export default class hyperliquid extends Exchange {
|
|
|
1876
1904
|
*/
|
|
1877
1905
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1878
1906
|
await this.loadMarkets();
|
|
1879
|
-
|
|
1880
|
-
|
|
1907
|
+
if (id === undefined) {
|
|
1908
|
+
throw new ArgumentsRequired(this.id + ' editOrder() requires an id argument');
|
|
1909
|
+
}
|
|
1910
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(id, symbol, type, side, amount, price, params);
|
|
1911
|
+
const orders = await this.editOrders([order], globalParams);
|
|
1912
|
+
return orders[0];
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* @method
|
|
1916
|
+
* @name hyperliquid#editOrders
|
|
1917
|
+
* @description edit a list of trade orders
|
|
1918
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
1919
|
+
* @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
|
|
1920
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1921
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1922
|
+
*/
|
|
1923
|
+
async editOrders(orders, params = {}) {
|
|
1924
|
+
await this.loadMarkets();
|
|
1925
|
+
const request = this.editOrdersRequest(orders, params);
|
|
1881
1926
|
const response = await this.privatePostExchange(request);
|
|
1882
1927
|
//
|
|
1883
1928
|
// {
|
|
@@ -1917,8 +1962,7 @@ export default class hyperliquid extends Exchange {
|
|
|
1917
1962
|
const responseObject = this.safeDict(response, 'response', {});
|
|
1918
1963
|
const dataObject = this.safeDict(responseObject, 'data', {});
|
|
1919
1964
|
const statuses = this.safeList(dataObject, 'statuses', []);
|
|
1920
|
-
|
|
1921
|
-
return this.parseOrder(first, market);
|
|
1965
|
+
return this.parseOrders(statuses);
|
|
1922
1966
|
}
|
|
1923
1967
|
/**
|
|
1924
1968
|
* @method
|
|
@@ -3538,7 +3582,7 @@ export default class hyperliquid extends Exchange {
|
|
|
3538
3582
|
}
|
|
3539
3583
|
return this.safeValue(config, 'cost', 1);
|
|
3540
3584
|
}
|
|
3541
|
-
|
|
3585
|
+
parseCreateEditOrderArgs(id, symbol, type, side, amount, price = undefined, params = {}) {
|
|
3542
3586
|
const market = this.market(symbol);
|
|
3543
3587
|
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
3544
3588
|
params = this.omit(params, 'vaultAddress');
|
|
@@ -3555,6 +3599,9 @@ export default class hyperliquid extends Exchange {
|
|
|
3555
3599
|
if (vaultAddress !== undefined) {
|
|
3556
3600
|
globalParams['vaultAddress'] = vaultAddress;
|
|
3557
3601
|
}
|
|
3602
|
+
if (id !== undefined) {
|
|
3603
|
+
order['id'] = id;
|
|
3604
|
+
}
|
|
3558
3605
|
return [order, globalParams];
|
|
3559
3606
|
}
|
|
3560
3607
|
}
|
package/js/src/paradex.d.ts
CHANGED
|
@@ -150,6 +150,8 @@ export default class paradex extends Exchange {
|
|
|
150
150
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
151
151
|
* @param {float} [params.stopPrice] alias for triggerPrice
|
|
152
152
|
* @param {float} [params.triggerPrice] The price a trigger order is triggered at
|
|
153
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
154
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
153
155
|
* @param {string} [params.timeInForce] "GTC", "IOC", or "POST_ONLY"
|
|
154
156
|
* @param {bool} [params.postOnly] true or false
|
|
155
157
|
* @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
|
package/js/src/paradex.js
CHANGED
|
@@ -1187,6 +1187,11 @@ export default class paradex extends Exchange {
|
|
|
1187
1187
|
const average = this.omitZero(this.safeString(order, 'avg_fill_price'));
|
|
1188
1188
|
const remaining = this.omitZero(this.safeString(order, 'remaining_size'));
|
|
1189
1189
|
const lastUpdateTimestamp = this.safeInteger(order, 'last_updated_at');
|
|
1190
|
+
const flags = this.safeList(order, 'flags', []);
|
|
1191
|
+
let reduceOnly = undefined;
|
|
1192
|
+
if ('REDUCE_ONLY' in flags) {
|
|
1193
|
+
reduceOnly = true;
|
|
1194
|
+
}
|
|
1190
1195
|
return this.safeOrder({
|
|
1191
1196
|
'id': orderId,
|
|
1192
1197
|
'clientOrderId': clientOrderId,
|
|
@@ -1199,7 +1204,7 @@ export default class paradex extends Exchange {
|
|
|
1199
1204
|
'type': this.parseOrderType(orderType),
|
|
1200
1205
|
'timeInForce': this.parseTimeInForce(this.safeString(order, 'instrunction')),
|
|
1201
1206
|
'postOnly': undefined,
|
|
1202
|
-
'reduceOnly':
|
|
1207
|
+
'reduceOnly': reduceOnly,
|
|
1203
1208
|
'side': side,
|
|
1204
1209
|
'price': price,
|
|
1205
1210
|
'triggerPrice': this.safeString(order, 'trigger_price'),
|
|
@@ -1267,6 +1272,8 @@ export default class paradex extends Exchange {
|
|
|
1267
1272
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1268
1273
|
* @param {float} [params.stopPrice] alias for triggerPrice
|
|
1269
1274
|
* @param {float} [params.triggerPrice] The price a trigger order is triggered at
|
|
1275
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
1276
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
1270
1277
|
* @param {string} [params.timeInForce] "GTC", "IOC", or "POST_ONLY"
|
|
1271
1278
|
* @param {bool} [params.postOnly] true or false
|
|
1272
1279
|
* @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
|
|
@@ -1277,17 +1284,21 @@ export default class paradex extends Exchange {
|
|
|
1277
1284
|
await this.authenticateRest();
|
|
1278
1285
|
await this.loadMarkets();
|
|
1279
1286
|
const market = this.market(symbol);
|
|
1280
|
-
|
|
1287
|
+
let reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
|
|
1281
1288
|
const orderType = type.toUpperCase();
|
|
1282
1289
|
const orderSide = side.toUpperCase();
|
|
1283
1290
|
const request = {
|
|
1284
1291
|
'market': market['id'],
|
|
1285
1292
|
'side': orderSide,
|
|
1286
|
-
'type': orderType,
|
|
1287
|
-
'size': this.amountToPrecision(symbol, amount),
|
|
1293
|
+
'type': orderType, // LIMIT/MARKET/STOP_LIMIT/STOP_MARKET,STOP_LOSS_MARKET,STOP_LOSS_LIMIT,TAKE_PROFIT_MARKET,TAKE_PROFIT_LIMIT
|
|
1288
1294
|
};
|
|
1289
1295
|
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1296
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
1297
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
1290
1298
|
const isMarket = orderType === 'MARKET';
|
|
1299
|
+
const isTakeProfitOrder = (takeProfitPrice !== undefined);
|
|
1300
|
+
const isStopLossOrder = (stopLossPrice !== undefined);
|
|
1301
|
+
const isStopOrder = (triggerPrice !== undefined) || isTakeProfitOrder || isStopLossOrder;
|
|
1291
1302
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
1292
1303
|
const postOnly = this.isPostOnly(isMarket, undefined, params);
|
|
1293
1304
|
if (!isMarket) {
|
|
@@ -1298,11 +1309,6 @@ export default class paradex extends Exchange {
|
|
|
1298
1309
|
request['instruction'] = 'IOC';
|
|
1299
1310
|
}
|
|
1300
1311
|
}
|
|
1301
|
-
if (reduceOnly) {
|
|
1302
|
-
request['flags'] = [
|
|
1303
|
-
'REDUCE_ONLY',
|
|
1304
|
-
];
|
|
1305
|
-
}
|
|
1306
1312
|
if (price !== undefined) {
|
|
1307
1313
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1308
1314
|
}
|
|
@@ -1310,16 +1316,58 @@ export default class paradex extends Exchange {
|
|
|
1310
1316
|
if (clientOrderId !== undefined) {
|
|
1311
1317
|
request['client_id'] = clientOrderId;
|
|
1312
1318
|
}
|
|
1313
|
-
|
|
1319
|
+
let sizeString = '0';
|
|
1320
|
+
let stopPrice = undefined;
|
|
1321
|
+
if (isStopOrder) {
|
|
1322
|
+
// flags: Reduce_Only must be provided for TPSL orders.
|
|
1314
1323
|
if (isMarket) {
|
|
1315
|
-
|
|
1324
|
+
if (isStopLossOrder) {
|
|
1325
|
+
stopPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
1326
|
+
reduceOnly = true;
|
|
1327
|
+
request['type'] = 'STOP_LOSS_MARKET';
|
|
1328
|
+
}
|
|
1329
|
+
else if (isTakeProfitOrder) {
|
|
1330
|
+
stopPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1331
|
+
reduceOnly = true;
|
|
1332
|
+
request['type'] = 'TAKE_PROFIT_MARKET';
|
|
1333
|
+
}
|
|
1334
|
+
else {
|
|
1335
|
+
stopPrice = this.priceToPrecision(symbol, triggerPrice);
|
|
1336
|
+
sizeString = this.amountToPrecision(symbol, amount);
|
|
1337
|
+
request['type'] = 'STOP_MARKET';
|
|
1338
|
+
}
|
|
1316
1339
|
}
|
|
1317
1340
|
else {
|
|
1318
|
-
|
|
1341
|
+
if (isStopLossOrder) {
|
|
1342
|
+
stopPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
1343
|
+
reduceOnly = true;
|
|
1344
|
+
request['type'] = 'STOP_LOSS_LIMIT';
|
|
1345
|
+
}
|
|
1346
|
+
else if (isTakeProfitOrder) {
|
|
1347
|
+
stopPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1348
|
+
reduceOnly = true;
|
|
1349
|
+
request['type'] = 'TAKE_PROFIT_LIMIT';
|
|
1350
|
+
}
|
|
1351
|
+
else {
|
|
1352
|
+
stopPrice = this.priceToPrecision(symbol, triggerPrice);
|
|
1353
|
+
sizeString = this.amountToPrecision(symbol, amount);
|
|
1354
|
+
request['type'] = 'STOP_LIMIT';
|
|
1355
|
+
}
|
|
1319
1356
|
}
|
|
1320
|
-
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1321
1357
|
}
|
|
1322
|
-
|
|
1358
|
+
else {
|
|
1359
|
+
sizeString = this.amountToPrecision(symbol, amount);
|
|
1360
|
+
}
|
|
1361
|
+
if (stopPrice !== undefined) {
|
|
1362
|
+
request['trigger_price'] = stopPrice;
|
|
1363
|
+
}
|
|
1364
|
+
request['size'] = sizeString;
|
|
1365
|
+
if (reduceOnly) {
|
|
1366
|
+
request['flags'] = [
|
|
1367
|
+
'REDUCE_ONLY',
|
|
1368
|
+
];
|
|
1369
|
+
}
|
|
1370
|
+
params = this.omit(params, ['reduceOnly', 'reduce_only', 'clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
1323
1371
|
const account = await this.retrieveAccount();
|
|
1324
1372
|
const now = this.nonce();
|
|
1325
1373
|
const orderReq = {
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -783,7 +783,7 @@ export default class bybit extends bybitRest {
|
|
|
783
783
|
}
|
|
784
784
|
const stored = this.ohlcvs[symbol][timeframe];
|
|
785
785
|
for (let i = 0; i < data.length; i++) {
|
|
786
|
-
const parsed = this.parseWsOHLCV(data[i]);
|
|
786
|
+
const parsed = this.parseWsOHLCV(data[i], market);
|
|
787
787
|
stored.append(parsed);
|
|
788
788
|
}
|
|
789
789
|
const messageHash = 'ohlcv::' + symbol + '::' + timeframe;
|
|
@@ -806,13 +806,14 @@ export default class bybit extends bybitRest {
|
|
|
806
806
|
// "timestamp": 1670363219614
|
|
807
807
|
// }
|
|
808
808
|
//
|
|
809
|
+
const volumeIndex = (market['inverse']) ? 'turnover' : 'volume';
|
|
809
810
|
return [
|
|
810
811
|
this.safeInteger(ohlcv, 'start'),
|
|
811
812
|
this.safeNumber(ohlcv, 'open'),
|
|
812
813
|
this.safeNumber(ohlcv, 'high'),
|
|
813
814
|
this.safeNumber(ohlcv, 'low'),
|
|
814
815
|
this.safeNumber(ohlcv, 'close'),
|
|
815
|
-
this.
|
|
816
|
+
this.safeNumber(ohlcv, volumeIndex),
|
|
816
817
|
];
|
|
817
818
|
}
|
|
818
819
|
/**
|
package/js/src/pro/gate.js
CHANGED
|
@@ -1193,7 +1193,10 @@ export default class gate extends gateRest {
|
|
|
1193
1193
|
const cache = this.positions[type];
|
|
1194
1194
|
for (let i = 0; i < positions.length; i++) {
|
|
1195
1195
|
const position = positions[i];
|
|
1196
|
-
|
|
1196
|
+
const contracts = this.safeNumber(position, 'contracts', 0);
|
|
1197
|
+
if (contracts > 0) {
|
|
1198
|
+
cache.append(position);
|
|
1199
|
+
}
|
|
1197
1200
|
}
|
|
1198
1201
|
// don't remove the future from the .futures cache
|
|
1199
1202
|
const future = client.futures[messageHash];
|
|
@@ -2026,7 +2029,7 @@ export default class gate extends gateRest {
|
|
|
2026
2029
|
};
|
|
2027
2030
|
if ((channel === 'spot.order_place') || (channel === 'futures.order_place')) {
|
|
2028
2031
|
payload['req_header'] = {
|
|
2029
|
-
'
|
|
2032
|
+
'X-Gate-Channel-Id': 'ccxt',
|
|
2030
2033
|
};
|
|
2031
2034
|
}
|
|
2032
2035
|
const request = {
|
|
@@ -38,7 +38,6 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
38
38
|
* @method
|
|
39
39
|
* @name hyperliquid#editOrderWs
|
|
40
40
|
* @description edit a trade order
|
|
41
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
42
41
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
43
42
|
* @param {string} id cancel order id
|
|
44
43
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -96,7 +96,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
96
96
|
*/
|
|
97
97
|
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
98
98
|
await this.loadMarkets();
|
|
99
|
-
const [order, globalParams] = this.
|
|
99
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
100
100
|
const orders = await this.createOrdersWs([order], globalParams);
|
|
101
101
|
return orders[0];
|
|
102
102
|
}
|
|
@@ -104,7 +104,6 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
104
104
|
* @method
|
|
105
105
|
* @name hyperliquid#editOrderWs
|
|
106
106
|
* @description edit a trade order
|
|
107
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
108
107
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
109
108
|
* @param {string} id cancel order id
|
|
110
109
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -125,7 +124,8 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
125
124
|
await this.loadMarkets();
|
|
126
125
|
const market = this.market(symbol);
|
|
127
126
|
const url = this.urls['api']['ws']['public'];
|
|
128
|
-
const
|
|
127
|
+
const [order, globalParams] = this.parseCreateEditOrderArgs(id, symbol, type, side, amount, price, params);
|
|
128
|
+
const postRequest = this.editOrdersRequest([order], globalParams);
|
|
129
129
|
const wrapped = this.wrapAsPostAction(postRequest);
|
|
130
130
|
const request = this.safeDict(wrapped, 'request', {});
|
|
131
131
|
const requestId = this.safeString(wrapped, 'requestId');
|
package/package.json
CHANGED