ccxt 4.1.67 → 4.1.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +327 -95
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +91 -84
- package/dist/cjs/src/base/Exchange.js +2 -2
- package/dist/cjs/src/bybit.js +2 -2
- package/dist/cjs/src/gate.js +211 -2
- package/dist/cjs/src/phemex.js +15 -1
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/htx.js +4 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/phemex.d.ts +8 -0
- package/js/src/ascendex.js +91 -84
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +2 -2
- package/js/src/bybit.js +2 -2
- package/js/src/gate.d.ts +27 -0
- package/js/src/gate.js +211 -2
- package/js/src/phemex.js +15 -1
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/htx.js +4 -2
- package/package.json +1 -1
- package/skip-tests.json +8 -2
|
@@ -737,7 +737,7 @@ class binance extends binance$1 {
|
|
|
737
737
|
handleTrade(client, message) {
|
|
738
738
|
// the trade streams push raw trade information in real-time
|
|
739
739
|
// each trade has a unique buyer and seller
|
|
740
|
-
const isSpot = ((client.url.indexOf('
|
|
740
|
+
const isSpot = ((client.url.indexOf('wss://stream.binance.com') > -1) || (client.url.indexOf('/testnet.binance') > -1));
|
|
741
741
|
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
742
742
|
const marketId = this.safeString(message, 's');
|
|
743
743
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
package/dist/cjs/src/pro/htx.js
CHANGED
|
@@ -337,9 +337,11 @@ class htx extends htx$1 {
|
|
|
337
337
|
// which means whenever there is an order book change at that level, it pushes an update;
|
|
338
338
|
// 150-levels/400-level incremental MBP feed is based on the gap
|
|
339
339
|
// between two snapshots at 100ms interval.
|
|
340
|
-
|
|
340
|
+
if (limit === undefined) {
|
|
341
|
+
limit = market['spot'] ? 150 : 20;
|
|
342
|
+
}
|
|
341
343
|
if (!this.inArray(limit, allowedLimits)) {
|
|
342
|
-
throw new errors.ExchangeError(this.id + ' watchOrderBook
|
|
344
|
+
throw new errors.ExchangeError(this.id + ' watchOrderBook market accepts limits of 20 and 150 only');
|
|
343
345
|
}
|
|
344
346
|
let messageHash = undefined;
|
|
345
347
|
if (market['spot']) {
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.1.
|
|
7
|
+
declare const version = "4.1.68";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.1.
|
|
41
|
+
const version = '4.1.69';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -13,6 +13,7 @@ interface Exchange {
|
|
|
13
13
|
publicGetMdTrade(params?: {}): Promise<implicitReturnType>;
|
|
14
14
|
publicGetMdSpotTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
15
15
|
publicGetExchangePublicCfgChainSettings(params?: {}): Promise<implicitReturnType>;
|
|
16
|
+
v1GetMdFullbook(params?: {}): Promise<implicitReturnType>;
|
|
16
17
|
v1GetMdOrderbook(params?: {}): Promise<implicitReturnType>;
|
|
17
18
|
v1GetMdTrade(params?: {}): Promise<implicitReturnType>;
|
|
18
19
|
v1GetMdTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
@@ -54,6 +55,11 @@ interface Exchange {
|
|
|
54
55
|
privateGetPhemexUserUsersChildren(params?: {}): Promise<implicitReturnType>;
|
|
55
56
|
privateGetPhemexUserWalletsV2DepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
56
57
|
privateGetPhemexUserWalletsTradeAccountDetail(params?: {}): Promise<implicitReturnType>;
|
|
58
|
+
privateGetPhemexDepositWalletsApiDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
59
|
+
privateGetPhemexDepositWalletsApiDepositHist(params?: {}): Promise<implicitReturnType>;
|
|
60
|
+
privateGetPhemexDepositWalletsApiChainCfg(params?: {}): Promise<implicitReturnType>;
|
|
61
|
+
privateGetPhemexWithdrawWalletsApiWithdrawHist(params?: {}): Promise<implicitReturnType>;
|
|
62
|
+
privateGetPhemexWithdrawWalletsApiAssetInfo(params?: {}): Promise<implicitReturnType>;
|
|
57
63
|
privateGetPhemexUserOrderClosedPositionList(params?: {}): Promise<implicitReturnType>;
|
|
58
64
|
privateGetExchangeMarginsTransfer(params?: {}): Promise<implicitReturnType>;
|
|
59
65
|
privateGetExchangeWalletsConfirmWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
@@ -86,6 +92,8 @@ interface Exchange {
|
|
|
86
92
|
privatePostAssetsFuturesSubAccountsTransfer(params?: {}): Promise<implicitReturnType>;
|
|
87
93
|
privatePostAssetsUniversalTransfer(params?: {}): Promise<implicitReturnType>;
|
|
88
94
|
privatePostAssetsConvert(params?: {}): Promise<implicitReturnType>;
|
|
95
|
+
privatePostPhemexWithdrawWalletsApiCreateWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
96
|
+
privatePostPhemexWithdrawWalletsApiCancelWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
89
97
|
privatePutSpotOrdersCreate(params?: {}): Promise<implicitReturnType>;
|
|
90
98
|
privatePutSpotOrders(params?: {}): Promise<implicitReturnType>;
|
|
91
99
|
privatePutOrdersReplace(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ascendex.js
CHANGED
|
@@ -263,7 +263,7 @@ export default class ascendex extends Exchange {
|
|
|
263
263
|
'account-category': 'cash',
|
|
264
264
|
'account-group': undefined,
|
|
265
265
|
'fetchClosedOrders': {
|
|
266
|
-
'method': 'v2PrivateDataGetOrderHist', // '
|
|
266
|
+
'method': 'v2PrivateDataGetOrderHist', // 'v1PrivateAccountCategoryGetOrderHistCurrent'
|
|
267
267
|
},
|
|
268
268
|
'defaultType': 'spot',
|
|
269
269
|
'accountsByType': {
|
|
@@ -803,6 +803,9 @@ export default class ascendex extends Exchange {
|
|
|
803
803
|
* @method
|
|
804
804
|
* @name ascendex#fetchBalance
|
|
805
805
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
806
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#cash-account-balance
|
|
807
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
|
|
808
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
|
806
809
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
807
810
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
808
811
|
*/
|
|
@@ -813,8 +816,7 @@ export default class ascendex extends Exchange {
|
|
|
813
816
|
[marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
814
817
|
const isMargin = this.safeValue(params, 'margin', false);
|
|
815
818
|
marketType = isMargin ? 'margin' : marketType;
|
|
816
|
-
|
|
817
|
-
const options = this.safeValue(this.options, 'fetchBalance', {});
|
|
819
|
+
query = this.omit(query, 'margin');
|
|
818
820
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
819
821
|
const accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
820
822
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -822,16 +824,19 @@ export default class ascendex extends Exchange {
|
|
|
822
824
|
const request = {
|
|
823
825
|
'account-group': accountGroup,
|
|
824
826
|
};
|
|
825
|
-
const defaultMethod = this.safeString(options, 'method', 'v1PrivateAccountCategoryGetBalance');
|
|
826
|
-
const method = this.getSupportedMapping(marketType, {
|
|
827
|
-
'spot': defaultMethod,
|
|
828
|
-
'margin': defaultMethod,
|
|
829
|
-
'swap': 'v2PrivateAccountGroupGetFuturesPosition',
|
|
830
|
-
});
|
|
831
827
|
if ((accountCategory === 'cash') || (accountCategory === 'margin')) {
|
|
832
828
|
request['account-category'] = accountCategory;
|
|
833
829
|
}
|
|
834
|
-
|
|
830
|
+
let response = undefined;
|
|
831
|
+
if ((marketType === 'spot') || (marketType === 'margin')) {
|
|
832
|
+
response = await this.v1PrivateAccountCategoryGetBalance(this.extend(request, query));
|
|
833
|
+
}
|
|
834
|
+
else if (marketType === 'swap') {
|
|
835
|
+
response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, query));
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
throw new NotSupported(this.id + ' fetchBalance() is not currently supported for ' + marketType + ' markets');
|
|
839
|
+
}
|
|
835
840
|
//
|
|
836
841
|
// cash
|
|
837
842
|
//
|
|
@@ -1756,6 +1761,8 @@ export default class ascendex extends Exchange {
|
|
|
1756
1761
|
* @method
|
|
1757
1762
|
* @name ascendex#fetchOrder
|
|
1758
1763
|
* @description fetches information on an order made by the user
|
|
1764
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#query-order
|
|
1765
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
|
|
1759
1766
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1760
1767
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1761
1768
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1767,7 +1774,6 @@ export default class ascendex extends Exchange {
|
|
|
1767
1774
|
market = this.market(symbol);
|
|
1768
1775
|
}
|
|
1769
1776
|
const [type, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
1770
|
-
const options = this.safeValue(this.options, 'fetchOrder', {});
|
|
1771
1777
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
1772
1778
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
1773
1779
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -1777,21 +1783,17 @@ export default class ascendex extends Exchange {
|
|
|
1777
1783
|
'account-category': accountCategory,
|
|
1778
1784
|
'orderId': id,
|
|
1779
1785
|
};
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
'margin': defaultMethod,
|
|
1784
|
-
'swap': 'v2PrivateAccountGroupGetFuturesOrderStatus',
|
|
1785
|
-
});
|
|
1786
|
-
if (method === 'v1PrivateAccountCategoryGetOrderStatus') {
|
|
1787
|
-
if (accountCategory !== undefined) {
|
|
1788
|
-
request['category'] = accountCategory;
|
|
1789
|
-
}
|
|
1786
|
+
let response = undefined;
|
|
1787
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
1788
|
+
response = await this.v1PrivateAccountCategoryGetOrderStatus(this.extend(request, query));
|
|
1790
1789
|
}
|
|
1791
|
-
else {
|
|
1790
|
+
else if (type === 'swap') {
|
|
1792
1791
|
request['account-category'] = accountCategory;
|
|
1792
|
+
response = await this.v2PrivateAccountGroupGetFuturesOrderStatus(this.extend(request, query));
|
|
1793
|
+
}
|
|
1794
|
+
else {
|
|
1795
|
+
throw new NotSupported(this.id + ' fetchOrder() is not currently supported for ' + type + ' markets');
|
|
1793
1796
|
}
|
|
1794
|
-
const response = await this[method](this.extend(request, query));
|
|
1795
1797
|
//
|
|
1796
1798
|
// AccountCategoryGetOrderStatus
|
|
1797
1799
|
//
|
|
@@ -1867,6 +1869,8 @@ export default class ascendex extends Exchange {
|
|
|
1867
1869
|
* @method
|
|
1868
1870
|
* @name ascendex#fetchOpenOrders
|
|
1869
1871
|
* @description fetch all unfilled currently open orders
|
|
1872
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#list-open-orders
|
|
1873
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders
|
|
1870
1874
|
* @param {string} symbol unified market symbol
|
|
1871
1875
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1872
1876
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -1889,22 +1893,17 @@ export default class ascendex extends Exchange {
|
|
|
1889
1893
|
'account-group': accountGroup,
|
|
1890
1894
|
'account-category': accountCategory,
|
|
1891
1895
|
};
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
'spot': defaultMethod,
|
|
1896
|
-
'margin': defaultMethod,
|
|
1897
|
-
'swap': 'v2PrivateAccountGroupGetFuturesOrderOpen',
|
|
1898
|
-
});
|
|
1899
|
-
if (method === 'v1PrivateAccountCategoryGetOrderOpen') {
|
|
1900
|
-
if (accountCategory !== undefined) {
|
|
1901
|
-
request['category'] = accountCategory;
|
|
1902
|
-
}
|
|
1896
|
+
let response = undefined;
|
|
1897
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
1898
|
+
response = await this.v1PrivateAccountCategoryGetOrderOpen(this.extend(request, query));
|
|
1903
1899
|
}
|
|
1904
|
-
else {
|
|
1900
|
+
else if (type === 'swap') {
|
|
1905
1901
|
request['account-category'] = accountCategory;
|
|
1902
|
+
response = await this.v2PrivateAccountGroupGetFuturesOrderOpen(this.extend(request, query));
|
|
1903
|
+
}
|
|
1904
|
+
else {
|
|
1905
|
+
throw new NotSupported(this.id + ' fetchOpenOrders() is not currently supported for ' + type + ' markets');
|
|
1906
1906
|
}
|
|
1907
|
-
const response = await this[method](this.extend(request, query));
|
|
1908
1907
|
//
|
|
1909
1908
|
// AccountCategoryGetOrderOpen
|
|
1910
1909
|
//
|
|
@@ -1990,6 +1989,7 @@ export default class ascendex extends Exchange {
|
|
|
1990
1989
|
* @name ascendex#fetchClosedOrders
|
|
1991
1990
|
* @description fetches information on multiple closed orders made by the user
|
|
1992
1991
|
* @see https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2
|
|
1992
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders
|
|
1993
1993
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1994
1994
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1995
1995
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -2002,16 +2002,15 @@ export default class ascendex extends Exchange {
|
|
|
2002
2002
|
const account = this.safeValue(this.accounts, 0, {});
|
|
2003
2003
|
const accountGroup = this.safeValue(account, 'id');
|
|
2004
2004
|
const request = {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
// 'pageSize': 100,
|
|
2005
|
+
// 'category': accountCategory,
|
|
2006
|
+
// 'symbol': market['id'],
|
|
2007
|
+
// 'orderType': 'market', // optional, string
|
|
2008
|
+
// 'side': 'buy', // or 'sell', optional, case insensitive.
|
|
2009
|
+
// 'status': 'Filled', // "Filled", "Canceled", or "Rejected"
|
|
2010
|
+
// 'startTime': exchange.milliseconds (),
|
|
2011
|
+
// 'endTime': exchange.milliseconds (),
|
|
2012
|
+
// 'page': 1,
|
|
2013
|
+
// 'pageSize': 100,
|
|
2015
2014
|
};
|
|
2016
2015
|
let market = undefined;
|
|
2017
2016
|
if (symbol !== undefined) {
|
|
@@ -2026,28 +2025,42 @@ export default class ascendex extends Exchange {
|
|
|
2026
2025
|
'margin': defaultMethod,
|
|
2027
2026
|
'swap': 'v2PrivateAccountGroupGetFuturesOrderHistCurrent',
|
|
2028
2027
|
});
|
|
2028
|
+
if (since !== undefined) {
|
|
2029
|
+
request['startTime'] = since;
|
|
2030
|
+
}
|
|
2031
|
+
const until = this.safeString(params, 'until');
|
|
2032
|
+
if (until !== undefined) {
|
|
2033
|
+
request['endTime'] = until;
|
|
2034
|
+
}
|
|
2029
2035
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
2030
2036
|
const accountCategory = this.safeString(accountsByType, type, 'cash'); // margin, futures
|
|
2031
|
-
|
|
2037
|
+
let response = undefined;
|
|
2038
|
+
if (method === 'v1PrivateAccountCategoryGetOrderHistCurrent') {
|
|
2039
|
+
request['account-group'] = accountGroup;
|
|
2040
|
+
request['account-category'] = accountCategory;
|
|
2041
|
+
if (limit !== undefined) {
|
|
2042
|
+
request['limit'] = limit;
|
|
2043
|
+
}
|
|
2044
|
+
response = await this.v1PrivateAccountCategoryGetOrderHistCurrent(this.extend(request, query));
|
|
2045
|
+
}
|
|
2046
|
+
else if (method === 'v2PrivateDataGetOrderHist') {
|
|
2032
2047
|
request['account'] = accountCategory;
|
|
2033
2048
|
if (limit !== undefined) {
|
|
2034
2049
|
request['limit'] = limit;
|
|
2035
2050
|
}
|
|
2051
|
+
response = await this.v2PrivateDataGetOrderHist(this.extend(request, query));
|
|
2036
2052
|
}
|
|
2037
|
-
else {
|
|
2053
|
+
else if (method === 'v2PrivateAccountGroupGetFuturesOrderHistCurrent') {
|
|
2054
|
+
request['account-group'] = accountGroup;
|
|
2038
2055
|
request['account-category'] = accountCategory;
|
|
2039
2056
|
if (limit !== undefined) {
|
|
2040
2057
|
request['pageSize'] = limit;
|
|
2041
2058
|
}
|
|
2059
|
+
response = await this.v2PrivateAccountGroupGetFuturesOrderHistCurrent(this.extend(request, query));
|
|
2042
2060
|
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
}
|
|
2046
|
-
const until = this.safeString(params, 'until');
|
|
2047
|
-
if (until !== undefined) {
|
|
2048
|
-
request['endTime'] = until;
|
|
2061
|
+
else {
|
|
2062
|
+
throw new NotSupported(this.id + ' fetchClosedOrders() is not currently supported for ' + type + ' markets');
|
|
2049
2063
|
}
|
|
2050
|
-
const response = await this[method](this.extend(request, query));
|
|
2051
2064
|
//
|
|
2052
2065
|
// accountCategoryGetOrderHistCurrent
|
|
2053
2066
|
//
|
|
@@ -2151,6 +2164,8 @@ export default class ascendex extends Exchange {
|
|
|
2151
2164
|
* @method
|
|
2152
2165
|
* @name ascendex#cancelOrder
|
|
2153
2166
|
* @description cancels an open order
|
|
2167
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#cancel-order
|
|
2168
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-order
|
|
2154
2169
|
* @param {string} id order id
|
|
2155
2170
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2156
2171
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2163,7 +2178,6 @@ export default class ascendex extends Exchange {
|
|
|
2163
2178
|
await this.loadAccounts();
|
|
2164
2179
|
const market = this.market(symbol);
|
|
2165
2180
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
2166
|
-
const options = this.safeValue(this.options, 'cancelOrder', {});
|
|
2167
2181
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
2168
2182
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2169
2183
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -2175,20 +2189,6 @@ export default class ascendex extends Exchange {
|
|
|
2175
2189
|
'time': this.milliseconds(),
|
|
2176
2190
|
'id': 'foobar',
|
|
2177
2191
|
};
|
|
2178
|
-
const defaultMethod = this.safeString(options, 'method', 'v1PrivateAccountCategoryDeleteOrder');
|
|
2179
|
-
const method = this.getSupportedMapping(type, {
|
|
2180
|
-
'spot': defaultMethod,
|
|
2181
|
-
'margin': defaultMethod,
|
|
2182
|
-
'swap': 'v2PrivateAccountGroupDeleteFuturesOrder',
|
|
2183
|
-
});
|
|
2184
|
-
if (method === 'v1PrivateAccountCategoryDeleteOrder') {
|
|
2185
|
-
if (accountCategory !== undefined) {
|
|
2186
|
-
request['category'] = accountCategory;
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
else {
|
|
2190
|
-
request['account-category'] = accountCategory;
|
|
2191
|
-
}
|
|
2192
2192
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'id');
|
|
2193
2193
|
if (clientOrderId === undefined) {
|
|
2194
2194
|
request['orderId'] = id;
|
|
@@ -2197,7 +2197,17 @@ export default class ascendex extends Exchange {
|
|
|
2197
2197
|
request['id'] = clientOrderId;
|
|
2198
2198
|
params = this.omit(params, ['clientOrderId', 'id']);
|
|
2199
2199
|
}
|
|
2200
|
-
|
|
2200
|
+
let response = undefined;
|
|
2201
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
2202
|
+
response = await this.v1PrivateAccountCategoryDeleteOrder(this.extend(request, query));
|
|
2203
|
+
}
|
|
2204
|
+
else if (type === 'swap') {
|
|
2205
|
+
request['account-category'] = accountCategory;
|
|
2206
|
+
response = await this.v2PrivateAccountGroupDeleteFuturesOrder(this.extend(request, query));
|
|
2207
|
+
}
|
|
2208
|
+
else {
|
|
2209
|
+
throw new NotSupported(this.id + ' cancelOrder() is not currently supported for ' + type + ' markets');
|
|
2210
|
+
}
|
|
2201
2211
|
//
|
|
2202
2212
|
// AccountCategoryDeleteOrder
|
|
2203
2213
|
//
|
|
@@ -2270,6 +2280,8 @@ export default class ascendex extends Exchange {
|
|
|
2270
2280
|
* @method
|
|
2271
2281
|
* @name ascendex#cancelAllOrders
|
|
2272
2282
|
* @description cancel all open orders
|
|
2283
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#cancel-all-orders
|
|
2284
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-all-open-orders
|
|
2273
2285
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
2274
2286
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2275
2287
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -2281,7 +2293,6 @@ export default class ascendex extends Exchange {
|
|
|
2281
2293
|
market = this.market(symbol);
|
|
2282
2294
|
}
|
|
2283
2295
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2284
|
-
const options = this.safeValue(this.options, 'cancelAllOrders', {});
|
|
2285
2296
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
2286
2297
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2287
2298
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -2294,21 +2305,17 @@ export default class ascendex extends Exchange {
|
|
|
2294
2305
|
if (symbol !== undefined) {
|
|
2295
2306
|
request['symbol'] = market['id'];
|
|
2296
2307
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
'margin': defaultMethod,
|
|
2301
|
-
'swap': 'v2PrivateAccountGroupDeleteFuturesOrderAll',
|
|
2302
|
-
});
|
|
2303
|
-
if (method === 'v1PrivateAccountCategoryDeleteOrderAll') {
|
|
2304
|
-
if (accountCategory !== undefined) {
|
|
2305
|
-
request['category'] = accountCategory;
|
|
2306
|
-
}
|
|
2308
|
+
let response = undefined;
|
|
2309
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
2310
|
+
response = await this.v1PrivateAccountCategoryDeleteOrderAll(this.extend(request, query));
|
|
2307
2311
|
}
|
|
2308
|
-
else {
|
|
2312
|
+
else if (type === 'swap') {
|
|
2309
2313
|
request['account-category'] = accountCategory;
|
|
2314
|
+
response = await this.v2PrivateAccountGroupDeleteFuturesOrderAll(this.extend(request, query));
|
|
2315
|
+
}
|
|
2316
|
+
else {
|
|
2317
|
+
throw new NotSupported(this.id + ' cancelAllOrders() is not currently supported for ' + type + ' markets');
|
|
2310
2318
|
}
|
|
2311
|
-
const response = await this[method](this.extend(request, query));
|
|
2312
2319
|
//
|
|
2313
2320
|
// AccountCategoryDeleteOrderAll
|
|
2314
2321
|
//
|
|
@@ -844,7 +844,7 @@ export default class Exchange {
|
|
|
844
844
|
handleTimeInForce(params?: {}): string;
|
|
845
845
|
convertTypeToAccount(account: any): any;
|
|
846
846
|
checkRequiredArgument(methodName: any, argument: any, argumentName: any, options?: any[]): void;
|
|
847
|
-
checkRequiredMarginArgument(methodName: string, symbol:
|
|
847
|
+
checkRequiredMarginArgument(methodName: string, symbol: Str, marginMode: string): void;
|
|
848
848
|
parseDepositWithdrawFees(response: any, codes?: string[], currencyIdKey?: any): any;
|
|
849
849
|
parseDepositWithdrawFee(fee: any, currency?: Currency): any;
|
|
850
850
|
depositWithdrawFee(info: any): any;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -2513,7 +2513,7 @@ export default class Exchange {
|
|
|
2513
2513
|
'bidVolume': this.safeNumber(ticker, 'bidVolume'),
|
|
2514
2514
|
'ask': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'ask'))),
|
|
2515
2515
|
'askVolume': this.safeNumber(ticker, 'askVolume'),
|
|
2516
|
-
'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high
|
|
2516
|
+
'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high'))),
|
|
2517
2517
|
'low': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'low'))),
|
|
2518
2518
|
'open': this.parseNumber(this.omitZero(this.parseNumber(open))),
|
|
2519
2519
|
'close': this.parseNumber(this.omitZero(this.parseNumber(close))),
|
|
@@ -3182,7 +3182,7 @@ export default class Exchange {
|
|
|
3182
3182
|
throw new NotSupported(this.id + ' watchPositions() is not supported yet');
|
|
3183
3183
|
}
|
|
3184
3184
|
async watchPositionForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3185
|
-
return this.watchPositions(symbols, since, limit, params);
|
|
3185
|
+
return await this.watchPositions(symbols, since, limit, params);
|
|
3186
3186
|
}
|
|
3187
3187
|
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
3188
3188
|
/**
|
package/js/src/bybit.js
CHANGED
|
@@ -2118,8 +2118,8 @@ export default class bybit extends Exchange {
|
|
|
2118
2118
|
}
|
|
2119
2119
|
const request = {
|
|
2120
2120
|
// 'symbol': market['id'],
|
|
2121
|
-
// 'baseCoin': '', Base coin. For option only
|
|
2122
|
-
// 'expDate': '', Expiry date. e.g., 25DEC22. For option only
|
|
2121
|
+
// 'baseCoin': '', // Base coin. For option only
|
|
2122
|
+
// 'expDate': '', // Expiry date. e.g., 25DEC22. For option only
|
|
2123
2123
|
};
|
|
2124
2124
|
let type = undefined;
|
|
2125
2125
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
package/js/src/gate.d.ts
CHANGED
|
@@ -220,6 +220,33 @@ export default class gate extends Exchange {
|
|
|
220
220
|
fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
221
221
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
222
222
|
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
223
|
+
repayMargin(code: string, amount: any, symbol?: Str, params?: {}): Promise<{
|
|
224
|
+
id: number;
|
|
225
|
+
currency: string;
|
|
226
|
+
amount: number;
|
|
227
|
+
symbol: string;
|
|
228
|
+
timestamp: number;
|
|
229
|
+
datetime: string;
|
|
230
|
+
info: any;
|
|
231
|
+
}>;
|
|
232
|
+
borrowMargin(code: string, amount: any, symbol?: Str, params?: {}): Promise<{
|
|
233
|
+
id: number;
|
|
234
|
+
currency: string;
|
|
235
|
+
amount: number;
|
|
236
|
+
symbol: string;
|
|
237
|
+
timestamp: number;
|
|
238
|
+
datetime: string;
|
|
239
|
+
info: any;
|
|
240
|
+
}>;
|
|
241
|
+
parseMarginLoan(info: any, currency?: Currency): {
|
|
242
|
+
id: number;
|
|
243
|
+
currency: string;
|
|
244
|
+
amount: number;
|
|
245
|
+
symbol: string;
|
|
246
|
+
timestamp: number;
|
|
247
|
+
datetime: string;
|
|
248
|
+
info: any;
|
|
249
|
+
};
|
|
223
250
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
|
224
251
|
url: any;
|
|
225
252
|
method: string;
|