ccxt 4.2.94 → 4.2.95
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/build.sh +1 -1
- package/dist/ccxt.browser.js +285 -287
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/errors.js +25 -64
- package/dist/cjs/src/base/ws/OrderBookSide.js +5 -0
- package/dist/cjs/src/bitstamp.js +6 -0
- package/dist/cjs/src/coinex.js +61 -55
- package/dist/cjs/src/gemini.js +2 -1
- package/dist/cjs/src/htx.js +127 -125
- package/dist/cjs/src/okx.js +40 -40
- package/dist/cjs/src/pro/coinbase.js +18 -0
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +3 -3
- package/js/src/abstract/bitstamp.d.ts +6 -0
- package/js/src/base/errorHierarchy.d.ts +1 -1
- package/js/src/base/errorHierarchy.js +1 -1
- package/js/src/base/errors.d.ts +26 -26
- package/js/src/base/errors.js +26 -66
- package/js/src/base/ws/OrderBook.d.ts +7 -0
- package/js/src/base/ws/OrderBook.js +1 -6
- package/js/src/base/ws/OrderBookSide.d.ts +9 -3
- package/js/src/base/ws/OrderBookSide.js +6 -1
- package/js/src/bitstamp.js +6 -0
- package/js/src/coinex.js +61 -55
- package/js/src/gemini.js +2 -1
- package/js/src/htx.d.ts +1 -0
- package/js/src/htx.js +128 -126
- package/js/src/okx.js +40 -40
- package/js/src/pro/coinbase.js +18 -0
- package/package.json +1 -1
- package/skip-tests.json +1 -0
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1117,7 +1117,7 @@ class okx extends okx$1 {
|
|
|
1117
1117
|
return super.handleMarketTypeAndParams(methodName, market, params);
|
|
1118
1118
|
}
|
|
1119
1119
|
convertToInstrumentType(type) {
|
|
1120
|
-
const exchangeTypes = this.
|
|
1120
|
+
const exchangeTypes = this.safeDict(this.options, 'exchangeType', {});
|
|
1121
1121
|
return this.safeString(exchangeTypes, type, type);
|
|
1122
1122
|
}
|
|
1123
1123
|
createExpiredOptionMarket(symbol) {
|
|
@@ -2921,7 +2921,7 @@ class okx extends okx$1 {
|
|
|
2921
2921
|
const side = this.safeString(rawOrder, 'side');
|
|
2922
2922
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
2923
2923
|
const price = this.safeValue(rawOrder, 'price');
|
|
2924
|
-
const orderParams = this.
|
|
2924
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
2925
2925
|
const extendedParams = this.extend(orderParams, params); // the request does not accept extra params since it's a list, so we're extending each order with the common params
|
|
2926
2926
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams);
|
|
2927
2927
|
ordersRequests.push(orderRequest);
|
|
@@ -3110,8 +3110,8 @@ class okx extends okx$1 {
|
|
|
3110
3110
|
// "msg": ""
|
|
3111
3111
|
// }
|
|
3112
3112
|
//
|
|
3113
|
-
const data = this.
|
|
3114
|
-
const first = this.
|
|
3113
|
+
const data = this.safeList(response, 'data', []);
|
|
3114
|
+
const first = this.safeDict(data, 0, {});
|
|
3115
3115
|
const order = this.parseOrder(first, market);
|
|
3116
3116
|
order['type'] = type;
|
|
3117
3117
|
order['side'] = side;
|
|
@@ -4310,7 +4310,7 @@ class okx extends okx$1 {
|
|
|
4310
4310
|
if (paginate) {
|
|
4311
4311
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
4312
4312
|
}
|
|
4313
|
-
const options = this.
|
|
4313
|
+
const options = this.safeDict(this.options, 'fetchLedger', {});
|
|
4314
4314
|
let method = this.safeString(options, 'method');
|
|
4315
4315
|
method = this.safeString(params, 'method', method);
|
|
4316
4316
|
params = this.omit(params, 'method');
|
|
@@ -4639,7 +4639,7 @@ class okx extends okx$1 {
|
|
|
4639
4639
|
// ]
|
|
4640
4640
|
// }
|
|
4641
4641
|
//
|
|
4642
|
-
const data = this.
|
|
4642
|
+
const data = this.safeList(response, 'data', []);
|
|
4643
4643
|
const filtered = this.filterBy(data, 'selected', true);
|
|
4644
4644
|
const parsed = this.parseDepositAddresses(filtered, [currency['code']], false);
|
|
4645
4645
|
return this.indexBy(parsed, 'network');
|
|
@@ -4713,7 +4713,7 @@ class okx extends okx$1 {
|
|
|
4713
4713
|
};
|
|
4714
4714
|
let network = this.safeString(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
4715
4715
|
if (network !== undefined) {
|
|
4716
|
-
const networks = this.
|
|
4716
|
+
const networks = this.safeDict(this.options, 'networks', {});
|
|
4717
4717
|
network = this.safeString(networks, network.toUpperCase(), network); // handle ETH>ERC20 alias
|
|
4718
4718
|
request['chain'] = currency['id'] + '-' + network;
|
|
4719
4719
|
params = this.omit(params, 'network');
|
|
@@ -4722,7 +4722,7 @@ class okx extends okx$1 {
|
|
|
4722
4722
|
if (fee === undefined) {
|
|
4723
4723
|
const currencies = await this.fetchCurrencies();
|
|
4724
4724
|
this.currencies = this.deepExtend(this.currencies, currencies);
|
|
4725
|
-
const targetNetwork = this.
|
|
4725
|
+
const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
|
|
4726
4726
|
fee = this.safeString(targetNetwork, 'fee');
|
|
4727
4727
|
if (fee === undefined) {
|
|
4728
4728
|
throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a "fee" string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set "0". Withdrawing to external digital asset address requires network transaction fee.');
|
|
@@ -4744,7 +4744,7 @@ class okx extends okx$1 {
|
|
|
4744
4744
|
// ]
|
|
4745
4745
|
// }
|
|
4746
4746
|
//
|
|
4747
|
-
const data = this.
|
|
4747
|
+
const data = this.safeList(response, 'data', []);
|
|
4748
4748
|
const transaction = this.safeDict(data, 0);
|
|
4749
4749
|
return this.parseTransaction(transaction, currency);
|
|
4750
4750
|
}
|
|
@@ -4969,7 +4969,7 @@ class okx extends okx$1 {
|
|
|
4969
4969
|
// "msg": ''
|
|
4970
4970
|
// }
|
|
4971
4971
|
//
|
|
4972
|
-
const data = this.
|
|
4972
|
+
const data = this.safeList(response, 'data', []);
|
|
4973
4973
|
const withdrawal = this.safeDict(data, 0, {});
|
|
4974
4974
|
return this.parseTransaction(withdrawal);
|
|
4975
4975
|
}
|
|
@@ -5256,8 +5256,8 @@ class okx extends okx$1 {
|
|
|
5256
5256
|
// ]
|
|
5257
5257
|
// }
|
|
5258
5258
|
//
|
|
5259
|
-
const data = this.
|
|
5260
|
-
const position = this.
|
|
5259
|
+
const data = this.safeList(response, 'data', []);
|
|
5260
|
+
const position = this.safeDict(data, 0);
|
|
5261
5261
|
if (position === undefined) {
|
|
5262
5262
|
return undefined;
|
|
5263
5263
|
}
|
|
@@ -5293,7 +5293,7 @@ class okx extends okx$1 {
|
|
|
5293
5293
|
request['instId'] = marketIds.join(',');
|
|
5294
5294
|
}
|
|
5295
5295
|
}
|
|
5296
|
-
const fetchPositionsOptions = this.
|
|
5296
|
+
const fetchPositionsOptions = this.safeDict(this.options, 'fetchPositions', {});
|
|
5297
5297
|
const method = this.safeString(fetchPositionsOptions, 'method', 'privateGetAccountPositions');
|
|
5298
5298
|
let response = undefined;
|
|
5299
5299
|
if (method === 'privateGetAccountPositionsHistory') {
|
|
@@ -5348,7 +5348,7 @@ class okx extends okx$1 {
|
|
|
5348
5348
|
// ]
|
|
5349
5349
|
// }
|
|
5350
5350
|
//
|
|
5351
|
-
const positions = this.
|
|
5351
|
+
const positions = this.safeList(response, 'data', []);
|
|
5352
5352
|
const result = [];
|
|
5353
5353
|
for (let i = 0; i < positions.length; i++) {
|
|
5354
5354
|
result.push(this.parsePosition(positions[i]));
|
|
@@ -5556,7 +5556,7 @@ class okx extends okx$1 {
|
|
|
5556
5556
|
*/
|
|
5557
5557
|
await this.loadMarkets();
|
|
5558
5558
|
const currency = this.currency(code);
|
|
5559
|
-
const accountsByType = this.
|
|
5559
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
5560
5560
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
5561
5561
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
5562
5562
|
const request = {
|
|
@@ -5598,7 +5598,7 @@ class okx extends okx$1 {
|
|
|
5598
5598
|
// ]
|
|
5599
5599
|
// }
|
|
5600
5600
|
//
|
|
5601
|
-
const data = this.
|
|
5601
|
+
const data = this.safeList(response, 'data', []);
|
|
5602
5602
|
const rawTransfer = this.safeDict(data, 0, {});
|
|
5603
5603
|
return this.parseTransfer(rawTransfer, currency);
|
|
5604
5604
|
}
|
|
@@ -5661,7 +5661,7 @@ class okx extends okx$1 {
|
|
|
5661
5661
|
let amount = this.safeNumber(transfer, 'amt');
|
|
5662
5662
|
const fromAccountId = this.safeString(transfer, 'from');
|
|
5663
5663
|
const toAccountId = this.safeString(transfer, 'to');
|
|
5664
|
-
const accountsById = this.
|
|
5664
|
+
const accountsById = this.safeDict(this.options, 'accountsById', {});
|
|
5665
5665
|
const timestamp = this.safeInteger(transfer, 'ts');
|
|
5666
5666
|
const balanceChange = this.safeString(transfer, 'sz');
|
|
5667
5667
|
if (balanceChange !== undefined) {
|
|
@@ -5712,7 +5712,7 @@ class okx extends okx$1 {
|
|
|
5712
5712
|
// "msg": ""
|
|
5713
5713
|
// }
|
|
5714
5714
|
//
|
|
5715
|
-
const data = this.
|
|
5715
|
+
const data = this.safeList(response, 'data', []);
|
|
5716
5716
|
const transfer = this.safeDict(data, 0);
|
|
5717
5717
|
return this.parseTransfer(transfer);
|
|
5718
5718
|
}
|
|
@@ -5918,8 +5918,8 @@ class okx extends okx$1 {
|
|
|
5918
5918
|
// "msg": ""
|
|
5919
5919
|
// }
|
|
5920
5920
|
//
|
|
5921
|
-
const data = this.
|
|
5922
|
-
const entry = this.
|
|
5921
|
+
const data = this.safeList(response, 'data', []);
|
|
5922
|
+
const entry = this.safeDict(data, 0, {});
|
|
5923
5923
|
return this.parseFundingRate(entry, market);
|
|
5924
5924
|
}
|
|
5925
5925
|
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -6059,7 +6059,7 @@ class okx extends okx$1 {
|
|
|
6059
6059
|
// "type": "8"
|
|
6060
6060
|
// }
|
|
6061
6061
|
//
|
|
6062
|
-
const data = this.
|
|
6062
|
+
const data = this.safeList(response, 'data', []);
|
|
6063
6063
|
const result = [];
|
|
6064
6064
|
for (let i = 0; i < data.length; i++) {
|
|
6065
6065
|
const entry = data[i];
|
|
@@ -6251,7 +6251,7 @@ class okx extends okx$1 {
|
|
|
6251
6251
|
// ],
|
|
6252
6252
|
// }
|
|
6253
6253
|
//
|
|
6254
|
-
const data = this.
|
|
6254
|
+
const data = this.safeList(response, 'data', []);
|
|
6255
6255
|
const rates = [];
|
|
6256
6256
|
for (let i = 0; i < data.length; i++) {
|
|
6257
6257
|
rates.push(this.parseBorrowRate(data[i]));
|
|
@@ -6287,8 +6287,8 @@ class okx extends okx$1 {
|
|
|
6287
6287
|
// "msg": ""
|
|
6288
6288
|
// }
|
|
6289
6289
|
//
|
|
6290
|
-
const data = this.
|
|
6291
|
-
const rate = this.
|
|
6290
|
+
const data = this.safeList(response, 'data', []);
|
|
6291
|
+
const rate = this.safeDict(data, 0, {});
|
|
6292
6292
|
return this.parseBorrowRate(rate);
|
|
6293
6293
|
}
|
|
6294
6294
|
parseBorrowRate(info, currency = undefined) {
|
|
@@ -6392,7 +6392,7 @@ class okx extends okx$1 {
|
|
|
6392
6392
|
// "msg": ""
|
|
6393
6393
|
// }
|
|
6394
6394
|
//
|
|
6395
|
-
const data = this.
|
|
6395
|
+
const data = this.safeList(response, 'data', []);
|
|
6396
6396
|
return this.parseBorrowRateHistories(data, codes, since, limit);
|
|
6397
6397
|
}
|
|
6398
6398
|
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
@@ -6436,7 +6436,7 @@ class okx extends okx$1 {
|
|
|
6436
6436
|
// "msg": ""
|
|
6437
6437
|
// }
|
|
6438
6438
|
//
|
|
6439
|
-
const data = this.
|
|
6439
|
+
const data = this.safeList(response, 'data', []);
|
|
6440
6440
|
return this.parseBorrowRateHistory(data, code, since, limit);
|
|
6441
6441
|
}
|
|
6442
6442
|
async modifyMarginHelper(symbol, amount, type, params = {}) {
|
|
@@ -6628,7 +6628,7 @@ class okx extends okx$1 {
|
|
|
6628
6628
|
// ]
|
|
6629
6629
|
// }
|
|
6630
6630
|
//
|
|
6631
|
-
const data = this.
|
|
6631
|
+
const data = this.safeList(response, 'data', []);
|
|
6632
6632
|
return this.parseMarketLeverageTiers(data, market);
|
|
6633
6633
|
}
|
|
6634
6634
|
parseMarketLeverageTiers(info, market = undefined) {
|
|
@@ -6730,7 +6730,7 @@ class okx extends okx$1 {
|
|
|
6730
6730
|
// "msg": ""
|
|
6731
6731
|
// }
|
|
6732
6732
|
//
|
|
6733
|
-
const data = this.
|
|
6733
|
+
const data = this.safeList(response, 'data', []);
|
|
6734
6734
|
const interest = this.parseBorrowInterests(data);
|
|
6735
6735
|
return this.filterByCurrencySinceLimit(interest, code, since, limit);
|
|
6736
6736
|
}
|
|
@@ -6786,8 +6786,8 @@ class okx extends okx$1 {
|
|
|
6786
6786
|
// "msg": ""
|
|
6787
6787
|
// }
|
|
6788
6788
|
//
|
|
6789
|
-
const data = this.
|
|
6790
|
-
const loan = this.
|
|
6789
|
+
const data = this.safeList(response, 'data', []);
|
|
6790
|
+
const loan = this.safeDict(data, 0, {});
|
|
6791
6791
|
return this.parseMarginLoan(loan, currency);
|
|
6792
6792
|
}
|
|
6793
6793
|
async repayCrossMargin(code, amount, params = {}) {
|
|
@@ -6831,8 +6831,8 @@ class okx extends okx$1 {
|
|
|
6831
6831
|
// "msg": ""
|
|
6832
6832
|
// }
|
|
6833
6833
|
//
|
|
6834
|
-
const data = this.
|
|
6835
|
-
const loan = this.
|
|
6834
|
+
const data = this.safeList(response, 'data', []);
|
|
6835
|
+
const loan = this.safeDict(data, 0, {});
|
|
6836
6836
|
return this.parseMarginLoan(loan, currency);
|
|
6837
6837
|
}
|
|
6838
6838
|
parseMarginLoan(info, currency = undefined) {
|
|
@@ -6914,8 +6914,8 @@ class okx extends okx$1 {
|
|
|
6914
6914
|
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
6915
6915
|
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
6916
6916
|
*/
|
|
6917
|
-
const options = this.
|
|
6918
|
-
const timeframes = this.
|
|
6917
|
+
const options = this.safeDict(this.options, 'fetchOpenInterestHistory', {});
|
|
6918
|
+
const timeframes = this.safeDict(options, 'timeframes', {});
|
|
6919
6919
|
timeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
6920
6920
|
if (timeframe !== '5m' && timeframe !== '1H' && timeframe !== '1D') {
|
|
6921
6921
|
throw new errors.BadRequest(this.id + ' fetchOpenInterestHistory cannot only use the 5m, 1h, and 1d timeframe');
|
|
@@ -7205,7 +7205,7 @@ class okx extends okx$1 {
|
|
|
7205
7205
|
// "msg": ""
|
|
7206
7206
|
// }
|
|
7207
7207
|
//
|
|
7208
|
-
const data = this.
|
|
7208
|
+
const data = this.safeList(response, 'data', []);
|
|
7209
7209
|
const settlements = this.parseSettlements(data, market);
|
|
7210
7210
|
const sorted = this.sortBy(settlements, 'timestamp');
|
|
7211
7211
|
return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
|
|
@@ -7244,7 +7244,7 @@ class okx extends okx$1 {
|
|
|
7244
7244
|
for (let i = 0; i < settlements.length; i++) {
|
|
7245
7245
|
const entry = settlements[i];
|
|
7246
7246
|
const timestamp = this.safeInteger(entry, 'ts');
|
|
7247
|
-
const details = this.
|
|
7247
|
+
const details = this.safeList(entry, 'details', []);
|
|
7248
7248
|
for (let j = 0; j < details.length; j++) {
|
|
7249
7249
|
const settlement = this.parseSettlement(details[j], market);
|
|
7250
7250
|
result.push(this.extend(settlement, {
|
|
@@ -7290,7 +7290,7 @@ class okx extends okx$1 {
|
|
|
7290
7290
|
// "msg": ""
|
|
7291
7291
|
// }
|
|
7292
7292
|
//
|
|
7293
|
-
const underlyings = this.
|
|
7293
|
+
const underlyings = this.safeList(response, 'data', []);
|
|
7294
7294
|
return underlyings[0];
|
|
7295
7295
|
}
|
|
7296
7296
|
async fetchGreeks(symbol, params = {}) {
|
|
@@ -7342,7 +7342,7 @@ class okx extends okx$1 {
|
|
|
7342
7342
|
// "msg": ""
|
|
7343
7343
|
// }
|
|
7344
7344
|
//
|
|
7345
|
-
const data = this.
|
|
7345
|
+
const data = this.safeList(response, 'data', []);
|
|
7346
7346
|
for (let i = 0; i < data.length; i++) {
|
|
7347
7347
|
const entry = data[i];
|
|
7348
7348
|
const entryMarketId = this.safeString(entry, 'instId');
|
|
@@ -7465,7 +7465,7 @@ class okx extends okx$1 {
|
|
|
7465
7465
|
// "outTime": "1701877077102579"
|
|
7466
7466
|
// }
|
|
7467
7467
|
//
|
|
7468
|
-
const data = this.
|
|
7468
|
+
const data = this.safeList(response, 'data', []);
|
|
7469
7469
|
const order = this.safeDict(data, 0);
|
|
7470
7470
|
return this.parseOrder(order, market);
|
|
7471
7471
|
}
|
|
@@ -7784,7 +7784,7 @@ class okx extends okx$1 {
|
|
|
7784
7784
|
const code = this.safeString(response, 'code');
|
|
7785
7785
|
if ((code !== '0') && (code !== '2')) { // 2 means that bulk operation partially succeeded
|
|
7786
7786
|
const feedback = this.id + ' ' + body;
|
|
7787
|
-
const data = this.
|
|
7787
|
+
const data = this.safeList(response, 'data', []);
|
|
7788
7788
|
for (let i = 0; i < data.length; i++) {
|
|
7789
7789
|
const error = data[i];
|
|
7790
7790
|
const errorCode = this.safeString(error, 'sCode');
|
|
@@ -186,6 +186,9 @@ class coinbase extends coinbase$1 {
|
|
|
186
186
|
const messageHash = channel + '::' + wsMarketId;
|
|
187
187
|
newTickers.push(result);
|
|
188
188
|
client.resolve(result, messageHash);
|
|
189
|
+
if (messageHash.endsWith('USD')) {
|
|
190
|
+
client.resolve(result, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
191
|
+
}
|
|
189
192
|
}
|
|
190
193
|
}
|
|
191
194
|
const messageHashes = this.findMessageHashes(client, 'ticker_batch::');
|
|
@@ -197,6 +200,9 @@ class coinbase extends coinbase$1 {
|
|
|
197
200
|
const tickers = this.filterByArray(newTickers, 'symbol', symbols);
|
|
198
201
|
if (!this.isEmpty(tickers)) {
|
|
199
202
|
client.resolve(tickers, messageHash);
|
|
203
|
+
if (messageHash.endsWith('USD')) {
|
|
204
|
+
client.resolve(tickers, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
205
|
+
}
|
|
200
206
|
}
|
|
201
207
|
}
|
|
202
208
|
return message;
|
|
@@ -346,6 +352,9 @@ class coinbase extends coinbase$1 {
|
|
|
346
352
|
}
|
|
347
353
|
}
|
|
348
354
|
client.resolve(tradesArray, messageHash);
|
|
355
|
+
if (marketId.endsWith('USD')) {
|
|
356
|
+
client.resolve(tradesArray, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
357
|
+
}
|
|
349
358
|
return message;
|
|
350
359
|
}
|
|
351
360
|
handleOrder(client, message) {
|
|
@@ -401,6 +410,9 @@ class coinbase extends coinbase$1 {
|
|
|
401
410
|
const marketId = marketIds[i];
|
|
402
411
|
const messageHash = 'user::' + marketId;
|
|
403
412
|
client.resolve(this.orders, messageHash);
|
|
413
|
+
if (messageHash.endsWith('USD')) {
|
|
414
|
+
client.resolve(this.orders, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
415
|
+
}
|
|
404
416
|
}
|
|
405
417
|
client.resolve(this.orders, 'user');
|
|
406
418
|
return message;
|
|
@@ -513,6 +525,9 @@ class coinbase extends coinbase$1 {
|
|
|
513
525
|
orderbook['datetime'] = undefined;
|
|
514
526
|
orderbook['symbol'] = symbol;
|
|
515
527
|
client.resolve(orderbook, messageHash);
|
|
528
|
+
if (messageHash.endsWith('USD')) {
|
|
529
|
+
client.resolve(orderbook, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
530
|
+
}
|
|
516
531
|
}
|
|
517
532
|
else if (type === 'update') {
|
|
518
533
|
const orderbook = this.orderbooks[symbol];
|
|
@@ -521,6 +536,9 @@ class coinbase extends coinbase$1 {
|
|
|
521
536
|
orderbook['timestamp'] = this.parse8601(datetime);
|
|
522
537
|
orderbook['symbol'] = symbol;
|
|
523
538
|
client.resolve(orderbook, messageHash);
|
|
539
|
+
if (messageHash.endsWith('USD')) {
|
|
540
|
+
client.resolve(orderbook, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
541
|
+
}
|
|
524
542
|
}
|
|
525
543
|
}
|
|
526
544
|
return message;
|
package/js/ccxt.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Precise } from './src/base/Precise.js';
|
|
|
3
3
|
import * as functions from './src/base/functions.js';
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
|
-
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout
|
|
7
|
-
declare const version = "4.2.
|
|
6
|
+
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
+
declare const version = "4.2.94";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -519,5 +519,5 @@ declare const ccxt: {
|
|
|
519
519
|
zaif: typeof zaif;
|
|
520
520
|
zonda: typeof zonda;
|
|
521
521
|
} & typeof functions & typeof errors;
|
|
522
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout,
|
|
522
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
523
523
|
export default ccxt;
|
package/js/ccxt.js
CHANGED
|
@@ -35,10 +35,10 @@ import { Exchange } from './src/base/Exchange.js';
|
|
|
35
35
|
import { Precise } from './src/base/Precise.js';
|
|
36
36
|
import * as functions from './src/base/functions.js';
|
|
37
37
|
import * as errors from './src/base/errors.js';
|
|
38
|
-
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout
|
|
38
|
+
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.95';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -392,6 +392,6 @@ pro.exchanges = Object.keys(pro);
|
|
|
392
392
|
pro['Exchange'] = Exchange; // now the same for rest and ts
|
|
393
393
|
//-----------------------------------------------------------------------------
|
|
394
394
|
const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
|
|
395
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout,
|
|
395
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
396
396
|
export default ccxt;
|
|
397
397
|
//-----------------------------------------------------------------------------
|
|
@@ -233,6 +233,12 @@ interface Exchange {
|
|
|
233
233
|
privatePostBlurAddress(params?: {}): Promise<implicitReturnType>;
|
|
234
234
|
privatePostVextWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
235
235
|
privatePostVextAddress(params?: {}): Promise<implicitReturnType>;
|
|
236
|
+
privatePostCsprWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
237
|
+
privatePostCsprAddress(params?: {}): Promise<implicitReturnType>;
|
|
238
|
+
privatePostVchfWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
239
|
+
privatePostVchfAddress(params?: {}): Promise<implicitReturnType>;
|
|
240
|
+
privatePostVeurWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
241
|
+
privatePostVeurAddress(params?: {}): Promise<implicitReturnType>;
|
|
236
242
|
}
|
|
237
243
|
declare abstract class Exchange extends _Exchange {
|
|
238
244
|
}
|
|
@@ -34,6 +34,7 @@ declare const errorHierarchy: {
|
|
|
34
34
|
};
|
|
35
35
|
NotSupported: {};
|
|
36
36
|
ProxyError: {};
|
|
37
|
+
ExchangeClosedByUser: {};
|
|
37
38
|
};
|
|
38
39
|
OperationFailed: {
|
|
39
40
|
NetworkError: {
|
|
@@ -46,7 +47,6 @@ declare const errorHierarchy: {
|
|
|
46
47
|
RequestTimeout: {};
|
|
47
48
|
};
|
|
48
49
|
};
|
|
49
|
-
ExchangeClosedByUser: {};
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
export default errorHierarchy;
|
|
@@ -40,6 +40,7 @@ const errorHierarchy = {
|
|
|
40
40
|
},
|
|
41
41
|
'NotSupported': {},
|
|
42
42
|
'ProxyError': {},
|
|
43
|
+
'ExchangeClosedByUser': {},
|
|
43
44
|
},
|
|
44
45
|
'OperationFailed': {
|
|
45
46
|
'NetworkError': {
|
|
@@ -52,7 +53,6 @@ const errorHierarchy = {
|
|
|
52
53
|
'RequestTimeout': {},
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
|
-
'ExchangeClosedByUser': {},
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
58
|
export default errorHierarchy;
|
package/js/src/base/errors.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
declare class BaseError extends Error {
|
|
2
2
|
constructor(message: any);
|
|
3
3
|
}
|
|
4
|
-
declare class ExchangeError extends
|
|
5
|
-
constructor(message: any);
|
|
6
|
-
}
|
|
7
|
-
declare class ExchangeClosedByUser extends Error {
|
|
4
|
+
declare class ExchangeError extends BaseError {
|
|
8
5
|
constructor(message: any);
|
|
9
6
|
}
|
|
10
7
|
declare class AuthenticationError extends ExchangeError {
|
|
11
8
|
constructor(message: any);
|
|
12
9
|
}
|
|
13
|
-
declare class PermissionDenied extends
|
|
10
|
+
declare class PermissionDenied extends AuthenticationError {
|
|
14
11
|
constructor(message: any);
|
|
15
12
|
}
|
|
16
|
-
declare class AccountNotEnabled extends
|
|
13
|
+
declare class AccountNotEnabled extends PermissionDenied {
|
|
17
14
|
constructor(message: any);
|
|
18
15
|
}
|
|
19
|
-
declare class AccountSuspended extends
|
|
16
|
+
declare class AccountSuspended extends AuthenticationError {
|
|
20
17
|
constructor(message: any);
|
|
21
18
|
}
|
|
22
19
|
declare class ArgumentsRequired extends ExchangeError {
|
|
@@ -25,10 +22,10 @@ declare class ArgumentsRequired extends ExchangeError {
|
|
|
25
22
|
declare class BadRequest extends ExchangeError {
|
|
26
23
|
constructor(message: any);
|
|
27
24
|
}
|
|
28
|
-
declare class
|
|
25
|
+
declare class BadSymbol extends BadRequest {
|
|
29
26
|
constructor(message: any);
|
|
30
27
|
}
|
|
31
|
-
declare class
|
|
28
|
+
declare class OperationRejected extends ExchangeError {
|
|
32
29
|
constructor(message: any);
|
|
33
30
|
}
|
|
34
31
|
declare class NoChange extends OperationRejected {
|
|
@@ -40,7 +37,7 @@ declare class MarginModeAlreadySet extends NoChange {
|
|
|
40
37
|
declare class BadResponse extends ExchangeError {
|
|
41
38
|
constructor(message: any);
|
|
42
39
|
}
|
|
43
|
-
declare class NullResponse extends
|
|
40
|
+
declare class NullResponse extends BadResponse {
|
|
44
41
|
constructor(message: any);
|
|
45
42
|
}
|
|
46
43
|
declare class InsufficientFunds extends ExchangeError {
|
|
@@ -55,9 +52,6 @@ declare class AddressPending extends InvalidAddress {
|
|
|
55
52
|
declare class InvalidOrder extends ExchangeError {
|
|
56
53
|
constructor(message: any);
|
|
57
54
|
}
|
|
58
|
-
declare class ContractUnavailable extends InvalidOrder {
|
|
59
|
-
constructor(message: any);
|
|
60
|
-
}
|
|
61
55
|
declare class OrderNotFound extends InvalidOrder {
|
|
62
56
|
constructor(message: any);
|
|
63
57
|
}
|
|
@@ -76,15 +70,21 @@ declare class OrderNotFillable extends InvalidOrder {
|
|
|
76
70
|
declare class DuplicateOrderId extends InvalidOrder {
|
|
77
71
|
constructor(message: any);
|
|
78
72
|
}
|
|
79
|
-
declare class
|
|
73
|
+
declare class ContractUnavailable extends InvalidOrder {
|
|
80
74
|
constructor(message: any);
|
|
81
75
|
}
|
|
82
|
-
declare class
|
|
76
|
+
declare class NotSupported extends ExchangeError {
|
|
83
77
|
constructor(message: any);
|
|
84
78
|
}
|
|
85
79
|
declare class ProxyError extends ExchangeError {
|
|
86
80
|
constructor(message: any);
|
|
87
81
|
}
|
|
82
|
+
declare class ExchangeClosedByUser extends ExchangeError {
|
|
83
|
+
constructor(message: any);
|
|
84
|
+
}
|
|
85
|
+
declare class OperationFailed extends BaseError {
|
|
86
|
+
constructor(message: any);
|
|
87
|
+
}
|
|
88
88
|
declare class NetworkError extends OperationFailed {
|
|
89
89
|
constructor(message: any);
|
|
90
90
|
}
|
|
@@ -106,21 +106,25 @@ declare class InvalidNonce extends NetworkError {
|
|
|
106
106
|
declare class RequestTimeout extends NetworkError {
|
|
107
107
|
constructor(message: any);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
export { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout };
|
|
110
|
+
declare const _default: {
|
|
110
111
|
BaseError: typeof BaseError;
|
|
111
|
-
ExchangeClosedByUser: typeof ExchangeClosedByUser;
|
|
112
112
|
ExchangeError: typeof ExchangeError;
|
|
113
|
+
AuthenticationError: typeof AuthenticationError;
|
|
113
114
|
PermissionDenied: typeof PermissionDenied;
|
|
114
115
|
AccountNotEnabled: typeof AccountNotEnabled;
|
|
115
116
|
AccountSuspended: typeof AccountSuspended;
|
|
116
117
|
ArgumentsRequired: typeof ArgumentsRequired;
|
|
117
118
|
BadRequest: typeof BadRequest;
|
|
118
119
|
BadSymbol: typeof BadSymbol;
|
|
120
|
+
OperationRejected: typeof OperationRejected;
|
|
121
|
+
NoChange: typeof NoChange;
|
|
119
122
|
MarginModeAlreadySet: typeof MarginModeAlreadySet;
|
|
120
123
|
BadResponse: typeof BadResponse;
|
|
121
124
|
NullResponse: typeof NullResponse;
|
|
122
125
|
InsufficientFunds: typeof InsufficientFunds;
|
|
123
126
|
InvalidAddress: typeof InvalidAddress;
|
|
127
|
+
AddressPending: typeof AddressPending;
|
|
124
128
|
InvalidOrder: typeof InvalidOrder;
|
|
125
129
|
OrderNotFound: typeof OrderNotFound;
|
|
126
130
|
OrderNotCached: typeof OrderNotCached;
|
|
@@ -128,7 +132,11 @@ declare const errors: {
|
|
|
128
132
|
OrderImmediatelyFillable: typeof OrderImmediatelyFillable;
|
|
129
133
|
OrderNotFillable: typeof OrderNotFillable;
|
|
130
134
|
DuplicateOrderId: typeof DuplicateOrderId;
|
|
135
|
+
ContractUnavailable: typeof ContractUnavailable;
|
|
131
136
|
NotSupported: typeof NotSupported;
|
|
137
|
+
ProxyError: typeof ProxyError;
|
|
138
|
+
ExchangeClosedByUser: typeof ExchangeClosedByUser;
|
|
139
|
+
OperationFailed: typeof OperationFailed;
|
|
132
140
|
NetworkError: typeof NetworkError;
|
|
133
141
|
DDoSProtection: typeof DDoSProtection;
|
|
134
142
|
RateLimitExceeded: typeof RateLimitExceeded;
|
|
@@ -136,13 +144,5 @@ declare const errors: {
|
|
|
136
144
|
OnMaintenance: typeof OnMaintenance;
|
|
137
145
|
InvalidNonce: typeof InvalidNonce;
|
|
138
146
|
RequestTimeout: typeof RequestTimeout;
|
|
139
|
-
AuthenticationError: typeof AuthenticationError;
|
|
140
|
-
AddressPending: typeof AddressPending;
|
|
141
|
-
ContractUnavailable: typeof ContractUnavailable;
|
|
142
|
-
NoChange: typeof NoChange;
|
|
143
|
-
OperationRejected: typeof OperationRejected;
|
|
144
|
-
OperationFailed: typeof OperationFailed;
|
|
145
|
-
ProxyError: typeof ProxyError;
|
|
146
147
|
};
|
|
147
|
-
export
|
|
148
|
-
export default errors;
|
|
148
|
+
export default _default;
|