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
package/dist/cjs/ccxt.js
CHANGED
|
@@ -173,7 +173,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
173
173
|
|
|
174
174
|
//-----------------------------------------------------------------------------
|
|
175
175
|
// this is updated by vss.js when building
|
|
176
|
-
const version = '4.1.
|
|
176
|
+
const version = '4.1.69';
|
|
177
177
|
Exchange["default"].ccxtVersion = version;
|
|
178
178
|
const exchanges = {
|
|
179
179
|
'ace': ace,
|
package/dist/cjs/src/ascendex.js
CHANGED
|
@@ -260,7 +260,7 @@ class ascendex extends ascendex$1 {
|
|
|
260
260
|
'account-category': 'cash',
|
|
261
261
|
'account-group': undefined,
|
|
262
262
|
'fetchClosedOrders': {
|
|
263
|
-
'method': 'v2PrivateDataGetOrderHist', // '
|
|
263
|
+
'method': 'v2PrivateDataGetOrderHist', // 'v1PrivateAccountCategoryGetOrderHistCurrent'
|
|
264
264
|
},
|
|
265
265
|
'defaultType': 'spot',
|
|
266
266
|
'accountsByType': {
|
|
@@ -800,6 +800,9 @@ class ascendex extends ascendex$1 {
|
|
|
800
800
|
* @method
|
|
801
801
|
* @name ascendex#fetchBalance
|
|
802
802
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
803
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#cash-account-balance
|
|
804
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
|
|
805
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
|
803
806
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
804
807
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
805
808
|
*/
|
|
@@ -810,8 +813,7 @@ class ascendex extends ascendex$1 {
|
|
|
810
813
|
[marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
811
814
|
const isMargin = this.safeValue(params, 'margin', false);
|
|
812
815
|
marketType = isMargin ? 'margin' : marketType;
|
|
813
|
-
|
|
814
|
-
const options = this.safeValue(this.options, 'fetchBalance', {});
|
|
816
|
+
query = this.omit(query, 'margin');
|
|
815
817
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
816
818
|
const accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
817
819
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -819,16 +821,19 @@ class ascendex extends ascendex$1 {
|
|
|
819
821
|
const request = {
|
|
820
822
|
'account-group': accountGroup,
|
|
821
823
|
};
|
|
822
|
-
const defaultMethod = this.safeString(options, 'method', 'v1PrivateAccountCategoryGetBalance');
|
|
823
|
-
const method = this.getSupportedMapping(marketType, {
|
|
824
|
-
'spot': defaultMethod,
|
|
825
|
-
'margin': defaultMethod,
|
|
826
|
-
'swap': 'v2PrivateAccountGroupGetFuturesPosition',
|
|
827
|
-
});
|
|
828
824
|
if ((accountCategory === 'cash') || (accountCategory === 'margin')) {
|
|
829
825
|
request['account-category'] = accountCategory;
|
|
830
826
|
}
|
|
831
|
-
|
|
827
|
+
let response = undefined;
|
|
828
|
+
if ((marketType === 'spot') || (marketType === 'margin')) {
|
|
829
|
+
response = await this.v1PrivateAccountCategoryGetBalance(this.extend(request, query));
|
|
830
|
+
}
|
|
831
|
+
else if (marketType === 'swap') {
|
|
832
|
+
response = await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(request, query));
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
throw new errors.NotSupported(this.id + ' fetchBalance() is not currently supported for ' + marketType + ' markets');
|
|
836
|
+
}
|
|
832
837
|
//
|
|
833
838
|
// cash
|
|
834
839
|
//
|
|
@@ -1753,6 +1758,8 @@ class ascendex extends ascendex$1 {
|
|
|
1753
1758
|
* @method
|
|
1754
1759
|
* @name ascendex#fetchOrder
|
|
1755
1760
|
* @description fetches information on an order made by the user
|
|
1761
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#query-order
|
|
1762
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
|
|
1756
1763
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1757
1764
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1758
1765
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1764,7 +1771,6 @@ class ascendex extends ascendex$1 {
|
|
|
1764
1771
|
market = this.market(symbol);
|
|
1765
1772
|
}
|
|
1766
1773
|
const [type, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
1767
|
-
const options = this.safeValue(this.options, 'fetchOrder', {});
|
|
1768
1774
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
1769
1775
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
1770
1776
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -1774,21 +1780,17 @@ class ascendex extends ascendex$1 {
|
|
|
1774
1780
|
'account-category': accountCategory,
|
|
1775
1781
|
'orderId': id,
|
|
1776
1782
|
};
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
'margin': defaultMethod,
|
|
1781
|
-
'swap': 'v2PrivateAccountGroupGetFuturesOrderStatus',
|
|
1782
|
-
});
|
|
1783
|
-
if (method === 'v1PrivateAccountCategoryGetOrderStatus') {
|
|
1784
|
-
if (accountCategory !== undefined) {
|
|
1785
|
-
request['category'] = accountCategory;
|
|
1786
|
-
}
|
|
1783
|
+
let response = undefined;
|
|
1784
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
1785
|
+
response = await this.v1PrivateAccountCategoryGetOrderStatus(this.extend(request, query));
|
|
1787
1786
|
}
|
|
1788
|
-
else {
|
|
1787
|
+
else if (type === 'swap') {
|
|
1789
1788
|
request['account-category'] = accountCategory;
|
|
1789
|
+
response = await this.v2PrivateAccountGroupGetFuturesOrderStatus(this.extend(request, query));
|
|
1790
|
+
}
|
|
1791
|
+
else {
|
|
1792
|
+
throw new errors.NotSupported(this.id + ' fetchOrder() is not currently supported for ' + type + ' markets');
|
|
1790
1793
|
}
|
|
1791
|
-
const response = await this[method](this.extend(request, query));
|
|
1792
1794
|
//
|
|
1793
1795
|
// AccountCategoryGetOrderStatus
|
|
1794
1796
|
//
|
|
@@ -1864,6 +1866,8 @@ class ascendex extends ascendex$1 {
|
|
|
1864
1866
|
* @method
|
|
1865
1867
|
* @name ascendex#fetchOpenOrders
|
|
1866
1868
|
* @description fetch all unfilled currently open orders
|
|
1869
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#list-open-orders
|
|
1870
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders
|
|
1867
1871
|
* @param {string} symbol unified market symbol
|
|
1868
1872
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1869
1873
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -1886,22 +1890,17 @@ class ascendex extends ascendex$1 {
|
|
|
1886
1890
|
'account-group': accountGroup,
|
|
1887
1891
|
'account-category': accountCategory,
|
|
1888
1892
|
};
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
'spot': defaultMethod,
|
|
1893
|
-
'margin': defaultMethod,
|
|
1894
|
-
'swap': 'v2PrivateAccountGroupGetFuturesOrderOpen',
|
|
1895
|
-
});
|
|
1896
|
-
if (method === 'v1PrivateAccountCategoryGetOrderOpen') {
|
|
1897
|
-
if (accountCategory !== undefined) {
|
|
1898
|
-
request['category'] = accountCategory;
|
|
1899
|
-
}
|
|
1893
|
+
let response = undefined;
|
|
1894
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
1895
|
+
response = await this.v1PrivateAccountCategoryGetOrderOpen(this.extend(request, query));
|
|
1900
1896
|
}
|
|
1901
|
-
else {
|
|
1897
|
+
else if (type === 'swap') {
|
|
1902
1898
|
request['account-category'] = accountCategory;
|
|
1899
|
+
response = await this.v2PrivateAccountGroupGetFuturesOrderOpen(this.extend(request, query));
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
throw new errors.NotSupported(this.id + ' fetchOpenOrders() is not currently supported for ' + type + ' markets');
|
|
1903
1903
|
}
|
|
1904
|
-
const response = await this[method](this.extend(request, query));
|
|
1905
1904
|
//
|
|
1906
1905
|
// AccountCategoryGetOrderOpen
|
|
1907
1906
|
//
|
|
@@ -1987,6 +1986,7 @@ class ascendex extends ascendex$1 {
|
|
|
1987
1986
|
* @name ascendex#fetchClosedOrders
|
|
1988
1987
|
* @description fetches information on multiple closed orders made by the user
|
|
1989
1988
|
* @see https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2
|
|
1989
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders
|
|
1990
1990
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1991
1991
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1992
1992
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -1999,16 +1999,15 @@ class ascendex extends ascendex$1 {
|
|
|
1999
1999
|
const account = this.safeValue(this.accounts, 0, {});
|
|
2000
2000
|
const accountGroup = this.safeValue(account, 'id');
|
|
2001
2001
|
const request = {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
// 'pageSize': 100,
|
|
2002
|
+
// 'category': accountCategory,
|
|
2003
|
+
// 'symbol': market['id'],
|
|
2004
|
+
// 'orderType': 'market', // optional, string
|
|
2005
|
+
// 'side': 'buy', // or 'sell', optional, case insensitive.
|
|
2006
|
+
// 'status': 'Filled', // "Filled", "Canceled", or "Rejected"
|
|
2007
|
+
// 'startTime': exchange.milliseconds (),
|
|
2008
|
+
// 'endTime': exchange.milliseconds (),
|
|
2009
|
+
// 'page': 1,
|
|
2010
|
+
// 'pageSize': 100,
|
|
2012
2011
|
};
|
|
2013
2012
|
let market = undefined;
|
|
2014
2013
|
if (symbol !== undefined) {
|
|
@@ -2023,28 +2022,42 @@ class ascendex extends ascendex$1 {
|
|
|
2023
2022
|
'margin': defaultMethod,
|
|
2024
2023
|
'swap': 'v2PrivateAccountGroupGetFuturesOrderHistCurrent',
|
|
2025
2024
|
});
|
|
2025
|
+
if (since !== undefined) {
|
|
2026
|
+
request['startTime'] = since;
|
|
2027
|
+
}
|
|
2028
|
+
const until = this.safeString(params, 'until');
|
|
2029
|
+
if (until !== undefined) {
|
|
2030
|
+
request['endTime'] = until;
|
|
2031
|
+
}
|
|
2026
2032
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
2027
2033
|
const accountCategory = this.safeString(accountsByType, type, 'cash'); // margin, futures
|
|
2028
|
-
|
|
2034
|
+
let response = undefined;
|
|
2035
|
+
if (method === 'v1PrivateAccountCategoryGetOrderHistCurrent') {
|
|
2036
|
+
request['account-group'] = accountGroup;
|
|
2037
|
+
request['account-category'] = accountCategory;
|
|
2038
|
+
if (limit !== undefined) {
|
|
2039
|
+
request['limit'] = limit;
|
|
2040
|
+
}
|
|
2041
|
+
response = await this.v1PrivateAccountCategoryGetOrderHistCurrent(this.extend(request, query));
|
|
2042
|
+
}
|
|
2043
|
+
else if (method === 'v2PrivateDataGetOrderHist') {
|
|
2029
2044
|
request['account'] = accountCategory;
|
|
2030
2045
|
if (limit !== undefined) {
|
|
2031
2046
|
request['limit'] = limit;
|
|
2032
2047
|
}
|
|
2048
|
+
response = await this.v2PrivateDataGetOrderHist(this.extend(request, query));
|
|
2033
2049
|
}
|
|
2034
|
-
else {
|
|
2050
|
+
else if (method === 'v2PrivateAccountGroupGetFuturesOrderHistCurrent') {
|
|
2051
|
+
request['account-group'] = accountGroup;
|
|
2035
2052
|
request['account-category'] = accountCategory;
|
|
2036
2053
|
if (limit !== undefined) {
|
|
2037
2054
|
request['pageSize'] = limit;
|
|
2038
2055
|
}
|
|
2056
|
+
response = await this.v2PrivateAccountGroupGetFuturesOrderHistCurrent(this.extend(request, query));
|
|
2039
2057
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
}
|
|
2043
|
-
const until = this.safeString(params, 'until');
|
|
2044
|
-
if (until !== undefined) {
|
|
2045
|
-
request['endTime'] = until;
|
|
2058
|
+
else {
|
|
2059
|
+
throw new errors.NotSupported(this.id + ' fetchClosedOrders() is not currently supported for ' + type + ' markets');
|
|
2046
2060
|
}
|
|
2047
|
-
const response = await this[method](this.extend(request, query));
|
|
2048
2061
|
//
|
|
2049
2062
|
// accountCategoryGetOrderHistCurrent
|
|
2050
2063
|
//
|
|
@@ -2148,6 +2161,8 @@ class ascendex extends ascendex$1 {
|
|
|
2148
2161
|
* @method
|
|
2149
2162
|
* @name ascendex#cancelOrder
|
|
2150
2163
|
* @description cancels an open order
|
|
2164
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#cancel-order
|
|
2165
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-order
|
|
2151
2166
|
* @param {string} id order id
|
|
2152
2167
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2153
2168
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2160,7 +2175,6 @@ class ascendex extends ascendex$1 {
|
|
|
2160
2175
|
await this.loadAccounts();
|
|
2161
2176
|
const market = this.market(symbol);
|
|
2162
2177
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
2163
|
-
const options = this.safeValue(this.options, 'cancelOrder', {});
|
|
2164
2178
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
2165
2179
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2166
2180
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -2172,20 +2186,6 @@ class ascendex extends ascendex$1 {
|
|
|
2172
2186
|
'time': this.milliseconds(),
|
|
2173
2187
|
'id': 'foobar',
|
|
2174
2188
|
};
|
|
2175
|
-
const defaultMethod = this.safeString(options, 'method', 'v1PrivateAccountCategoryDeleteOrder');
|
|
2176
|
-
const method = this.getSupportedMapping(type, {
|
|
2177
|
-
'spot': defaultMethod,
|
|
2178
|
-
'margin': defaultMethod,
|
|
2179
|
-
'swap': 'v2PrivateAccountGroupDeleteFuturesOrder',
|
|
2180
|
-
});
|
|
2181
|
-
if (method === 'v1PrivateAccountCategoryDeleteOrder') {
|
|
2182
|
-
if (accountCategory !== undefined) {
|
|
2183
|
-
request['category'] = accountCategory;
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
else {
|
|
2187
|
-
request['account-category'] = accountCategory;
|
|
2188
|
-
}
|
|
2189
2189
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'id');
|
|
2190
2190
|
if (clientOrderId === undefined) {
|
|
2191
2191
|
request['orderId'] = id;
|
|
@@ -2194,7 +2194,17 @@ class ascendex extends ascendex$1 {
|
|
|
2194
2194
|
request['id'] = clientOrderId;
|
|
2195
2195
|
params = this.omit(params, ['clientOrderId', 'id']);
|
|
2196
2196
|
}
|
|
2197
|
-
|
|
2197
|
+
let response = undefined;
|
|
2198
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
2199
|
+
response = await this.v1PrivateAccountCategoryDeleteOrder(this.extend(request, query));
|
|
2200
|
+
}
|
|
2201
|
+
else if (type === 'swap') {
|
|
2202
|
+
request['account-category'] = accountCategory;
|
|
2203
|
+
response = await this.v2PrivateAccountGroupDeleteFuturesOrder(this.extend(request, query));
|
|
2204
|
+
}
|
|
2205
|
+
else {
|
|
2206
|
+
throw new errors.NotSupported(this.id + ' cancelOrder() is not currently supported for ' + type + ' markets');
|
|
2207
|
+
}
|
|
2198
2208
|
//
|
|
2199
2209
|
// AccountCategoryDeleteOrder
|
|
2200
2210
|
//
|
|
@@ -2267,6 +2277,8 @@ class ascendex extends ascendex$1 {
|
|
|
2267
2277
|
* @method
|
|
2268
2278
|
* @name ascendex#cancelAllOrders
|
|
2269
2279
|
* @description cancel all open orders
|
|
2280
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#cancel-all-orders
|
|
2281
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-all-open-orders
|
|
2270
2282
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
2271
2283
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2272
2284
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -2278,7 +2290,6 @@ class ascendex extends ascendex$1 {
|
|
|
2278
2290
|
market = this.market(symbol);
|
|
2279
2291
|
}
|
|
2280
2292
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2281
|
-
const options = this.safeValue(this.options, 'cancelAllOrders', {});
|
|
2282
2293
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
2283
2294
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2284
2295
|
const account = this.safeValue(this.accounts, 0, {});
|
|
@@ -2291,21 +2302,17 @@ class ascendex extends ascendex$1 {
|
|
|
2291
2302
|
if (symbol !== undefined) {
|
|
2292
2303
|
request['symbol'] = market['id'];
|
|
2293
2304
|
}
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
'margin': defaultMethod,
|
|
2298
|
-
'swap': 'v2PrivateAccountGroupDeleteFuturesOrderAll',
|
|
2299
|
-
});
|
|
2300
|
-
if (method === 'v1PrivateAccountCategoryDeleteOrderAll') {
|
|
2301
|
-
if (accountCategory !== undefined) {
|
|
2302
|
-
request['category'] = accountCategory;
|
|
2303
|
-
}
|
|
2305
|
+
let response = undefined;
|
|
2306
|
+
if ((type === 'spot') || (type === 'margin')) {
|
|
2307
|
+
response = await this.v1PrivateAccountCategoryDeleteOrderAll(this.extend(request, query));
|
|
2304
2308
|
}
|
|
2305
|
-
else {
|
|
2309
|
+
else if (type === 'swap') {
|
|
2306
2310
|
request['account-category'] = accountCategory;
|
|
2311
|
+
response = await this.v2PrivateAccountGroupDeleteFuturesOrderAll(this.extend(request, query));
|
|
2312
|
+
}
|
|
2313
|
+
else {
|
|
2314
|
+
throw new errors.NotSupported(this.id + ' cancelAllOrders() is not currently supported for ' + type + ' markets');
|
|
2307
2315
|
}
|
|
2308
|
-
const response = await this[method](this.extend(request, query));
|
|
2309
2316
|
//
|
|
2310
2317
|
// AccountCategoryDeleteOrderAll
|
|
2311
2318
|
//
|
|
@@ -2517,7 +2517,7 @@ class Exchange {
|
|
|
2517
2517
|
'bidVolume': this.safeNumber(ticker, 'bidVolume'),
|
|
2518
2518
|
'ask': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'ask'))),
|
|
2519
2519
|
'askVolume': this.safeNumber(ticker, 'askVolume'),
|
|
2520
|
-
'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high
|
|
2520
|
+
'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high'))),
|
|
2521
2521
|
'low': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'low'))),
|
|
2522
2522
|
'open': this.parseNumber(this.omitZero(this.parseNumber(open))),
|
|
2523
2523
|
'close': this.parseNumber(this.omitZero(this.parseNumber(close))),
|
|
@@ -3186,7 +3186,7 @@ class Exchange {
|
|
|
3186
3186
|
throw new errors.NotSupported(this.id + ' watchPositions() is not supported yet');
|
|
3187
3187
|
}
|
|
3188
3188
|
async watchPositionForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3189
|
-
return this.watchPositions(symbols, since, limit, params);
|
|
3189
|
+
return await this.watchPositions(symbols, since, limit, params);
|
|
3190
3190
|
}
|
|
3191
3191
|
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
3192
3192
|
/**
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -2115,8 +2115,8 @@ class bybit extends bybit$1 {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
const request = {
|
|
2117
2117
|
// 'symbol': market['id'],
|
|
2118
|
-
// 'baseCoin': '', Base coin. For option only
|
|
2119
|
-
// 'expDate': '', Expiry date. e.g., 25DEC22. For option only
|
|
2118
|
+
// 'baseCoin': '', // Base coin. For option only
|
|
2119
|
+
// 'expDate': '', // Expiry date. e.g., 25DEC22. For option only
|
|
2120
2120
|
};
|
|
2121
2121
|
let type = undefined;
|
|
2122
2122
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -553,8 +553,6 @@ class gate extends gate$1 {
|
|
|
553
553
|
'AXIS': 'Axis DeFi',
|
|
554
554
|
'BIFI': 'Bitcoin File',
|
|
555
555
|
'BOX': 'DefiBox',
|
|
556
|
-
'BTCBEAR': 'BEAR',
|
|
557
|
-
'BTCBULL': 'BULL',
|
|
558
556
|
'BYN': 'BeyondFi',
|
|
559
557
|
'EGG': 'Goose Finance',
|
|
560
558
|
'GTC': 'Game.com',
|
|
@@ -850,6 +848,7 @@ class gate extends gate$1 {
|
|
|
850
848
|
'AUTO_TRIGGER_PRICE_LESS_LAST': errors.InvalidOrder,
|
|
851
849
|
'AUTO_TRIGGER_PRICE_GREATE_LAST': errors.InvalidOrder,
|
|
852
850
|
'POSITION_HOLDING': errors.BadRequest,
|
|
851
|
+
'USER_LOAN_EXCEEDED': errors.BadRequest, // {"label":"USER_LOAN_EXCEEDED","message":"Max loan amount per user would be exceeded"}
|
|
853
852
|
},
|
|
854
853
|
'broad': {},
|
|
855
854
|
},
|
|
@@ -5569,6 +5568,216 @@ class gate extends gate$1 {
|
|
|
5569
5568
|
}
|
|
5570
5569
|
return tiers;
|
|
5571
5570
|
}
|
|
5571
|
+
async repayMargin(code, amount, symbol = undefined, params = {}) {
|
|
5572
|
+
/**
|
|
5573
|
+
* @method
|
|
5574
|
+
* @name gate#repayMargin
|
|
5575
|
+
* @description repay borrowed margin and interest
|
|
5576
|
+
* @see https://www.gate.io/docs/apiv4/en/#repay-cross-margin-loan
|
|
5577
|
+
* @see https://www.gate.io/docs/apiv4/en/#repay-a-loan
|
|
5578
|
+
* @param {string} code unified currency code of the currency to repay
|
|
5579
|
+
* @param {float} amount the amount to repay
|
|
5580
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
5581
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5582
|
+
* @param {string} [params.mode] 'all' or 'partial' payment mode, extra parameter required for isolated margin
|
|
5583
|
+
* @param {string} [params.id] '34267567' loan id, extra parameter required for isolated margin
|
|
5584
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
5585
|
+
*/
|
|
5586
|
+
let marginMode = undefined;
|
|
5587
|
+
[marginMode, params] = this.handleOptionAndParams(params, 'repayMargin', 'marginMode');
|
|
5588
|
+
this.checkRequiredArgument('repayMargin', marginMode, 'marginMode', ['cross', 'isolated']);
|
|
5589
|
+
this.checkRequiredMarginArgument('repayMargin', symbol, marginMode);
|
|
5590
|
+
await this.loadMarkets();
|
|
5591
|
+
const currency = this.currency(code);
|
|
5592
|
+
const request = {
|
|
5593
|
+
'currency': currency['id'].toUpperCase(),
|
|
5594
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
5595
|
+
};
|
|
5596
|
+
let response = undefined;
|
|
5597
|
+
if ((marginMode === 'cross') && (symbol === undefined)) {
|
|
5598
|
+
response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
|
|
5599
|
+
}
|
|
5600
|
+
else if ((marginMode === 'isolated') || (symbol !== undefined)) {
|
|
5601
|
+
if (symbol === undefined) {
|
|
5602
|
+
throw new errors.BadRequest(this.id + ' repayMargin() requires a symbol argument for isolated margin');
|
|
5603
|
+
}
|
|
5604
|
+
const market = this.market(symbol);
|
|
5605
|
+
request['currency_pair'] = market['id'];
|
|
5606
|
+
request['type'] = 'repay';
|
|
5607
|
+
response = await this.privateMarginPostUniLoans(this.extend(request, params));
|
|
5608
|
+
}
|
|
5609
|
+
//
|
|
5610
|
+
// Cross
|
|
5611
|
+
//
|
|
5612
|
+
// [
|
|
5613
|
+
// {
|
|
5614
|
+
// "id": "17",
|
|
5615
|
+
// "create_time": 1620381696159,
|
|
5616
|
+
// "update_time": 1620381696159,
|
|
5617
|
+
// "currency": "EOS",
|
|
5618
|
+
// "amount": "110.553635",
|
|
5619
|
+
// "text": "web",
|
|
5620
|
+
// "status": 2,
|
|
5621
|
+
// "repaid": "110.506649705159",
|
|
5622
|
+
// "repaid_interest": "0.046985294841",
|
|
5623
|
+
// "unpaid_interest": "0.0000074393366667"
|
|
5624
|
+
// }
|
|
5625
|
+
// ]
|
|
5626
|
+
//
|
|
5627
|
+
// Isolated
|
|
5628
|
+
//
|
|
5629
|
+
// {
|
|
5630
|
+
// "id": "34267567",
|
|
5631
|
+
// "create_time": "1656394778",
|
|
5632
|
+
// "expire_time": "1657258778",
|
|
5633
|
+
// "status": "finished",
|
|
5634
|
+
// "side": "borrow",
|
|
5635
|
+
// "currency": "USDT",
|
|
5636
|
+
// "rate": "0.0002",
|
|
5637
|
+
// "amount": "100",
|
|
5638
|
+
// "days": 10,
|
|
5639
|
+
// "auto_renew": false,
|
|
5640
|
+
// "currency_pair": "LTC_USDT",
|
|
5641
|
+
// "left": "0",
|
|
5642
|
+
// "repaid": "100",
|
|
5643
|
+
// "paid_interest": "0.003333333333",
|
|
5644
|
+
// "unpaid_interest": "0"
|
|
5645
|
+
// }
|
|
5646
|
+
//
|
|
5647
|
+
if (marginMode === 'cross') {
|
|
5648
|
+
response = response[0];
|
|
5649
|
+
}
|
|
5650
|
+
return this.parseMarginLoan(response, currency);
|
|
5651
|
+
}
|
|
5652
|
+
async borrowMargin(code, amount, symbol = undefined, params = {}) {
|
|
5653
|
+
/**
|
|
5654
|
+
* @method
|
|
5655
|
+
* @name gate#borrowMargin
|
|
5656
|
+
* @description create a loan to borrow margin
|
|
5657
|
+
* @see https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
|
|
5658
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#marginuni
|
|
5659
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
5660
|
+
* @param {float} amount the amount to borrow
|
|
5661
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
5662
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5663
|
+
* @param {string} [params.rate] '0.0002' or '0.002' extra parameter required for isolated margin
|
|
5664
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
5665
|
+
*/
|
|
5666
|
+
let marginMode = undefined;
|
|
5667
|
+
[marginMode, params] = this.handleOptionAndParams(params, 'borrowMargin', 'marginMode');
|
|
5668
|
+
this.checkRequiredArgument('borrowMargin', marginMode, 'marginMode', ['cross', 'isolated']);
|
|
5669
|
+
this.checkRequiredMarginArgument('borrowMargin', symbol, marginMode);
|
|
5670
|
+
await this.loadMarkets();
|
|
5671
|
+
const currency = this.currency(code);
|
|
5672
|
+
const request = {
|
|
5673
|
+
'currency': currency['id'].toUpperCase(),
|
|
5674
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
5675
|
+
};
|
|
5676
|
+
let response = undefined;
|
|
5677
|
+
if ((marginMode === 'cross') && (symbol === undefined)) {
|
|
5678
|
+
response = await this.privateMarginPostCrossLoans(this.extend(request, params));
|
|
5679
|
+
}
|
|
5680
|
+
else if ((marginMode === 'isolated') || (symbol !== undefined)) {
|
|
5681
|
+
if (symbol === undefined) {
|
|
5682
|
+
throw new errors.BadRequest(this.id + ' borrowMargin() requires a symbol argument for isolated margin');
|
|
5683
|
+
}
|
|
5684
|
+
const market = this.market(symbol);
|
|
5685
|
+
request['currency_pair'] = market['id'];
|
|
5686
|
+
request['type'] = 'borrow';
|
|
5687
|
+
response = await this.privateMarginPostUniLoans(this.extend(request, params));
|
|
5688
|
+
}
|
|
5689
|
+
//
|
|
5690
|
+
// Cross
|
|
5691
|
+
//
|
|
5692
|
+
// {
|
|
5693
|
+
// "id": "17",
|
|
5694
|
+
// "create_time": 1620381696159,
|
|
5695
|
+
// "update_time": 1620381696159,
|
|
5696
|
+
// "currency": "EOS",
|
|
5697
|
+
// "amount": "110.553635",
|
|
5698
|
+
// "text": "web",
|
|
5699
|
+
// "status": 2,
|
|
5700
|
+
// "repaid": "110.506649705159",
|
|
5701
|
+
// "repaid_interest": "0.046985294841",
|
|
5702
|
+
// "unpaid_interest": "0.0000074393366667"
|
|
5703
|
+
// }
|
|
5704
|
+
//
|
|
5705
|
+
// Isolated
|
|
5706
|
+
//
|
|
5707
|
+
// {
|
|
5708
|
+
// "id": "34267567",
|
|
5709
|
+
// "create_time": "1656394778",
|
|
5710
|
+
// "expire_time": "1657258778",
|
|
5711
|
+
// "status": "loaned",
|
|
5712
|
+
// "side": "borrow",
|
|
5713
|
+
// "currency": "USDT",
|
|
5714
|
+
// "rate": "0.0002",
|
|
5715
|
+
// "amount": "100",
|
|
5716
|
+
// "days": 10,
|
|
5717
|
+
// "auto_renew": false,
|
|
5718
|
+
// "currency_pair": "LTC_USDT",
|
|
5719
|
+
// "left": "0",
|
|
5720
|
+
// "repaid": "0",
|
|
5721
|
+
// "paid_interest": "0",
|
|
5722
|
+
// "unpaid_interest": "0.003333333333"
|
|
5723
|
+
// }
|
|
5724
|
+
//
|
|
5725
|
+
return this.parseMarginLoan(response, currency);
|
|
5726
|
+
}
|
|
5727
|
+
parseMarginLoan(info, currency = undefined) {
|
|
5728
|
+
//
|
|
5729
|
+
// Cross
|
|
5730
|
+
//
|
|
5731
|
+
// {
|
|
5732
|
+
// "id": "17",
|
|
5733
|
+
// "create_time": 1620381696159,
|
|
5734
|
+
// "update_time": 1620381696159,
|
|
5735
|
+
// "currency": "EOS",
|
|
5736
|
+
// "amount": "110.553635",
|
|
5737
|
+
// "text": "web",
|
|
5738
|
+
// "status": 2,
|
|
5739
|
+
// "repaid": "110.506649705159",
|
|
5740
|
+
// "repaid_interest": "0.046985294841",
|
|
5741
|
+
// "unpaid_interest": "0.0000074393366667"
|
|
5742
|
+
// }
|
|
5743
|
+
//
|
|
5744
|
+
// Isolated
|
|
5745
|
+
//
|
|
5746
|
+
// {
|
|
5747
|
+
// "id": "34267567",
|
|
5748
|
+
// "create_time": "1656394778",
|
|
5749
|
+
// "expire_time": "1657258778",
|
|
5750
|
+
// "status": "loaned",
|
|
5751
|
+
// "side": "borrow",
|
|
5752
|
+
// "currency": "USDT",
|
|
5753
|
+
// "rate": "0.0002",
|
|
5754
|
+
// "amount": "100",
|
|
5755
|
+
// "days": 10,
|
|
5756
|
+
// "auto_renew": false,
|
|
5757
|
+
// "currency_pair": "LTC_USDT",
|
|
5758
|
+
// "left": "0",
|
|
5759
|
+
// "repaid": "0",
|
|
5760
|
+
// "paid_interest": "0",
|
|
5761
|
+
// "unpaid_interest": "0.003333333333"
|
|
5762
|
+
// }
|
|
5763
|
+
//
|
|
5764
|
+
const marginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
|
|
5765
|
+
let timestamp = this.safeInteger(info, 'create_time');
|
|
5766
|
+
if (marginMode === 'isolated') {
|
|
5767
|
+
timestamp = this.safeTimestamp(info, 'create_time');
|
|
5768
|
+
}
|
|
5769
|
+
const currencyId = this.safeString(info, 'currency');
|
|
5770
|
+
const marketId = this.safeString(info, 'currency_pair');
|
|
5771
|
+
return {
|
|
5772
|
+
'id': this.safeInteger(info, 'id'),
|
|
5773
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
5774
|
+
'amount': this.safeNumber(info, 'amount'),
|
|
5775
|
+
'symbol': this.safeSymbol(marketId, undefined, '_', 'margin'),
|
|
5776
|
+
'timestamp': timestamp,
|
|
5777
|
+
'datetime': this.iso8601(timestamp),
|
|
5778
|
+
'info': info,
|
|
5779
|
+
};
|
|
5780
|
+
}
|
|
5572
5781
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
5573
5782
|
const authentication = api[0]; // public, private
|
|
5574
5783
|
const type = api[1]; // spot, margin, future, delivery
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -144,6 +144,7 @@ class phemex extends phemex$1 {
|
|
|
144
144
|
},
|
|
145
145
|
'v1': {
|
|
146
146
|
'get': {
|
|
147
|
+
'md/fullbook': 5,
|
|
147
148
|
'md/orderbook': 5,
|
|
148
149
|
'md/trade': 5,
|
|
149
150
|
'md/ticker/24hr': 5,
|
|
@@ -197,6 +198,11 @@ class phemex extends phemex$1 {
|
|
|
197
198
|
'phemex-user/users/children': 5,
|
|
198
199
|
'phemex-user/wallets/v2/depositAddress': 5,
|
|
199
200
|
'phemex-user/wallets/tradeAccountDetail': 5,
|
|
201
|
+
'phemex-deposit/wallets/api/depositAddress': 5,
|
|
202
|
+
'phemex-deposit/wallets/api/depositHist': 5,
|
|
203
|
+
'phemex-deposit/wallets/api/chainCfg': 5,
|
|
204
|
+
'phemex-withdraw/wallets/api/withdrawHist': 5,
|
|
205
|
+
'phemex-withdraw/wallets/api/asset/info': 5,
|
|
200
206
|
'phemex-user/order/closedPositionList': 5,
|
|
201
207
|
'exchange/margins/transfer': 5,
|
|
202
208
|
'exchange/wallets/confirm/withdraw': 5,
|
|
@@ -235,6 +241,9 @@ class phemex extends phemex$1 {
|
|
|
235
241
|
'assets/futures/sub-accounts/transfer': 5,
|
|
236
242
|
'assets/universal-transfer': 5,
|
|
237
243
|
'assets/convert': 5,
|
|
244
|
+
// withdraw
|
|
245
|
+
'phemex-withdraw/wallets/api/createWithdraw': 5,
|
|
246
|
+
'phemex-withdraw/wallets/api/cancelWithdraw': 5, // ?id=<id>
|
|
238
247
|
},
|
|
239
248
|
'put': {
|
|
240
249
|
// spot
|
|
@@ -991,7 +1000,12 @@ class phemex extends phemex$1 {
|
|
|
991
1000
|
response = await this.v2GetMdV2Orderbook(this.extend(request, params));
|
|
992
1001
|
}
|
|
993
1002
|
else {
|
|
994
|
-
|
|
1003
|
+
if ((limit !== undefined) && (limit <= 30)) {
|
|
1004
|
+
response = await this.v1GetMdOrderbook(this.extend(request, params));
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
response = await this.v1GetMdFullbook(this.extend(request, params));
|
|
1008
|
+
}
|
|
995
1009
|
}
|
|
996
1010
|
//
|
|
997
1011
|
// {
|