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/js/src/bitstamp.js
CHANGED
|
@@ -1122,16 +1122,18 @@ export default class bitstamp extends Exchange {
|
|
|
1122
1122
|
'timestamp': undefined,
|
|
1123
1123
|
'datetime': undefined,
|
|
1124
1124
|
};
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1125
|
+
if (response === undefined) {
|
|
1126
|
+
response = [];
|
|
1127
|
+
}
|
|
1128
|
+
for (let i = 0; i < response.length; i++) {
|
|
1129
|
+
const currencyBalance = response[i];
|
|
1130
|
+
const currencyId = this.safeString(currencyBalance, 'currency');
|
|
1131
|
+
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
1130
1132
|
const account = this.account();
|
|
1131
|
-
account['free'] = this.safeString(
|
|
1132
|
-
account['used'] = this.safeString(
|
|
1133
|
-
account['total'] = this.safeString(
|
|
1134
|
-
result[
|
|
1133
|
+
account['free'] = this.safeString(currencyBalance, 'available');
|
|
1134
|
+
account['used'] = this.safeString(currencyBalance, 'reserved');
|
|
1135
|
+
account['total'] = this.safeString(currencyBalance, 'total');
|
|
1136
|
+
result[currencyCode] = account;
|
|
1135
1137
|
}
|
|
1136
1138
|
return this.safeBalance(result);
|
|
1137
1139
|
}
|
|
@@ -1145,24 +1147,17 @@ export default class bitstamp extends Exchange {
|
|
|
1145
1147
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1146
1148
|
*/
|
|
1147
1149
|
await this.loadMarkets();
|
|
1148
|
-
const response = await this.
|
|
1150
|
+
const response = await this.privatePostAccountBalances(params);
|
|
1149
1151
|
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
//
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
//
|
|
1159
|
-
// "bat_balance": "0.00000000",
|
|
1160
|
-
// "bat_reserved": "0.00000000",
|
|
1161
|
-
// "bat_withdrawal_fee": "5.00000000",
|
|
1162
|
-
// "batbtc_fee": "0.000",
|
|
1163
|
-
// "bateur_fee": "0.000",
|
|
1164
|
-
// "batusd_fee": "0.000",
|
|
1165
|
-
// }
|
|
1152
|
+
// [
|
|
1153
|
+
// {
|
|
1154
|
+
// "currency": "usdt",
|
|
1155
|
+
// "total": "7.00000",
|
|
1156
|
+
// "available": "7.00000",
|
|
1157
|
+
// "reserved": "0.00000"
|
|
1158
|
+
// },
|
|
1159
|
+
// ...
|
|
1160
|
+
// ]
|
|
1166
1161
|
//
|
|
1167
1162
|
return this.parseBalance(response);
|
|
1168
1163
|
}
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bybit.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bybit
|
|
5
5
|
* @augments Exchange
|
|
@@ -256,6 +256,17 @@ export default class bybit extends Exchange {
|
|
|
256
256
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
257
257
|
parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): {};
|
|
258
258
|
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
259
|
+
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
260
|
+
parseIncome(income: any, market?: Market): {
|
|
261
|
+
info: any;
|
|
262
|
+
symbol: string;
|
|
263
|
+
code: string;
|
|
264
|
+
timestamp: number;
|
|
265
|
+
datetime: string;
|
|
266
|
+
id: string;
|
|
267
|
+
amount: number;
|
|
268
|
+
rate: number;
|
|
269
|
+
};
|
|
259
270
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
260
271
|
url: string;
|
|
261
272
|
method: string;
|
package/js/src/bybit.js
CHANGED
|
@@ -113,6 +113,7 @@ export default class bybit extends Exchange {
|
|
|
113
113
|
'fetchUnderlyingAssets': false,
|
|
114
114
|
'fetchVolatilityHistory': true,
|
|
115
115
|
'fetchWithdrawals': true,
|
|
116
|
+
'fetchFundingHistory': true,
|
|
116
117
|
'repayCrossMargin': true,
|
|
117
118
|
'setLeverage': true,
|
|
118
119
|
'setMarginMode': true,
|
|
@@ -8097,11 +8098,15 @@ export default class bybit extends Exchange {
|
|
|
8097
8098
|
const tier = info[i];
|
|
8098
8099
|
const marketId = this.safeString(info, 'symbol');
|
|
8099
8100
|
market = this.safeMarket(marketId);
|
|
8101
|
+
let minNotional = this.parseNumber('0');
|
|
8102
|
+
if (i !== 0) {
|
|
8103
|
+
minNotional = this.safeNumber(info[i - 1], 'riskLimitValue');
|
|
8104
|
+
}
|
|
8100
8105
|
tiers.push({
|
|
8101
8106
|
'tier': this.safeInteger(tier, 'id'),
|
|
8102
8107
|
'currency': market['settle'],
|
|
8103
|
-
'minNotional':
|
|
8104
|
-
'maxNotional':
|
|
8108
|
+
'minNotional': minNotional,
|
|
8109
|
+
'maxNotional': this.safeNumber(tier, 'riskLimitValue'),
|
|
8105
8110
|
'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
|
|
8106
8111
|
'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
|
|
8107
8112
|
'info': tier,
|
|
@@ -8109,6 +8114,106 @@ export default class bybit extends Exchange {
|
|
|
8109
8114
|
}
|
|
8110
8115
|
return tiers;
|
|
8111
8116
|
}
|
|
8117
|
+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8118
|
+
/**
|
|
8119
|
+
* @method
|
|
8120
|
+
* @name bybit#fetchFundingHistory
|
|
8121
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
8122
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
|
8123
|
+
* @param {string} [symbol] unified market symbol
|
|
8124
|
+
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
8125
|
+
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
8126
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8127
|
+
* @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)
|
|
8128
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
8129
|
+
*/
|
|
8130
|
+
await this.loadMarkets();
|
|
8131
|
+
let paginate = false;
|
|
8132
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
|
|
8133
|
+
if (paginate) {
|
|
8134
|
+
return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
|
|
8135
|
+
}
|
|
8136
|
+
let request = {
|
|
8137
|
+
'execType': 'Funding',
|
|
8138
|
+
};
|
|
8139
|
+
let market = undefined;
|
|
8140
|
+
if (symbol !== undefined) {
|
|
8141
|
+
market = this.market(symbol);
|
|
8142
|
+
request['symbol'] = market['id'];
|
|
8143
|
+
}
|
|
8144
|
+
let type = undefined;
|
|
8145
|
+
[type, params] = this.getBybitType('fetchFundingHistory', market, params);
|
|
8146
|
+
request['category'] = type;
|
|
8147
|
+
if (symbol !== undefined) {
|
|
8148
|
+
request['symbol'] = market['id'];
|
|
8149
|
+
}
|
|
8150
|
+
if (since !== undefined) {
|
|
8151
|
+
request['startTime'] = since;
|
|
8152
|
+
}
|
|
8153
|
+
if (limit !== undefined) {
|
|
8154
|
+
request['size'] = limit;
|
|
8155
|
+
}
|
|
8156
|
+
else {
|
|
8157
|
+
request['size'] = 100;
|
|
8158
|
+
}
|
|
8159
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
8160
|
+
const response = await this.privateGetV5ExecutionList(this.extend(request, params));
|
|
8161
|
+
const fundings = this.addPaginationCursorToResult(response);
|
|
8162
|
+
return this.parseIncomes(fundings, market, since, limit);
|
|
8163
|
+
}
|
|
8164
|
+
parseIncome(income, market = undefined) {
|
|
8165
|
+
//
|
|
8166
|
+
// {
|
|
8167
|
+
// "symbol": "XMRUSDT",
|
|
8168
|
+
// "orderType": "UNKNOWN",
|
|
8169
|
+
// "underlyingPrice": "",
|
|
8170
|
+
// "orderLinkId": "",
|
|
8171
|
+
// "orderId": "a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d",
|
|
8172
|
+
// "stopOrderType": "UNKNOWN",
|
|
8173
|
+
// "execTime": "1710950400000",
|
|
8174
|
+
// "feeCurrency": "",
|
|
8175
|
+
// "createType": "",
|
|
8176
|
+
// "feeRate": "-0.000761",
|
|
8177
|
+
// "tradeIv": "",
|
|
8178
|
+
// "blockTradeId": "",
|
|
8179
|
+
// "markPrice": "136.79",
|
|
8180
|
+
// "execPrice": "137.11",
|
|
8181
|
+
// "markIv": "",
|
|
8182
|
+
// "orderQty": "0",
|
|
8183
|
+
// "orderPrice": "0",
|
|
8184
|
+
// "execValue": "134.3678",
|
|
8185
|
+
// "closedSize": "0",
|
|
8186
|
+
// "execType": "Funding",
|
|
8187
|
+
// "seq": "28097658790",
|
|
8188
|
+
// "side": "Sell",
|
|
8189
|
+
// "indexPrice": "",
|
|
8190
|
+
// "leavesQty": "0",
|
|
8191
|
+
// "isMaker": false,
|
|
8192
|
+
// "execFee": "-0.10232512",
|
|
8193
|
+
// "execId": "8d1ef156-4ec6-4445-9a6c-1c0c24dbd046",
|
|
8194
|
+
// "marketUnit": "",
|
|
8195
|
+
// "execQty": "0.98",
|
|
8196
|
+
// "nextPageCursor": "5774437%3A0%2C5771289%3A0"
|
|
8197
|
+
// }
|
|
8198
|
+
//
|
|
8199
|
+
const marketId = this.safeString(income, 'symbol');
|
|
8200
|
+
market = this.safeMarket(marketId, market, undefined, 'contract');
|
|
8201
|
+
let code = 'USDT';
|
|
8202
|
+
if (market['inverse']) {
|
|
8203
|
+
code = market['quote'];
|
|
8204
|
+
}
|
|
8205
|
+
const timestamp = this.safeInteger(income, 'execTime');
|
|
8206
|
+
return {
|
|
8207
|
+
'info': income,
|
|
8208
|
+
'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
|
|
8209
|
+
'code': code,
|
|
8210
|
+
'timestamp': timestamp,
|
|
8211
|
+
'datetime': this.iso8601(timestamp),
|
|
8212
|
+
'id': this.safeString(income, 'execId'),
|
|
8213
|
+
'amount': this.safeNumber(income, 'execQty'),
|
|
8214
|
+
'rate': this.safeNumber(income, 'feeRate'),
|
|
8215
|
+
};
|
|
8216
|
+
}
|
|
8112
8217
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8113
8218
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8114
8219
|
if (api === 'public') {
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export default class coinbase extends Exchange {
|
|
|
30
30
|
parseTransactionStatus(status: any): string;
|
|
31
31
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
32
32
|
parseTrade(trade: any, market?: Market): Trade;
|
|
33
|
-
fetchMarkets(params?: {}): Promise<any>;
|
|
33
|
+
fetchMarkets(params?: {}): Promise<any[]>;
|
|
34
34
|
fetchMarketsV2(params?: {}): Promise<any[]>;
|
|
35
35
|
fetchMarketsV3(params?: {}): Promise<any[]>;
|
|
36
36
|
fetchCurrenciesFromCache(params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
|
|
@@ -64,7 +64,7 @@ export default class coinbase extends Exchange {
|
|
|
64
64
|
status: string;
|
|
65
65
|
fee: any;
|
|
66
66
|
};
|
|
67
|
-
findAccountId(code: any): Promise<any>;
|
|
67
|
+
findAccountId(code: any, params?: {}): Promise<any>;
|
|
68
68
|
prepareAccountRequest(limit?: Int, params?: {}): {
|
|
69
69
|
account_id: string;
|
|
70
70
|
};
|
package/js/src/coinbase.js
CHANGED
|
@@ -1072,7 +1072,10 @@ export default class coinbase extends Exchange {
|
|
|
1072
1072
|
* @returns {object[]} an array of objects representing market data
|
|
1073
1073
|
*/
|
|
1074
1074
|
const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
|
|
1075
|
-
|
|
1075
|
+
if (method === 'fetchMarketsV3') {
|
|
1076
|
+
return await this.fetchMarketsV3(params);
|
|
1077
|
+
}
|
|
1078
|
+
return await this.fetchMarketsV2(params);
|
|
1076
1079
|
}
|
|
1077
1080
|
async fetchMarketsV2(params = {}) {
|
|
1078
1081
|
const response = await this.fetchCurrenciesFromCache(params);
|
|
@@ -1147,7 +1150,13 @@ export default class coinbase extends Exchange {
|
|
|
1147
1150
|
return result;
|
|
1148
1151
|
}
|
|
1149
1152
|
async fetchMarketsV3(params = {}) {
|
|
1150
|
-
const
|
|
1153
|
+
const promisesUnresolved = [
|
|
1154
|
+
this.v3PrivateGetBrokerageProducts(params),
|
|
1155
|
+
this.v3PrivateGetBrokerageTransactionSummary(params),
|
|
1156
|
+
];
|
|
1157
|
+
// const response = await this.v3PrivateGetBrokerageProducts (params);
|
|
1158
|
+
const promises = await Promise.all(promisesUnresolved);
|
|
1159
|
+
const response = this.safeDict(promises, 0, {});
|
|
1151
1160
|
//
|
|
1152
1161
|
// [
|
|
1153
1162
|
// {
|
|
@@ -1182,7 +1191,8 @@ export default class coinbase extends Exchange {
|
|
|
1182
1191
|
// ...
|
|
1183
1192
|
// ]
|
|
1184
1193
|
//
|
|
1185
|
-
const fees = await this.v3PrivateGetBrokerageTransactionSummary(params);
|
|
1194
|
+
// const fees = await this.v3PrivateGetBrokerageTransactionSummary (params);
|
|
1195
|
+
const fees = this.safeDict(promises, 1, {});
|
|
1186
1196
|
//
|
|
1187
1197
|
// {
|
|
1188
1198
|
// "total_volume": 0,
|
|
@@ -1899,6 +1909,9 @@ export default class coinbase extends Exchange {
|
|
|
1899
1909
|
const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
|
|
1900
1910
|
const ledger = this.parseLedger(response['data'], currency, since, limit);
|
|
1901
1911
|
const length = ledger.length;
|
|
1912
|
+
if (length === 0) {
|
|
1913
|
+
return ledger;
|
|
1914
|
+
}
|
|
1902
1915
|
const lastIndex = length - 1;
|
|
1903
1916
|
const last = this.safeDict(ledger, lastIndex);
|
|
1904
1917
|
const pagination = this.safeDict(response, 'pagination', {});
|
|
@@ -2238,9 +2251,9 @@ export default class coinbase extends Exchange {
|
|
|
2238
2251
|
'fee': fee,
|
|
2239
2252
|
};
|
|
2240
2253
|
}
|
|
2241
|
-
async findAccountId(code) {
|
|
2254
|
+
async findAccountId(code, params = {}) {
|
|
2242
2255
|
await this.loadMarkets();
|
|
2243
|
-
await this.loadAccounts();
|
|
2256
|
+
await this.loadAccounts(false, params);
|
|
2244
2257
|
for (let i = 0; i < this.accounts.length; i++) {
|
|
2245
2258
|
const account = this.accounts[i];
|
|
2246
2259
|
if (account['code'] === code) {
|
|
@@ -2269,7 +2282,7 @@ export default class coinbase extends Exchange {
|
|
|
2269
2282
|
if (code === undefined) {
|
|
2270
2283
|
throw new ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
|
|
2271
2284
|
}
|
|
2272
|
-
accountId = await this.findAccountId(code);
|
|
2285
|
+
accountId = await this.findAccountId(code, params);
|
|
2273
2286
|
if (accountId === undefined) {
|
|
2274
2287
|
throw new ExchangeError(this.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code);
|
|
2275
2288
|
}
|
|
@@ -3413,7 +3426,7 @@ export default class coinbase extends Exchange {
|
|
|
3413
3426
|
if (code === undefined) {
|
|
3414
3427
|
throw new ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3415
3428
|
}
|
|
3416
|
-
accountId = await this.findAccountId(code);
|
|
3429
|
+
accountId = await this.findAccountId(code, params);
|
|
3417
3430
|
if (accountId === undefined) {
|
|
3418
3431
|
throw new ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
|
|
3419
3432
|
}
|
|
@@ -3638,7 +3651,7 @@ export default class coinbase extends Exchange {
|
|
|
3638
3651
|
if (code === undefined) {
|
|
3639
3652
|
throw new ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3640
3653
|
}
|
|
3641
|
-
accountId = await this.findAccountId(code);
|
|
3654
|
+
accountId = await this.findAccountId(code, params);
|
|
3642
3655
|
if (accountId === undefined) {
|
|
3643
3656
|
throw new ExchangeError(this.id + ' deposit() could not find account id for ' + code);
|
|
3644
3657
|
}
|
|
@@ -3708,7 +3721,7 @@ export default class coinbase extends Exchange {
|
|
|
3708
3721
|
if (code === undefined) {
|
|
3709
3722
|
throw new ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3710
3723
|
}
|
|
3711
|
-
accountId = await this.findAccountId(code);
|
|
3724
|
+
accountId = await this.findAccountId(code, params);
|
|
3712
3725
|
if (accountId === undefined) {
|
|
3713
3726
|
throw new ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
|
|
3714
3727
|
}
|
|
@@ -120,10 +120,10 @@ export default class coinbaseinternational extends Exchange {
|
|
|
120
120
|
},
|
|
121
121
|
'www': 'https://international.coinbase.com',
|
|
122
122
|
'doc': [
|
|
123
|
-
'https://docs.cloud.
|
|
123
|
+
'https://docs.cloud.coinbase.com/intx/docs',
|
|
124
124
|
],
|
|
125
125
|
'fees': [
|
|
126
|
-
'https://help.
|
|
126
|
+
'https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
|
|
127
127
|
],
|
|
128
128
|
'referral': '',
|
|
129
129
|
},
|
package/js/src/gate.js
CHANGED
|
@@ -52,6 +52,7 @@ export default class gate extends Exchange {
|
|
|
52
52
|
'rebate': 'https://api.gateio.ws/api/v4',
|
|
53
53
|
'earn': 'https://api.gateio.ws/api/v4',
|
|
54
54
|
'account': 'https://api.gateio.ws/api/v4',
|
|
55
|
+
'loan': 'https://api.gateio.ws/api/v4',
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
'test': {
|
|
@@ -312,6 +313,7 @@ export default class gate extends Exchange {
|
|
|
312
313
|
'loan_records': 20 / 15,
|
|
313
314
|
'interest_records': 20 / 15,
|
|
314
315
|
'estimate_rate': 20 / 15,
|
|
316
|
+
'currency_discount_tiers': 20 / 15,
|
|
315
317
|
},
|
|
316
318
|
'post': {
|
|
317
319
|
'account_mode': 20 / 15,
|
|
@@ -4232,7 +4234,8 @@ export default class gate extends Exchange {
|
|
|
4232
4234
|
'account': account,
|
|
4233
4235
|
};
|
|
4234
4236
|
if (amount !== undefined) {
|
|
4235
|
-
|
|
4237
|
+
const amountKey = (market['spot']) ? 'amount' : 'size';
|
|
4238
|
+
request[amountKey] = this.amountToPrecision(symbol, amount);
|
|
4236
4239
|
}
|
|
4237
4240
|
if (price !== undefined) {
|
|
4238
4241
|
request['price'] = this.priceToPrecision(symbol, price);
|
package/js/src/htx.js
CHANGED
|
@@ -2980,42 +2980,47 @@ export default class htx extends Exchange {
|
|
|
2980
2980
|
// 'from': parseInt ((since / 1000).toString ()), spot only
|
|
2981
2981
|
// 'to': this.seconds (), spot only
|
|
2982
2982
|
};
|
|
2983
|
-
const
|
|
2984
|
-
params = this.omit(params, 'price');
|
|
2983
|
+
const priceType = this.safeStringN(params, ['priceType', 'price']);
|
|
2984
|
+
params = this.omit(params, ['priceType', 'price']);
|
|
2985
|
+
let until = undefined;
|
|
2986
|
+
[until, params] = this.handleParamInteger(params, 'until');
|
|
2987
|
+
const untilSeconds = (until !== undefined) ? this.parseToInt(until / 1000) : undefined;
|
|
2985
2988
|
if (market['contract']) {
|
|
2986
2989
|
if (limit !== undefined) {
|
|
2987
|
-
request['size'] = limit; // when using limit from
|
|
2990
|
+
request['size'] = limit; // when using limit: from & to are ignored
|
|
2988
2991
|
// https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
|
|
2989
2992
|
}
|
|
2990
2993
|
else {
|
|
2991
2994
|
limit = 2000; // only used for from/to calculation
|
|
2992
2995
|
}
|
|
2993
|
-
if (
|
|
2996
|
+
if (priceType === undefined) {
|
|
2994
2997
|
const duration = this.parseTimeframe(timeframe);
|
|
2998
|
+
let calcualtedEnd = undefined;
|
|
2995
2999
|
if (since === undefined) {
|
|
2996
3000
|
const now = this.seconds();
|
|
2997
3001
|
request['from'] = now - duration * (limit - 1);
|
|
2998
|
-
|
|
3002
|
+
calcualtedEnd = now;
|
|
2999
3003
|
}
|
|
3000
3004
|
else {
|
|
3001
3005
|
const start = this.parseToInt(since / 1000);
|
|
3002
3006
|
request['from'] = start;
|
|
3003
|
-
|
|
3007
|
+
calcualtedEnd = this.sum(start, duration * (limit - 1));
|
|
3004
3008
|
}
|
|
3009
|
+
request['to'] = (untilSeconds !== undefined) ? untilSeconds : calcualtedEnd;
|
|
3005
3010
|
}
|
|
3006
3011
|
}
|
|
3007
3012
|
let response = undefined;
|
|
3008
3013
|
if (market['future']) {
|
|
3009
3014
|
if (market['inverse']) {
|
|
3010
3015
|
request['symbol'] = market['id'];
|
|
3011
|
-
if (
|
|
3016
|
+
if (priceType === 'mark') {
|
|
3012
3017
|
response = await this.contractPublicGetIndexMarketHistoryMarkPriceKline(this.extend(request, params));
|
|
3013
3018
|
}
|
|
3014
|
-
else if (
|
|
3019
|
+
else if (priceType === 'index') {
|
|
3015
3020
|
response = await this.contractPublicGetIndexMarketHistoryIndex(this.extend(request, params));
|
|
3016
3021
|
}
|
|
3017
|
-
else if (
|
|
3018
|
-
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3022
|
+
else if (priceType === 'premiumIndex') {
|
|
3023
|
+
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3019
3024
|
}
|
|
3020
3025
|
else {
|
|
3021
3026
|
response = await this.contractPublicGetMarketHistoryKline(this.extend(request, params));
|
|
@@ -3023,13 +3028,13 @@ export default class htx extends Exchange {
|
|
|
3023
3028
|
}
|
|
3024
3029
|
else if (market['linear']) {
|
|
3025
3030
|
request['contract_code'] = market['id'];
|
|
3026
|
-
if (
|
|
3031
|
+
if (priceType === 'mark') {
|
|
3027
3032
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
|
|
3028
3033
|
}
|
|
3029
|
-
else if (
|
|
3030
|
-
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3034
|
+
else if (priceType === 'index') {
|
|
3035
|
+
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3031
3036
|
}
|
|
3032
|
-
else if (
|
|
3037
|
+
else if (priceType === 'premiumIndex') {
|
|
3033
3038
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
|
|
3034
3039
|
}
|
|
3035
3040
|
else {
|
|
@@ -3040,13 +3045,13 @@ export default class htx extends Exchange {
|
|
|
3040
3045
|
else if (market['swap']) {
|
|
3041
3046
|
request['contract_code'] = market['id'];
|
|
3042
3047
|
if (market['inverse']) {
|
|
3043
|
-
if (
|
|
3048
|
+
if (priceType === 'mark') {
|
|
3044
3049
|
response = await this.contractPublicGetIndexMarketHistorySwapMarkPriceKline(this.extend(request, params));
|
|
3045
3050
|
}
|
|
3046
|
-
else if (
|
|
3047
|
-
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3051
|
+
else if (priceType === 'index') {
|
|
3052
|
+
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3048
3053
|
}
|
|
3049
|
-
else if (
|
|
3054
|
+
else if (priceType === 'premiumIndex') {
|
|
3050
3055
|
response = await this.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(this.extend(request, params));
|
|
3051
3056
|
}
|
|
3052
3057
|
else {
|
|
@@ -3054,13 +3059,13 @@ export default class htx extends Exchange {
|
|
|
3054
3059
|
}
|
|
3055
3060
|
}
|
|
3056
3061
|
else if (market['linear']) {
|
|
3057
|
-
if (
|
|
3062
|
+
if (priceType === 'mark') {
|
|
3058
3063
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
|
|
3059
3064
|
}
|
|
3060
|
-
else if (
|
|
3061
|
-
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' +
|
|
3065
|
+
else if (priceType === 'index') {
|
|
3066
|
+
throw new BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
|
|
3062
3067
|
}
|
|
3063
|
-
else if (
|
|
3068
|
+
else if (priceType === 'premiumIndex') {
|
|
3064
3069
|
response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
|
|
3065
3070
|
}
|
|
3066
3071
|
else {
|
|
@@ -3073,18 +3078,22 @@ export default class htx extends Exchange {
|
|
|
3073
3078
|
let useHistorical = undefined;
|
|
3074
3079
|
[useHistorical, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', true);
|
|
3075
3080
|
if (!useHistorical) {
|
|
3076
|
-
// `limit` only available for the this endpoint
|
|
3077
3081
|
if (limit !== undefined) {
|
|
3078
|
-
request['size'] = limit; // max 2000
|
|
3082
|
+
request['size'] = Math.min(2000, limit); // max 2000
|
|
3079
3083
|
}
|
|
3080
3084
|
response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
|
|
3081
3085
|
}
|
|
3082
3086
|
else {
|
|
3083
|
-
//
|
|
3087
|
+
// "from & to" only available for the this endpoint
|
|
3084
3088
|
if (since !== undefined) {
|
|
3085
|
-
// default 150 bars
|
|
3086
3089
|
request['from'] = this.parseToInt(since / 1000);
|
|
3087
3090
|
}
|
|
3091
|
+
if (untilSeconds !== undefined) {
|
|
3092
|
+
request['to'] = untilSeconds;
|
|
3093
|
+
}
|
|
3094
|
+
if (limit !== undefined) {
|
|
3095
|
+
request['size'] = Math.min(1000, limit); // max 1000, otherwise default returns 150
|
|
3096
|
+
}
|
|
3088
3097
|
response = await this.spotPublicGetMarketHistoryCandles(this.extend(request, params));
|
|
3089
3098
|
}
|
|
3090
3099
|
}
|
|
@@ -3100,7 +3109,7 @@ export default class htx extends Exchange {
|
|
|
3100
3109
|
// ]
|
|
3101
3110
|
// }
|
|
3102
3111
|
//
|
|
3103
|
-
const data = this.
|
|
3112
|
+
const data = this.safeList(response, 'data', []);
|
|
3104
3113
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
3105
3114
|
}
|
|
3106
3115
|
async fetchAccounts(params = {}) {
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -764,8 +764,9 @@ export default class hyperliquid extends Exchange {
|
|
|
764
764
|
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
765
765
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
766
766
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
767
|
-
* @param {string} [params.clientOrderId] client order id, optional 128 bit hex string
|
|
767
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
768
768
|
* @param {string} [params.slippage] the slippage for market order
|
|
769
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
769
770
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
770
771
|
*/
|
|
771
772
|
await this.loadMarkets();
|
|
@@ -815,7 +816,7 @@ export default class hyperliquid extends Exchange {
|
|
|
815
816
|
}
|
|
816
817
|
}
|
|
817
818
|
}
|
|
818
|
-
params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
819
|
+
params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']);
|
|
819
820
|
const nonce = this.milliseconds();
|
|
820
821
|
const orderReq = [];
|
|
821
822
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -942,7 +943,7 @@ export default class hyperliquid extends Exchange {
|
|
|
942
943
|
* @param {string} id order id
|
|
943
944
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
944
945
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
945
|
-
* @param {string} [params.clientOrderId] client order id (
|
|
946
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
946
947
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
947
948
|
*/
|
|
948
949
|
return await this.cancelOrders([id], symbol, params);
|
|
@@ -957,7 +958,7 @@ export default class hyperliquid extends Exchange {
|
|
|
957
958
|
* @param {string[]} ids order ids
|
|
958
959
|
* @param {string} [symbol] unified market symbol
|
|
959
960
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
960
|
-
* @param {string|string[]} [params.clientOrderId] client order ids (
|
|
961
|
+
* @param {string|string[]} [params.clientOrderId] client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
961
962
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
962
963
|
*/
|
|
963
964
|
this.checkRequiredCredentials();
|
|
@@ -1040,6 +1041,7 @@ export default class hyperliquid extends Exchange {
|
|
|
1040
1041
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
1041
1042
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1042
1043
|
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
1044
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
1043
1045
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1044
1046
|
*/
|
|
1045
1047
|
this.checkRequiredCredentials();
|
package/js/src/kucoin.js
CHANGED
|
@@ -449,6 +449,56 @@ export default class kucoin extends Exchange {
|
|
|
449
449
|
'130202': ExchangeError,
|
|
450
450
|
'130203': InsufficientFunds,
|
|
451
451
|
'130204': BadRequest,
|
|
452
|
+
'130301': InsufficientFunds,
|
|
453
|
+
'130302': PermissionDenied,
|
|
454
|
+
'130303': NotSupported,
|
|
455
|
+
'130304': NotSupported,
|
|
456
|
+
'130305': NotSupported,
|
|
457
|
+
'130306': NotSupported,
|
|
458
|
+
'130307': NotSupported,
|
|
459
|
+
'130308': InvalidOrder,
|
|
460
|
+
'130309': InvalidOrder,
|
|
461
|
+
'130310': ExchangeError,
|
|
462
|
+
'130311': InvalidOrder,
|
|
463
|
+
'130312': InvalidOrder,
|
|
464
|
+
'130313': InvalidOrder,
|
|
465
|
+
'130314': InvalidOrder,
|
|
466
|
+
'130315': NotSupported,
|
|
467
|
+
'126000': ExchangeError,
|
|
468
|
+
'126001': NotSupported,
|
|
469
|
+
'126002': ExchangeError,
|
|
470
|
+
'126003': InvalidOrder,
|
|
471
|
+
'126004': ExchangeError,
|
|
472
|
+
'126005': PermissionDenied,
|
|
473
|
+
'126006': ExchangeError,
|
|
474
|
+
'126007': ExchangeError,
|
|
475
|
+
'126009': ExchangeError,
|
|
476
|
+
'126010': ExchangeError,
|
|
477
|
+
'126011': ExchangeError,
|
|
478
|
+
'126013': InsufficientFunds,
|
|
479
|
+
'126015': ExchangeError,
|
|
480
|
+
'126021': NotSupported,
|
|
481
|
+
'126022': InvalidOrder,
|
|
482
|
+
'126027': InvalidOrder,
|
|
483
|
+
'126028': InvalidOrder,
|
|
484
|
+
'126029': InvalidOrder,
|
|
485
|
+
'126030': InvalidOrder,
|
|
486
|
+
'126033': InvalidOrder,
|
|
487
|
+
'126034': InvalidOrder,
|
|
488
|
+
'126036': InvalidOrder,
|
|
489
|
+
'126037': ExchangeError,
|
|
490
|
+
'126038': ExchangeError,
|
|
491
|
+
'126039': ExchangeError,
|
|
492
|
+
'126041': ExchangeError,
|
|
493
|
+
'126042': ExchangeError,
|
|
494
|
+
'126043': OrderNotFound,
|
|
495
|
+
'126044': InvalidOrder,
|
|
496
|
+
'126045': NotSupported,
|
|
497
|
+
'126046': NotSupported,
|
|
498
|
+
'126047': PermissionDenied,
|
|
499
|
+
'126048': PermissionDenied,
|
|
500
|
+
'135005': ExchangeError,
|
|
501
|
+
'135018': ExchangeError,
|
|
452
502
|
'200004': InsufficientFunds,
|
|
453
503
|
'210014': InvalidOrder,
|
|
454
504
|
'210021': InsufficientFunds,
|
|
@@ -470,10 +520,12 @@ export default class kucoin extends Exchange {
|
|
|
470
520
|
'400350': InvalidOrder,
|
|
471
521
|
'400370': InvalidOrder,
|
|
472
522
|
'400400': BadRequest,
|
|
523
|
+
'400401': AuthenticationError,
|
|
473
524
|
'400500': InvalidOrder,
|
|
474
525
|
'400600': BadSymbol,
|
|
475
526
|
'400760': InvalidOrder,
|
|
476
527
|
'401000': BadRequest,
|
|
528
|
+
'408000': BadRequest,
|
|
477
529
|
'411100': AccountSuspended,
|
|
478
530
|
'415000': BadRequest,
|
|
479
531
|
'400303': PermissionDenied,
|