ccxt 4.2.98 → 4.2.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +85 -34
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/coinbase.js +50 -21
- package/dist/cjs/src/kraken.js +5 -4
- package/dist/cjs/src/pro/coinbase.js +24 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/coinbase.d.ts +1 -0
- package/js/src/coinbase.js +50 -21
- package/js/src/kraken.js +5 -4
- package/js/src/pro/coinbase.js +25 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,13 +212,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
212
212
|
|
|
213
213
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
214
214
|
|
|
215
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
216
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
215
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.99/dist/ccxt.browser.js
|
|
216
|
+
* unpkg: https://unpkg.com/ccxt@4.2.99/dist/ccxt.browser.js
|
|
217
217
|
|
|
218
218
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
219
219
|
|
|
220
220
|
```HTML
|
|
221
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
221
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.99/dist/ccxt.browser.js"></script>
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -96132,6 +96132,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96132
96132
|
const contractExpiryType = this.safeString(futureProductDetails, 'contract_expiry_type');
|
|
96133
96133
|
const contractSize = this.safeNumber(futureProductDetails, 'contract_size');
|
|
96134
96134
|
const contractExpire = this.safeString(futureProductDetails, 'contract_expiry');
|
|
96135
|
+
const expireTimestamp = this.parse8601(contractExpire);
|
|
96135
96136
|
const isSwap = (contractExpiryType === 'PERPETUAL');
|
|
96136
96137
|
const baseId = this.safeString(futureProductDetails, 'contract_root_unit');
|
|
96137
96138
|
const quoteId = this.safeString(market, 'quote_currency_id');
|
|
@@ -96146,7 +96147,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96146
96147
|
}
|
|
96147
96148
|
else {
|
|
96148
96149
|
type = 'future';
|
|
96149
|
-
symbol = symbol + ':' + quote + '-' + this.yymmdd(
|
|
96150
|
+
symbol = symbol + ':' + quote + '-' + this.yymmdd(expireTimestamp);
|
|
96150
96151
|
}
|
|
96151
96152
|
const takerFeeRate = this.safeNumber(feeTier, 'taker_fee_rate');
|
|
96152
96153
|
const makerFeeRate = this.safeNumber(feeTier, 'maker_fee_rate');
|
|
@@ -96174,7 +96175,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
96174
96175
|
'taker': taker,
|
|
96175
96176
|
'maker': maker,
|
|
96176
96177
|
'contractSize': contractSize,
|
|
96177
|
-
'expiry':
|
|
96178
|
+
'expiry': expireTimestamp,
|
|
96178
96179
|
'expiryDatetime': contractExpire,
|
|
96179
96180
|
'strike': undefined,
|
|
96180
96181
|
'optionType': undefined,
|
|
@@ -98961,6 +98962,33 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
98961
98962
|
'takeProfitPrice': undefined,
|
|
98962
98963
|
});
|
|
98963
98964
|
}
|
|
98965
|
+
createAuthToken(seconds, method = undefined, url = undefined) {
|
|
98966
|
+
// it may not work for v2
|
|
98967
|
+
let uri = undefined;
|
|
98968
|
+
if (url !== undefined) {
|
|
98969
|
+
uri = method + ' ' + url.replace('https://', '');
|
|
98970
|
+
const quesPos = uri.indexOf('?');
|
|
98971
|
+
// Due to we use mb_strpos, quesPos could be false in php. In that case, the quesPos >= 0 is true
|
|
98972
|
+
// Also it's not possible that the question mark is first character, only check > 0 here.
|
|
98973
|
+
if (quesPos > 0) {
|
|
98974
|
+
uri = uri.slice(0, quesPos);
|
|
98975
|
+
}
|
|
98976
|
+
}
|
|
98977
|
+
const nonce = this.randomBytes(16);
|
|
98978
|
+
const request = {
|
|
98979
|
+
'aud': ['retail_rest_api_proxy'],
|
|
98980
|
+
'iss': 'coinbase-cloud',
|
|
98981
|
+
'nbf': seconds,
|
|
98982
|
+
'exp': seconds + 120,
|
|
98983
|
+
'sub': this.apiKey,
|
|
98984
|
+
'iat': seconds,
|
|
98985
|
+
};
|
|
98986
|
+
if (uri !== undefined) {
|
|
98987
|
+
request['uri'] = uri;
|
|
98988
|
+
}
|
|
98989
|
+
const token = (0,_base_functions_rsa_js__WEBPACK_IMPORTED_MODULE_4__/* .jwt */ .F)(request, this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .J, false, { 'kid': this.apiKey, 'nonce': nonce, 'alg': 'ES256' });
|
|
98990
|
+
return token;
|
|
98991
|
+
}
|
|
98964
98992
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
98965
98993
|
const version = api[0];
|
|
98966
98994
|
const signed = api[1] === 'private';
|
|
@@ -99010,25 +99038,26 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
99010
99038
|
if (this.apiKey.startsWith('-----BEGIN')) {
|
|
99011
99039
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' apiKey should contain the name (eg: organizations/3b910e93....) and not the public key');
|
|
99012
99040
|
}
|
|
99013
|
-
// it may not work for v2
|
|
99014
|
-
let uri = method + ' ' + url.replace('https://', '');
|
|
99015
|
-
const quesPos = uri.indexOf('?');
|
|
99016
|
-
// Due to we use mb_strpos, quesPos could be false in php. In that case, the quesPos >= 0 is true
|
|
99017
|
-
// Also it's not possible that the question mark is first character, only check > 0 here.
|
|
99018
|
-
if (quesPos > 0) {
|
|
99019
|
-
|
|
99020
|
-
}
|
|
99021
|
-
const nonce = this.randomBytes(16);
|
|
99022
|
-
const request = {
|
|
99023
|
-
|
|
99024
|
-
|
|
99025
|
-
|
|
99026
|
-
|
|
99027
|
-
|
|
99028
|
-
|
|
99029
|
-
|
|
99030
|
-
};
|
|
99031
|
-
const token =
|
|
99041
|
+
// // it may not work for v2
|
|
99042
|
+
// let uri = method + ' ' + url.replace ('https://', '');
|
|
99043
|
+
// const quesPos = uri.indexOf ('?');
|
|
99044
|
+
// // Due to we use mb_strpos, quesPos could be false in php. In that case, the quesPos >= 0 is true
|
|
99045
|
+
// // Also it's not possible that the question mark is first character, only check > 0 here.
|
|
99046
|
+
// if (quesPos > 0) {
|
|
99047
|
+
// uri = uri.slice (0, quesPos);
|
|
99048
|
+
// }
|
|
99049
|
+
// const nonce = this.randomBytes (16);
|
|
99050
|
+
// const request = {
|
|
99051
|
+
// 'aud': [ 'retail_rest_api_proxy' ],
|
|
99052
|
+
// 'iss': 'coinbase-cloud',
|
|
99053
|
+
// 'nbf': seconds,
|
|
99054
|
+
// 'exp': seconds + 120,
|
|
99055
|
+
// 'sub': this.apiKey,
|
|
99056
|
+
// 'uri': uri,
|
|
99057
|
+
// 'iat': seconds,
|
|
99058
|
+
// };
|
|
99059
|
+
const token = this.createAuthToken(seconds, method, url);
|
|
99060
|
+
// const token = jwt (request, this.encode (this.secret), sha256, false, { 'kid': this.apiKey, 'nonce': nonce, 'alg': 'ES256' });
|
|
99032
99061
|
authorizationString = 'Bearer ' + token;
|
|
99033
99062
|
}
|
|
99034
99063
|
else {
|
|
@@ -172228,9 +172257,10 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172228
172257
|
// }
|
|
172229
172258
|
//
|
|
172230
172259
|
const description = this.safeDict(order, 'descr', {});
|
|
172260
|
+
const orderDescriptionObj = this.safeDict(order, 'descr'); // can be null
|
|
172231
172261
|
let orderDescription = undefined;
|
|
172232
|
-
if (
|
|
172233
|
-
orderDescription = this.safeString(
|
|
172262
|
+
if (orderDescriptionObj !== undefined) {
|
|
172263
|
+
orderDescription = this.safeString(orderDescriptionObj, 'order');
|
|
172234
172264
|
}
|
|
172235
172265
|
else {
|
|
172236
172266
|
orderDescription = this.safeString(order, 'descr');
|
|
@@ -172305,8 +172335,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
172305
172335
|
}
|
|
172306
172336
|
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
172307
172337
|
let id = this.safeString2(order, 'id', 'txid');
|
|
172308
|
-
if ((id === undefined) || (id.
|
|
172309
|
-
const txid = this.
|
|
172338
|
+
if ((id === undefined) || (id.startsWith('['))) {
|
|
172339
|
+
const txid = this.safeList(order, 'txid');
|
|
172310
172340
|
id = this.safeString(txid, 0);
|
|
172311
172341
|
}
|
|
172312
172342
|
const clientOrderId = this.safeString(order, 'userref');
|
|
@@ -248913,8 +248943,8 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
248913
248943
|
/* harmony export */ Z: () => (/* binding */ coinbase)
|
|
248914
248944
|
/* harmony export */ });
|
|
248915
248945
|
/* harmony import */ var _coinbase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(437);
|
|
248916
|
-
/* harmony import */ var
|
|
248917
|
-
/* harmony import */ var
|
|
248946
|
+
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
|
|
248947
|
+
/* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3020);
|
|
248918
248948
|
/* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1372);
|
|
248919
248949
|
// ---------------------------------------------------------------------------
|
|
248920
248950
|
|
|
@@ -248990,15 +249020,36 @@ class coinbase extends _coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
248990
249020
|
}
|
|
248991
249021
|
const url = this.urls['api']['ws'];
|
|
248992
249022
|
const timestamp = this.numberToString(this.seconds());
|
|
249023
|
+
const isCloudAPiKey = (this.apiKey.indexOf('organizations/') >= 0) || (this.secret.startsWith('-----BEGIN'));
|
|
248993
249024
|
const auth = timestamp + name + productIds.join(',');
|
|
248994
249025
|
const subscribe = {
|
|
248995
249026
|
'type': 'subscribe',
|
|
248996
249027
|
'product_ids': productIds,
|
|
248997
249028
|
'channel': name,
|
|
248998
|
-
'api_key': this.apiKey,
|
|
248999
|
-
'timestamp': timestamp,
|
|
249000
|
-
'signature': this.hmac(this.encode(auth), this.encode(this.secret),
|
|
249029
|
+
// 'api_key': this.apiKey,
|
|
249030
|
+
// 'timestamp': timestamp,
|
|
249031
|
+
// 'signature': this.hmac (this.encode (auth), this.encode (this.secret), sha256),
|
|
249001
249032
|
};
|
|
249033
|
+
if (!isCloudAPiKey) {
|
|
249034
|
+
subscribe['api_key'] = this.apiKey;
|
|
249035
|
+
subscribe['timestamp'] = timestamp;
|
|
249036
|
+
subscribe['signature'] = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_1__/* .sha256 */ .J);
|
|
249037
|
+
}
|
|
249038
|
+
else {
|
|
249039
|
+
if (this.apiKey.startsWith('-----BEGIN')) {
|
|
249040
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' apiKey should contain the name (eg: organizations/3b910e93....) and not the public key');
|
|
249041
|
+
}
|
|
249042
|
+
const currentToken = this.safeString(this.options, 'wsToken');
|
|
249043
|
+
const tokenTimestamp = this.safeInteger(this.options, 'wsTokenTimestamp', 0);
|
|
249044
|
+
const seconds = this.seconds();
|
|
249045
|
+
if (currentToken === undefined || tokenTimestamp + 120 < seconds) {
|
|
249046
|
+
// we should generate new token
|
|
249047
|
+
const token = this.createAuthToken(seconds);
|
|
249048
|
+
this.options['wsToken'] = token;
|
|
249049
|
+
this.options['wsTokenTimestamp'] = seconds;
|
|
249050
|
+
}
|
|
249051
|
+
subscribe['jwt'] = this.safeString(this.options, 'wsToken');
|
|
249052
|
+
}
|
|
249002
249053
|
return await this.watch(url, messageHash, subscribe, messageHash);
|
|
249003
249054
|
}
|
|
249004
249055
|
async watchTicker(symbol, params = {}) {
|
|
@@ -249270,7 +249321,7 @@ class coinbase extends _coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
249270
249321
|
let tradesArray = this.safeValue(this.trades, symbol);
|
|
249271
249322
|
if (tradesArray === undefined) {
|
|
249272
249323
|
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
249273
|
-
tradesArray = new
|
|
249324
|
+
tradesArray = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCacheBySymbolById */ .hl(tradesLimit);
|
|
249274
249325
|
this.trades[symbol] = tradesArray;
|
|
249275
249326
|
}
|
|
249276
249327
|
for (let i = 0; i < events.length; i++) {
|
|
@@ -249320,7 +249371,7 @@ class coinbase extends _coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
249320
249371
|
const marketIds = [];
|
|
249321
249372
|
if (this.orders === undefined) {
|
|
249322
249373
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
249323
|
-
this.orders = new
|
|
249374
|
+
this.orders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
249324
249375
|
}
|
|
249325
249376
|
for (let i = 0; i < events.length; i++) {
|
|
249326
249377
|
const event = events[i];
|
|
@@ -249500,7 +249551,7 @@ class coinbase extends _coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
249500
249551
|
const type = this.safeString(message, 'type');
|
|
249501
249552
|
if (type === 'error') {
|
|
249502
249553
|
const errorMessage = this.safeString(message, 'message');
|
|
249503
|
-
throw new
|
|
249554
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(errorMessage);
|
|
249504
249555
|
}
|
|
249505
249556
|
const method = this.safeValue(methods, channel);
|
|
249506
249557
|
method.call(this, client, message);
|
|
@@ -326840,7 +326891,7 @@ SOFTWARE.
|
|
|
326840
326891
|
|
|
326841
326892
|
//-----------------------------------------------------------------------------
|
|
326842
326893
|
// this is updated by vss.js when building
|
|
326843
|
-
const version = '4.2.
|
|
326894
|
+
const version = '4.2.99';
|
|
326844
326895
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
326845
326896
|
//-----------------------------------------------------------------------------
|
|
326846
326897
|
|