ccxt 4.2.77 → 4.2.79
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 -5
- package/dist/ccxt.browser.js +456 -98
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +39 -5
- package/dist/cjs/src/bitstamp.js +21 -26
- package/dist/cjs/src/bybit.js +107 -2
- package/dist/cjs/src/coinbase.js +22 -9
- package/dist/cjs/src/coinbaseinternational.js +2 -2
- package/dist/cjs/src/gate.js +4 -1
- package/dist/cjs/src/htx.js +36 -27
- package/dist/cjs/src/hyperliquid.js +6 -4
- package/dist/cjs/src/kucoin.js +52 -0
- package/dist/cjs/src/okcoin.js +27 -1
- package/dist/cjs/src/okx.js +18 -0
- package/dist/cjs/src/pro/alpaca.js +1 -1
- package/dist/cjs/src/pro/bitfinex2.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bitmex.js +1 -1
- package/dist/cjs/src/pro/blockchaincom.js +1 -1
- package/dist/cjs/src/pro/bybit.js +16 -1
- package/dist/cjs/src/pro/cex.js +9 -5
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +1 -1
- package/dist/cjs/src/pro/htx.js +1 -1
- package/dist/cjs/src/pro/okcoin.js +1 -1
- package/dist/cjs/src/pro/onetrading.js +1 -1
- package/dist/cjs/src/pro/woo.js +38 -0
- package/dist/cjs/src/woo.js +47 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/base/types.d.ts +2 -2
- package/js/src/bingx.js +39 -5
- package/js/src/bitstamp.js +21 -26
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +107 -2
- package/js/src/coinbase.d.ts +2 -2
- package/js/src/coinbase.js +22 -9
- package/js/src/coinbaseinternational.js +2 -2
- package/js/src/gate.js +4 -1
- package/js/src/htx.js +36 -27
- package/js/src/hyperliquid.js +6 -4
- package/js/src/kucoin.js +52 -0
- package/js/src/okcoin.js +27 -1
- package/js/src/okx.js +18 -0
- package/js/src/pro/alpaca.js +1 -1
- package/js/src/pro/bitfinex2.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bitmex.js +1 -1
- package/js/src/pro/blockchaincom.js +1 -1
- package/js/src/pro/bybit.js +16 -1
- package/js/src/pro/cex.js +9 -5
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/hitbtc.js +1 -1
- package/js/src/pro/htx.js +1 -1
- package/js/src/pro/okcoin.js +1 -1
- package/js/src/pro/onetrading.js +1 -1
- package/js/src/pro/woo.js +38 -0
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +47 -3
- package/package.json +1 -1
- package/skip-tests.json +5 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -181,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
181
181
|
|
|
182
182
|
//-----------------------------------------------------------------------------
|
|
183
183
|
// this is updated by vss.js when building
|
|
184
|
-
const version = '4.2.
|
|
184
|
+
const version = '4.2.79';
|
|
185
185
|
Exchange["default"].ccxtVersion = version;
|
|
186
186
|
const exchanges = {
|
|
187
187
|
'ace': ace,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -182,6 +182,7 @@ class bingx extends bingx$1 {
|
|
|
182
182
|
'post': {
|
|
183
183
|
'trade/cancelReplace': 1,
|
|
184
184
|
'positionSide/dual': 1,
|
|
185
|
+
'trade/closePosition': 1,
|
|
185
186
|
},
|
|
186
187
|
},
|
|
187
188
|
},
|
|
@@ -2163,6 +2164,8 @@ class bingx extends bingx$1 {
|
|
|
2163
2164
|
'SELL': 'sell',
|
|
2164
2165
|
'SHORT': 'sell',
|
|
2165
2166
|
'LONG': 'buy',
|
|
2167
|
+
'ask': 'sell',
|
|
2168
|
+
'bid': 'buy',
|
|
2166
2169
|
};
|
|
2167
2170
|
return this.safeString(sides, side, side);
|
|
2168
2171
|
}
|
|
@@ -3910,14 +3913,45 @@ class bingx extends bingx$1 {
|
|
|
3910
3913
|
* @param {string} symbol Unified CCXT market symbol
|
|
3911
3914
|
* @param {string} [side] not used by bingx
|
|
3912
3915
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
3916
|
+
* @param {string|undefined} [params.positionId] it is recommended to fill in this parameter when closing a position
|
|
3913
3917
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3914
3918
|
*/
|
|
3915
3919
|
await this.loadMarkets();
|
|
3916
|
-
const
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3920
|
+
const positionId = this.safeString(params, 'positionId');
|
|
3921
|
+
params = this.omit(params, 'positionId');
|
|
3922
|
+
let response = undefined;
|
|
3923
|
+
if (positionId !== undefined) {
|
|
3924
|
+
const request = {
|
|
3925
|
+
'positionId': positionId,
|
|
3926
|
+
};
|
|
3927
|
+
response = await this.swapV1PrivatePostTradeClosePosition(this.extend(request, params));
|
|
3928
|
+
}
|
|
3929
|
+
else {
|
|
3930
|
+
const market = this.market(symbol);
|
|
3931
|
+
const request = {
|
|
3932
|
+
'symbol': market['id'],
|
|
3933
|
+
};
|
|
3934
|
+
response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
|
|
3935
|
+
}
|
|
3936
|
+
//
|
|
3937
|
+
// swapV1PrivatePostTradeClosePosition
|
|
3938
|
+
//
|
|
3939
|
+
// {
|
|
3940
|
+
// "code": 0,
|
|
3941
|
+
// "msg": "",
|
|
3942
|
+
// "timestamp": 1710992264190,
|
|
3943
|
+
// "data": {
|
|
3944
|
+
// "orderId": 1770656007907930112,
|
|
3945
|
+
// "positionId": "1751667128353910784",
|
|
3946
|
+
// "symbol": "LTC-USDT",
|
|
3947
|
+
// "side": "Ask",
|
|
3948
|
+
// "type": "MARKET",
|
|
3949
|
+
// "positionSide": "Long",
|
|
3950
|
+
// "origQty": "0.2"
|
|
3951
|
+
// }
|
|
3952
|
+
// }
|
|
3953
|
+
//
|
|
3954
|
+
// swapV2PrivatePostTradeCloseAllPositions
|
|
3921
3955
|
//
|
|
3922
3956
|
// {
|
|
3923
3957
|
// "code": 0,
|
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -1119,16 +1119,18 @@ class bitstamp extends bitstamp$1 {
|
|
|
1119
1119
|
'timestamp': undefined,
|
|
1120
1120
|
'datetime': undefined,
|
|
1121
1121
|
};
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
const
|
|
1122
|
+
if (response === undefined) {
|
|
1123
|
+
response = [];
|
|
1124
|
+
}
|
|
1125
|
+
for (let i = 0; i < response.length; i++) {
|
|
1126
|
+
const currencyBalance = response[i];
|
|
1127
|
+
const currencyId = this.safeString(currencyBalance, 'currency');
|
|
1128
|
+
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
1127
1129
|
const account = this.account();
|
|
1128
|
-
account['free'] = this.safeString(
|
|
1129
|
-
account['used'] = this.safeString(
|
|
1130
|
-
account['total'] = this.safeString(
|
|
1131
|
-
result[
|
|
1130
|
+
account['free'] = this.safeString(currencyBalance, 'available');
|
|
1131
|
+
account['used'] = this.safeString(currencyBalance, 'reserved');
|
|
1132
|
+
account['total'] = this.safeString(currencyBalance, 'total');
|
|
1133
|
+
result[currencyCode] = account;
|
|
1132
1134
|
}
|
|
1133
1135
|
return this.safeBalance(result);
|
|
1134
1136
|
}
|
|
@@ -1142,24 +1144,17 @@ class bitstamp extends bitstamp$1 {
|
|
|
1142
1144
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1143
1145
|
*/
|
|
1144
1146
|
await this.loadMarkets();
|
|
1145
|
-
const response = await this.
|
|
1147
|
+
const response = await this.privatePostAccountBalances(params);
|
|
1146
1148
|
//
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
//
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
// "bat_balance": "0.00000000",
|
|
1157
|
-
// "bat_reserved": "0.00000000",
|
|
1158
|
-
// "bat_withdrawal_fee": "5.00000000",
|
|
1159
|
-
// "batbtc_fee": "0.000",
|
|
1160
|
-
// "bateur_fee": "0.000",
|
|
1161
|
-
// "batusd_fee": "0.000",
|
|
1162
|
-
// }
|
|
1149
|
+
// [
|
|
1150
|
+
// {
|
|
1151
|
+
// "currency": "usdt",
|
|
1152
|
+
// "total": "7.00000",
|
|
1153
|
+
// "available": "7.00000",
|
|
1154
|
+
// "reserved": "0.00000"
|
|
1155
|
+
// },
|
|
1156
|
+
// ...
|
|
1157
|
+
// ]
|
|
1163
1158
|
//
|
|
1164
1159
|
return this.parseBalance(response);
|
|
1165
1160
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -110,6 +110,7 @@ class bybit extends bybit$1 {
|
|
|
110
110
|
'fetchUnderlyingAssets': false,
|
|
111
111
|
'fetchVolatilityHistory': true,
|
|
112
112
|
'fetchWithdrawals': true,
|
|
113
|
+
'fetchFundingHistory': true,
|
|
113
114
|
'repayCrossMargin': true,
|
|
114
115
|
'setLeverage': true,
|
|
115
116
|
'setMarginMode': true,
|
|
@@ -8090,11 +8091,15 @@ class bybit extends bybit$1 {
|
|
|
8090
8091
|
const tier = info[i];
|
|
8091
8092
|
const marketId = this.safeString(info, 'symbol');
|
|
8092
8093
|
market = this.safeMarket(marketId);
|
|
8094
|
+
let minNotional = this.parseNumber('0');
|
|
8095
|
+
if (i !== 0) {
|
|
8096
|
+
minNotional = this.safeNumber(info[i - 1], 'riskLimitValue');
|
|
8097
|
+
}
|
|
8093
8098
|
tiers.push({
|
|
8094
8099
|
'tier': this.safeInteger(tier, 'id'),
|
|
8095
8100
|
'currency': market['settle'],
|
|
8096
|
-
'minNotional':
|
|
8097
|
-
'maxNotional':
|
|
8101
|
+
'minNotional': minNotional,
|
|
8102
|
+
'maxNotional': this.safeNumber(tier, 'riskLimitValue'),
|
|
8098
8103
|
'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
|
|
8099
8104
|
'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
|
|
8100
8105
|
'info': tier,
|
|
@@ -8102,6 +8107,106 @@ class bybit extends bybit$1 {
|
|
|
8102
8107
|
}
|
|
8103
8108
|
return tiers;
|
|
8104
8109
|
}
|
|
8110
|
+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8111
|
+
/**
|
|
8112
|
+
* @method
|
|
8113
|
+
* @name bybit#fetchFundingHistory
|
|
8114
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
8115
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
|
8116
|
+
* @param {string} [symbol] unified market symbol
|
|
8117
|
+
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
8118
|
+
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
8119
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8120
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
8121
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
8122
|
+
*/
|
|
8123
|
+
await this.loadMarkets();
|
|
8124
|
+
let paginate = false;
|
|
8125
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
|
|
8126
|
+
if (paginate) {
|
|
8127
|
+
return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
|
|
8128
|
+
}
|
|
8129
|
+
let request = {
|
|
8130
|
+
'execType': 'Funding',
|
|
8131
|
+
};
|
|
8132
|
+
let market = undefined;
|
|
8133
|
+
if (symbol !== undefined) {
|
|
8134
|
+
market = this.market(symbol);
|
|
8135
|
+
request['symbol'] = market['id'];
|
|
8136
|
+
}
|
|
8137
|
+
let type = undefined;
|
|
8138
|
+
[type, params] = this.getBybitType('fetchFundingHistory', market, params);
|
|
8139
|
+
request['category'] = type;
|
|
8140
|
+
if (symbol !== undefined) {
|
|
8141
|
+
request['symbol'] = market['id'];
|
|
8142
|
+
}
|
|
8143
|
+
if (since !== undefined) {
|
|
8144
|
+
request['startTime'] = since;
|
|
8145
|
+
}
|
|
8146
|
+
if (limit !== undefined) {
|
|
8147
|
+
request['size'] = limit;
|
|
8148
|
+
}
|
|
8149
|
+
else {
|
|
8150
|
+
request['size'] = 100;
|
|
8151
|
+
}
|
|
8152
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
8153
|
+
const response = await this.privateGetV5ExecutionList(this.extend(request, params));
|
|
8154
|
+
const fundings = this.addPaginationCursorToResult(response);
|
|
8155
|
+
return this.parseIncomes(fundings, market, since, limit);
|
|
8156
|
+
}
|
|
8157
|
+
parseIncome(income, market = undefined) {
|
|
8158
|
+
//
|
|
8159
|
+
// {
|
|
8160
|
+
// "symbol": "XMRUSDT",
|
|
8161
|
+
// "orderType": "UNKNOWN",
|
|
8162
|
+
// "underlyingPrice": "",
|
|
8163
|
+
// "orderLinkId": "",
|
|
8164
|
+
// "orderId": "a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d",
|
|
8165
|
+
// "stopOrderType": "UNKNOWN",
|
|
8166
|
+
// "execTime": "1710950400000",
|
|
8167
|
+
// "feeCurrency": "",
|
|
8168
|
+
// "createType": "",
|
|
8169
|
+
// "feeRate": "-0.000761",
|
|
8170
|
+
// "tradeIv": "",
|
|
8171
|
+
// "blockTradeId": "",
|
|
8172
|
+
// "markPrice": "136.79",
|
|
8173
|
+
// "execPrice": "137.11",
|
|
8174
|
+
// "markIv": "",
|
|
8175
|
+
// "orderQty": "0",
|
|
8176
|
+
// "orderPrice": "0",
|
|
8177
|
+
// "execValue": "134.3678",
|
|
8178
|
+
// "closedSize": "0",
|
|
8179
|
+
// "execType": "Funding",
|
|
8180
|
+
// "seq": "28097658790",
|
|
8181
|
+
// "side": "Sell",
|
|
8182
|
+
// "indexPrice": "",
|
|
8183
|
+
// "leavesQty": "0",
|
|
8184
|
+
// "isMaker": false,
|
|
8185
|
+
// "execFee": "-0.10232512",
|
|
8186
|
+
// "execId": "8d1ef156-4ec6-4445-9a6c-1c0c24dbd046",
|
|
8187
|
+
// "marketUnit": "",
|
|
8188
|
+
// "execQty": "0.98",
|
|
8189
|
+
// "nextPageCursor": "5774437%3A0%2C5771289%3A0"
|
|
8190
|
+
// }
|
|
8191
|
+
//
|
|
8192
|
+
const marketId = this.safeString(income, 'symbol');
|
|
8193
|
+
market = this.safeMarket(marketId, market, undefined, 'contract');
|
|
8194
|
+
let code = 'USDT';
|
|
8195
|
+
if (market['inverse']) {
|
|
8196
|
+
code = market['quote'];
|
|
8197
|
+
}
|
|
8198
|
+
const timestamp = this.safeInteger(income, 'execTime');
|
|
8199
|
+
return {
|
|
8200
|
+
'info': income,
|
|
8201
|
+
'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
|
|
8202
|
+
'code': code,
|
|
8203
|
+
'timestamp': timestamp,
|
|
8204
|
+
'datetime': this.iso8601(timestamp),
|
|
8205
|
+
'id': this.safeString(income, 'execId'),
|
|
8206
|
+
'amount': this.safeNumber(income, 'execQty'),
|
|
8207
|
+
'rate': this.safeNumber(income, 'feeRate'),
|
|
8208
|
+
};
|
|
8209
|
+
}
|
|
8105
8210
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8106
8211
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8107
8212
|
if (api === 'public') {
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -1069,7 +1069,10 @@ class coinbase extends coinbase$1 {
|
|
|
1069
1069
|
* @returns {object[]} an array of objects representing market data
|
|
1070
1070
|
*/
|
|
1071
1071
|
const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
|
|
1072
|
-
|
|
1072
|
+
if (method === 'fetchMarketsV3') {
|
|
1073
|
+
return await this.fetchMarketsV3(params);
|
|
1074
|
+
}
|
|
1075
|
+
return await this.fetchMarketsV2(params);
|
|
1073
1076
|
}
|
|
1074
1077
|
async fetchMarketsV2(params = {}) {
|
|
1075
1078
|
const response = await this.fetchCurrenciesFromCache(params);
|
|
@@ -1144,7 +1147,13 @@ class coinbase extends coinbase$1 {
|
|
|
1144
1147
|
return result;
|
|
1145
1148
|
}
|
|
1146
1149
|
async fetchMarketsV3(params = {}) {
|
|
1147
|
-
const
|
|
1150
|
+
const promisesUnresolved = [
|
|
1151
|
+
this.v3PrivateGetBrokerageProducts(params),
|
|
1152
|
+
this.v3PrivateGetBrokerageTransactionSummary(params),
|
|
1153
|
+
];
|
|
1154
|
+
// const response = await this.v3PrivateGetBrokerageProducts (params);
|
|
1155
|
+
const promises = await Promise.all(promisesUnresolved);
|
|
1156
|
+
const response = this.safeDict(promises, 0, {});
|
|
1148
1157
|
//
|
|
1149
1158
|
// [
|
|
1150
1159
|
// {
|
|
@@ -1179,7 +1188,8 @@ class coinbase extends coinbase$1 {
|
|
|
1179
1188
|
// ...
|
|
1180
1189
|
// ]
|
|
1181
1190
|
//
|
|
1182
|
-
const fees = await this.v3PrivateGetBrokerageTransactionSummary(params);
|
|
1191
|
+
// const fees = await this.v3PrivateGetBrokerageTransactionSummary (params);
|
|
1192
|
+
const fees = this.safeDict(promises, 1, {});
|
|
1183
1193
|
//
|
|
1184
1194
|
// {
|
|
1185
1195
|
// "total_volume": 0,
|
|
@@ -1896,6 +1906,9 @@ class coinbase extends coinbase$1 {
|
|
|
1896
1906
|
const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
|
|
1897
1907
|
const ledger = this.parseLedger(response['data'], currency, since, limit);
|
|
1898
1908
|
const length = ledger.length;
|
|
1909
|
+
if (length === 0) {
|
|
1910
|
+
return ledger;
|
|
1911
|
+
}
|
|
1899
1912
|
const lastIndex = length - 1;
|
|
1900
1913
|
const last = this.safeDict(ledger, lastIndex);
|
|
1901
1914
|
const pagination = this.safeDict(response, 'pagination', {});
|
|
@@ -2235,9 +2248,9 @@ class coinbase extends coinbase$1 {
|
|
|
2235
2248
|
'fee': fee,
|
|
2236
2249
|
};
|
|
2237
2250
|
}
|
|
2238
|
-
async findAccountId(code) {
|
|
2251
|
+
async findAccountId(code, params = {}) {
|
|
2239
2252
|
await this.loadMarkets();
|
|
2240
|
-
await this.loadAccounts();
|
|
2253
|
+
await this.loadAccounts(false, params);
|
|
2241
2254
|
for (let i = 0; i < this.accounts.length; i++) {
|
|
2242
2255
|
const account = this.accounts[i];
|
|
2243
2256
|
if (account['code'] === code) {
|
|
@@ -2266,7 +2279,7 @@ class coinbase extends coinbase$1 {
|
|
|
2266
2279
|
if (code === undefined) {
|
|
2267
2280
|
throw new errors.ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
|
|
2268
2281
|
}
|
|
2269
|
-
accountId = await this.findAccountId(code);
|
|
2282
|
+
accountId = await this.findAccountId(code, params);
|
|
2270
2283
|
if (accountId === undefined) {
|
|
2271
2284
|
throw new errors.ExchangeError(this.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code);
|
|
2272
2285
|
}
|
|
@@ -3410,7 +3423,7 @@ class coinbase extends coinbase$1 {
|
|
|
3410
3423
|
if (code === undefined) {
|
|
3411
3424
|
throw new errors.ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3412
3425
|
}
|
|
3413
|
-
accountId = await this.findAccountId(code);
|
|
3426
|
+
accountId = await this.findAccountId(code, params);
|
|
3414
3427
|
if (accountId === undefined) {
|
|
3415
3428
|
throw new errors.ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
|
|
3416
3429
|
}
|
|
@@ -3635,7 +3648,7 @@ class coinbase extends coinbase$1 {
|
|
|
3635
3648
|
if (code === undefined) {
|
|
3636
3649
|
throw new errors.ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3637
3650
|
}
|
|
3638
|
-
accountId = await this.findAccountId(code);
|
|
3651
|
+
accountId = await this.findAccountId(code, params);
|
|
3639
3652
|
if (accountId === undefined) {
|
|
3640
3653
|
throw new errors.ExchangeError(this.id + ' deposit() could not find account id for ' + code);
|
|
3641
3654
|
}
|
|
@@ -3705,7 +3718,7 @@ class coinbase extends coinbase$1 {
|
|
|
3705
3718
|
if (code === undefined) {
|
|
3706
3719
|
throw new errors.ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3707
3720
|
}
|
|
3708
|
-
accountId = await this.findAccountId(code);
|
|
3721
|
+
accountId = await this.findAccountId(code, params);
|
|
3709
3722
|
if (accountId === undefined) {
|
|
3710
3723
|
throw new errors.ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
|
|
3711
3724
|
}
|
|
@@ -117,10 +117,10 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
117
117
|
},
|
|
118
118
|
'www': 'https://international.coinbase.com',
|
|
119
119
|
'doc': [
|
|
120
|
-
'https://docs.cloud.
|
|
120
|
+
'https://docs.cloud.coinbase.com/intx/docs',
|
|
121
121
|
],
|
|
122
122
|
'fees': [
|
|
123
|
-
'https://help.
|
|
123
|
+
'https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
|
|
124
124
|
],
|
|
125
125
|
'referral': '',
|
|
126
126
|
},
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -49,6 +49,7 @@ class gate extends gate$1 {
|
|
|
49
49
|
'rebate': 'https://api.gateio.ws/api/v4',
|
|
50
50
|
'earn': 'https://api.gateio.ws/api/v4',
|
|
51
51
|
'account': 'https://api.gateio.ws/api/v4',
|
|
52
|
+
'loan': 'https://api.gateio.ws/api/v4',
|
|
52
53
|
},
|
|
53
54
|
},
|
|
54
55
|
'test': {
|
|
@@ -309,6 +310,7 @@ class gate extends gate$1 {
|
|
|
309
310
|
'loan_records': 20 / 15,
|
|
310
311
|
'interest_records': 20 / 15,
|
|
311
312
|
'estimate_rate': 20 / 15,
|
|
313
|
+
'currency_discount_tiers': 20 / 15,
|
|
312
314
|
},
|
|
313
315
|
'post': {
|
|
314
316
|
'account_mode': 20 / 15,
|
|
@@ -4229,7 +4231,8 @@ class gate extends gate$1 {
|
|
|
4229
4231
|
'account': account,
|
|
4230
4232
|
};
|
|
4231
4233
|
if (amount !== undefined) {
|
|
4232
|
-
|
|
4234
|
+
const amountKey = (market['spot']) ? 'amount' : 'size';
|
|
4235
|
+
request[amountKey] = this.amountToPrecision(symbol, amount);
|
|
4233
4236
|
}
|
|
4234
4237
|
if (price !== undefined) {
|
|
4235
4238
|
request['price'] = this.priceToPrecision(symbol, price);
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -2977,42 +2977,47 @@ class htx extends htx$1 {
|
|
|
2977
2977
|
// 'from': parseInt ((since / 1000).toString ()), spot only
|
|
2978
2978
|
// 'to': this.seconds (), spot only
|
|
2979
2979
|
};
|
|
2980
|
-
const
|
|
2981
|
-
params = this.omit(params, 'price');
|
|
2980
|
+
const priceType = this.safeStringN(params, ['priceType', 'price']);
|
|
2981
|
+
params = this.omit(params, ['priceType', 'price']);
|
|
2982
|
+
let until = undefined;
|
|
2983
|
+
[until, params] = this.handleParamInteger(params, 'until');
|
|
2984
|
+
const untilSeconds = (until !== undefined) ? this.parseToInt(until / 1000) : undefined;
|
|
2982
2985
|
if (market['contract']) {
|
|
2983
2986
|
if (limit !== undefined) {
|
|
2984
|
-
request['size'] = limit; // when using limit from
|
|
2987
|
+
request['size'] = limit; // when using limit: from & to are ignored
|
|
2985
2988
|
// https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
|
|
2986
2989
|
}
|
|
2987
2990
|
else {
|
|
2988
2991
|
limit = 2000; // only used for from/to calculation
|
|
2989
2992
|
}
|
|
2990
|
-
if (
|
|
2993
|
+
if (priceType === undefined) {
|
|
2991
2994
|
const duration = this.parseTimeframe(timeframe);
|
|
2995
|
+
let calcualtedEnd = undefined;
|
|
2992
2996
|
if (since === undefined) {
|
|
2993
2997
|
const now = this.seconds();
|
|
2994
2998
|
request['from'] = now - duration * (limit - 1);
|
|
2995
|
-
|
|
2999
|
+
calcualtedEnd = now;
|
|
2996
3000
|
}
|
|
2997
3001
|
else {
|
|
2998
3002
|
const start = this.parseToInt(since / 1000);
|
|
2999
3003
|
request['from'] = start;
|
|
3000
|
-
|
|
3004
|
+
calcualtedEnd = this.sum(start, duration * (limit - 1));
|
|
3001
3005
|
}
|
|
3006
|
+
request['to'] = (untilSeconds !== undefined) ? untilSeconds : calcualtedEnd;
|
|
3002
3007
|
}
|
|
3003
3008
|
}
|
|
3004
3009
|
let response = undefined;
|
|
3005
3010
|
if (market['future']) {
|
|
3006
3011
|
if (market['inverse']) {
|
|
3007
3012
|
request['symbol'] = market['id'];
|
|
3008
|
-
if (
|
|
3013
|
+
if (priceType === 'mark') {
|
|
3009
3014
|
response = await this.contractPublicGetIndexMarketHistoryMarkPriceKline(this.extend(request, params));
|
|
3010
3015
|
}
|
|
3011
|
-
else if (
|
|
3016
|
+
else if (priceType === 'index') {
|
|
3012
3017
|
response = await this.contractPublicGetIndexMarketHistoryIndex(this.extend(request, params));
|
|
3013
3018
|
}
|
|
3014
|
-
else if (
|
|
3015
|
-
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3019
|
+
else if (priceType === 'premiumIndex') {
|
|
3020
|
+
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3016
3021
|
}
|
|
3017
3022
|
else {
|
|
3018
3023
|
response = await this.contractPublicGetMarketHistoryKline(this.extend(request, params));
|
|
@@ -3020,13 +3025,13 @@ class htx extends htx$1 {
|
|
|
3020
3025
|
}
|
|
3021
3026
|
else if (market['linear']) {
|
|
3022
3027
|
request['contract_code'] = market['id'];
|
|
3023
|
-
if (
|
|
3028
|
+
if (priceType === 'mark') {
|
|
3024
3029
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
|
|
3025
3030
|
}
|
|
3026
|
-
else if (
|
|
3027
|
-
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3031
|
+
else if (priceType === 'index') {
|
|
3032
|
+
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3028
3033
|
}
|
|
3029
|
-
else if (
|
|
3034
|
+
else if (priceType === 'premiumIndex') {
|
|
3030
3035
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
|
|
3031
3036
|
}
|
|
3032
3037
|
else {
|
|
@@ -3037,13 +3042,13 @@ class htx extends htx$1 {
|
|
|
3037
3042
|
else if (market['swap']) {
|
|
3038
3043
|
request['contract_code'] = market['id'];
|
|
3039
3044
|
if (market['inverse']) {
|
|
3040
|
-
if (
|
|
3045
|
+
if (priceType === 'mark') {
|
|
3041
3046
|
response = await this.contractPublicGetIndexMarketHistorySwapMarkPriceKline(this.extend(request, params));
|
|
3042
3047
|
}
|
|
3043
|
-
else if (
|
|
3044
|
-
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3048
|
+
else if (priceType === 'index') {
|
|
3049
|
+
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3045
3050
|
}
|
|
3046
|
-
else if (
|
|
3051
|
+
else if (priceType === 'premiumIndex') {
|
|
3047
3052
|
response = await this.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(this.extend(request, params));
|
|
3048
3053
|
}
|
|
3049
3054
|
else {
|
|
@@ -3051,13 +3056,13 @@ class htx extends htx$1 {
|
|
|
3051
3056
|
}
|
|
3052
3057
|
}
|
|
3053
3058
|
else if (market['linear']) {
|
|
3054
|
-
if (
|
|
3059
|
+
if (priceType === 'mark') {
|
|
3055
3060
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
|
|
3056
3061
|
}
|
|
3057
|
-
else if (
|
|
3058
|
-
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3062
|
+
else if (priceType === 'index') {
|
|
3063
|
+
throw new errors.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3059
3064
|
}
|
|
3060
|
-
else if (
|
|
3065
|
+
else if (priceType === 'premiumIndex') {
|
|
3061
3066
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
|
|
3062
3067
|
}
|
|
3063
3068
|
else {
|
|
@@ -3070,18 +3075,22 @@ class htx extends htx$1 {
|
|
|
3070
3075
|
let useHistorical = undefined;
|
|
3071
3076
|
[useHistorical, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', true);
|
|
3072
3077
|
if (!useHistorical) {
|
|
3073
|
-
// `limit` only available for the this endpoint
|
|
3074
3078
|
if (limit !== undefined) {
|
|
3075
|
-
request['size'] = limit; // max 2000
|
|
3079
|
+
request['size'] = Math.min(2000, limit); // max 2000
|
|
3076
3080
|
}
|
|
3077
3081
|
response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
|
|
3078
3082
|
}
|
|
3079
3083
|
else {
|
|
3080
|
-
//
|
|
3084
|
+
// "from & to" only available for the this endpoint
|
|
3081
3085
|
if (since !== undefined) {
|
|
3082
|
-
// default 150 bars
|
|
3083
3086
|
request['from'] = this.parseToInt(since / 1000);
|
|
3084
3087
|
}
|
|
3088
|
+
if (untilSeconds !== undefined) {
|
|
3089
|
+
request['to'] = untilSeconds;
|
|
3090
|
+
}
|
|
3091
|
+
if (limit !== undefined) {
|
|
3092
|
+
request['size'] = Math.min(1000, limit); // max 1000, otherwise default returns 150
|
|
3093
|
+
}
|
|
3085
3094
|
response = await this.spotPublicGetMarketHistoryCandles(this.extend(request, params));
|
|
3086
3095
|
}
|
|
3087
3096
|
}
|
|
@@ -3097,7 +3106,7 @@ class htx extends htx$1 {
|
|
|
3097
3106
|
// ]
|
|
3098
3107
|
// }
|
|
3099
3108
|
//
|
|
3100
|
-
const data = this.
|
|
3109
|
+
const data = this.safeList(response, 'data', []);
|
|
3101
3110
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
3102
3111
|
}
|
|
3103
3112
|
async fetchAccounts(params = {}) {
|
|
@@ -761,8 +761,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
761
761
|
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
762
762
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
763
763
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
764
|
-
* @param {string} [params.clientOrderId] client order id, optional 128 bit hex string
|
|
764
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
765
765
|
* @param {string} [params.slippage] the slippage for market order
|
|
766
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
766
767
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
767
768
|
*/
|
|
768
769
|
await this.loadMarkets();
|
|
@@ -812,7 +813,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
812
813
|
}
|
|
813
814
|
}
|
|
814
815
|
}
|
|
815
|
-
params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
816
|
+
params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']);
|
|
816
817
|
const nonce = this.milliseconds();
|
|
817
818
|
const orderReq = [];
|
|
818
819
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -939,7 +940,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
939
940
|
* @param {string} id order id
|
|
940
941
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
941
942
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
942
|
-
* @param {string} [params.clientOrderId] client order id (
|
|
943
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
943
944
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
944
945
|
*/
|
|
945
946
|
return await this.cancelOrders([id], symbol, params);
|
|
@@ -954,7 +955,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
954
955
|
* @param {string[]} ids order ids
|
|
955
956
|
* @param {string} [symbol] unified market symbol
|
|
956
957
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
957
|
-
* @param {string|string[]} [params.clientOrderId] client order ids (
|
|
958
|
+
* @param {string|string[]} [params.clientOrderId] client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
958
959
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
959
960
|
*/
|
|
960
961
|
this.checkRequiredCredentials();
|
|
@@ -1037,6 +1038,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1037
1038
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
1038
1039
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1039
1040
|
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
1041
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
1040
1042
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1041
1043
|
*/
|
|
1042
1044
|
this.checkRequiredCredentials();
|