ccxt 4.0.65 → 4.0.67
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 -12
- package/dist/ccxt.browser.js +202 -84
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitget.js +121 -60
- package/dist/cjs/src/bybit.js +2 -2
- package/dist/cjs/src/hitbtc.js +25 -8
- package/dist/cjs/src/pro/bybit.js +3 -2
- package/dist/cjs/src/tokocrypto.js +50 -11
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +121 -60
- package/js/src/bybit.js +2 -2
- package/js/src/hitbtc.js +25 -8
- package/js/src/pro/bybit.js +3 -2
- package/js/src/tokocrypto.d.ts +1 -0
- package/js/src/tokocrypto.js +50 -11
- package/package.json +1 -1
- package/skip-tests.json +1 -0
package/README.md
CHANGED
|
@@ -210,22 +210,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
210
210
|
|
|
211
211
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
*
|
|
215
|
-
* unpkg: https://unpkg.com/ccxt@4.0.65/dist/ccxt.browser.js
|
|
216
|
-
=======
|
|
217
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.65/dist/ccxt.browser.js
|
|
218
|
-
* unpkg: https://unpkg.com/ccxt@4.0.65/dist/ccxt.browser.js
|
|
219
|
-
>>>>>>> e74b18a3a8a8cbcfe45ce4c1d32b9c03d4fae41c
|
|
213
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.67/dist/ccxt.browser.js
|
|
214
|
+
* unpkg: https://unpkg.com/ccxt@4.0.67/dist/ccxt.browser.js
|
|
220
215
|
|
|
221
216
|
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.
|
|
222
217
|
|
|
223
218
|
```HTML
|
|
224
|
-
|
|
225
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.65/dist/ccxt.browser.js"></script>
|
|
226
|
-
=======
|
|
227
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.65/dist/ccxt.browser.js"></script>
|
|
228
|
-
>>>>>>> e74b18a3a8a8cbcfe45ce4c1d32b9c03d4fae41c
|
|
219
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.67/dist/ccxt.browser.js"></script>
|
|
229
220
|
```
|
|
230
221
|
|
|
231
222
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -36929,14 +36929,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
36929
36929
|
'fetchFundingRate': true,
|
|
36930
36930
|
'fetchFundingRateHistory': true,
|
|
36931
36931
|
'fetchFundingRates': false,
|
|
36932
|
-
'fetchIndexOHLCV':
|
|
36932
|
+
'fetchIndexOHLCV': true,
|
|
36933
36933
|
'fetchLedger': true,
|
|
36934
36934
|
'fetchLeverage': true,
|
|
36935
36935
|
'fetchLeverageTiers': false,
|
|
36936
36936
|
'fetchMarginMode': undefined,
|
|
36937
36937
|
'fetchMarketLeverageTiers': true,
|
|
36938
36938
|
'fetchMarkets': true,
|
|
36939
|
-
'fetchMarkOHLCV':
|
|
36939
|
+
'fetchMarkOHLCV': true,
|
|
36940
36940
|
'fetchMyTrades': true,
|
|
36941
36941
|
'fetchOHLCV': true,
|
|
36942
36942
|
'fetchOpenInterest': true,
|
|
@@ -37872,10 +37872,18 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
37872
37872
|
'spot': {
|
|
37873
37873
|
'method': 'publicSpotGetMarketCandles', // or publicSpotGetMarketHistoryCandles
|
|
37874
37874
|
},
|
|
37875
|
-
'swap
|
|
37875
|
+
'swap': {
|
|
37876
37876
|
'method': 'publicMixGetMarketCandles', // or publicMixGetMarketHistoryCandles or publicMixGetMarketHistoryIndexCandles or publicMixGetMarketHistoryMarkCandles
|
|
37877
37877
|
},
|
|
37878
37878
|
},
|
|
37879
|
+
'fetchTrades': {
|
|
37880
|
+
'spot': {
|
|
37881
|
+
'method': 'publicSpotGetMarketFillsHistory', // or publicSpotGetMarketFills
|
|
37882
|
+
},
|
|
37883
|
+
'swap': {
|
|
37884
|
+
'method': 'publicMixGetMarketFillsHistory', // or publicMixGetMarketFills
|
|
37885
|
+
},
|
|
37886
|
+
},
|
|
37879
37887
|
'accountsByType': {
|
|
37880
37888
|
'main': 'EXCHANGE',
|
|
37881
37889
|
'spot': 'EXCHANGE',
|
|
@@ -38992,23 +39000,23 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
38992
39000
|
// spot
|
|
38993
39001
|
//
|
|
38994
39002
|
// {
|
|
38995
|
-
// symbol:
|
|
38996
|
-
// tradeId:
|
|
38997
|
-
// side:
|
|
38998
|
-
// fillPrice:
|
|
38999
|
-
// fillQuantity:
|
|
39000
|
-
// fillTime:
|
|
39003
|
+
// "symbol": "BTCUSDT_SPBL",
|
|
39004
|
+
// "tradeId": "1075200479040323585",
|
|
39005
|
+
// "side": "Sell",
|
|
39006
|
+
// "fillPrice": "29381.54",
|
|
39007
|
+
// "fillQuantity": "0.0056",
|
|
39008
|
+
// "fillTime": "1692073691000"
|
|
39001
39009
|
// }
|
|
39002
39010
|
//
|
|
39003
39011
|
// swap
|
|
39004
39012
|
//
|
|
39005
39013
|
// {
|
|
39006
|
-
// tradeId:
|
|
39007
|
-
// price:
|
|
39008
|
-
// size:
|
|
39009
|
-
// side:
|
|
39010
|
-
// timestamp:
|
|
39011
|
-
// symbol:
|
|
39014
|
+
// "tradeId": "1075199767891652609",
|
|
39015
|
+
// "price": "29376.5",
|
|
39016
|
+
// "size": "6.035",
|
|
39017
|
+
// "side": "Buy",
|
|
39018
|
+
// "timestamp": "1692073521000",
|
|
39019
|
+
// "symbol": "BTCUSDT_UMCBL"
|
|
39012
39020
|
// }
|
|
39013
39021
|
//
|
|
39014
39022
|
// private
|
|
@@ -39043,17 +39051,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39043
39051
|
//
|
|
39044
39052
|
const marketId = this.safeString(trade, 'symbol');
|
|
39045
39053
|
const symbol = this.safeSymbol(marketId, market);
|
|
39046
|
-
const id = this.safeString2(trade, 'tradeId', 'fillId');
|
|
39047
|
-
const order = this.safeString(trade, 'orderId');
|
|
39048
|
-
const side = this.safeString(trade, 'side');
|
|
39049
|
-
const price = this.safeString2(trade, 'fillPrice', 'price');
|
|
39050
39054
|
let amount = this.safeString2(trade, 'fillQuantity', 'size');
|
|
39051
39055
|
amount = this.safeString(trade, 'sizeQty', amount);
|
|
39052
39056
|
let timestamp = this.safeInteger2(trade, 'fillTime', 'timestamp');
|
|
39053
39057
|
timestamp = this.safeInteger(trade, 'cTime', timestamp);
|
|
39054
39058
|
let fee = undefined;
|
|
39055
39059
|
const feeAmount = this.safeString(trade, 'fees');
|
|
39056
|
-
const type = this.safeString(trade, 'orderType');
|
|
39057
39060
|
if (feeAmount !== undefined) {
|
|
39058
39061
|
const currencyCode = this.safeCurrencyCode(this.safeString(trade, 'feeCcy'));
|
|
39059
39062
|
fee = {
|
|
@@ -39065,13 +39068,13 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39065
39068
|
const datetime = this.iso8601(timestamp);
|
|
39066
39069
|
return this.safeTrade({
|
|
39067
39070
|
'info': trade,
|
|
39068
|
-
'id':
|
|
39069
|
-
'order':
|
|
39071
|
+
'id': this.safeString2(trade, 'tradeId', 'fillId'),
|
|
39072
|
+
'order': this.safeString(trade, 'orderId'),
|
|
39070
39073
|
'symbol': symbol,
|
|
39071
|
-
'side': side,
|
|
39072
|
-
'type':
|
|
39074
|
+
'side': this.safeStringLower(trade, 'side'),
|
|
39075
|
+
'type': this.safeString(trade, 'orderType'),
|
|
39073
39076
|
'takerOrMaker': undefined,
|
|
39074
|
-
'price': price,
|
|
39077
|
+
'price': this.safeString2(trade, 'fillPrice', 'price'),
|
|
39075
39078
|
'amount': amount,
|
|
39076
39079
|
'cost': undefined,
|
|
39077
39080
|
'fee': fee,
|
|
@@ -39079,11 +39082,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39079
39082
|
'datetime': datetime,
|
|
39080
39083
|
}, market);
|
|
39081
39084
|
}
|
|
39082
|
-
async fetchTrades(symbol,
|
|
39085
|
+
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
39083
39086
|
/**
|
|
39084
39087
|
* @method
|
|
39085
39088
|
* @name bitget#fetchTrades
|
|
39086
39089
|
* @description get the list of most recent trades for a particular symbol
|
|
39090
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-market-trades
|
|
39091
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-fills
|
|
39092
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-recent-trades
|
|
39093
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-recent-fills
|
|
39087
39094
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
39088
39095
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
39089
39096
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -39098,29 +39105,70 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39098
39105
|
if (limit !== undefined) {
|
|
39099
39106
|
request['limit'] = limit;
|
|
39100
39107
|
}
|
|
39101
|
-
|
|
39108
|
+
if (since !== undefined) {
|
|
39109
|
+
request['startTime'] = since;
|
|
39110
|
+
}
|
|
39111
|
+
const options = this.safeValue(this.options, 'fetchTrades', {});
|
|
39102
39112
|
let response = undefined;
|
|
39103
39113
|
if (market['spot']) {
|
|
39104
|
-
|
|
39114
|
+
const spotOptions = this.safeValue(options, 'spot', {});
|
|
39115
|
+
const defaultSpotMethod = this.safeString(spotOptions, 'method', 'publicSpotGetMarketFillsHistory');
|
|
39116
|
+
const spotMethod = this.safeString(params, 'method', defaultSpotMethod);
|
|
39117
|
+
params = this.omit(params, 'method');
|
|
39118
|
+
if (spotMethod === 'publicSpotGetMarketFillsHistory') {
|
|
39119
|
+
response = await this.publicSpotGetMarketFillsHistory(this.extend(request, params));
|
|
39120
|
+
}
|
|
39121
|
+
else if (spotMethod === 'publicSpotGetMarketFills') {
|
|
39122
|
+
response = await this.publicSpotGetMarketFills(this.extend(request, params));
|
|
39123
|
+
}
|
|
39105
39124
|
}
|
|
39106
39125
|
else {
|
|
39107
|
-
|
|
39126
|
+
const swapOptions = this.safeValue(options, 'swap', {});
|
|
39127
|
+
const defaultSwapMethod = this.safeString(swapOptions, 'method', 'publicMixGetMarketFillsHistory');
|
|
39128
|
+
const swapMethod = this.safeString(params, 'method', defaultSwapMethod);
|
|
39129
|
+
params = this.omit(params, 'method');
|
|
39130
|
+
if (swapMethod === 'publicMixGetMarketFillsHistory') {
|
|
39131
|
+
response = await this.publicMixGetMarketFillsHistory(this.extend(request, params));
|
|
39132
|
+
}
|
|
39133
|
+
else if (swapMethod === 'publicMixGetMarketFills') {
|
|
39134
|
+
response = await this.publicMixGetMarketFills(this.extend(request, params));
|
|
39135
|
+
}
|
|
39108
39136
|
}
|
|
39109
39137
|
//
|
|
39138
|
+
// spot
|
|
39139
|
+
//
|
|
39110
39140
|
// {
|
|
39111
|
-
//
|
|
39112
|
-
//
|
|
39113
|
-
//
|
|
39114
|
-
//
|
|
39115
|
-
//
|
|
39116
|
-
//
|
|
39117
|
-
//
|
|
39118
|
-
//
|
|
39119
|
-
//
|
|
39120
|
-
//
|
|
39121
|
-
//
|
|
39122
|
-
//
|
|
39123
|
-
//
|
|
39141
|
+
// "code": "00000",
|
|
39142
|
+
// "msg": "success",
|
|
39143
|
+
// "requestTime": 1692073693562,
|
|
39144
|
+
// "data": [
|
|
39145
|
+
// {
|
|
39146
|
+
// "symbol": "BTCUSDT_SPBL",
|
|
39147
|
+
// "tradeId": "1075200479040323585",
|
|
39148
|
+
// "side": "Sell",
|
|
39149
|
+
// "fillPrice": "29381.54",
|
|
39150
|
+
// "fillQuantity": "0.0056",
|
|
39151
|
+
// "fillTime": "1692073691000"
|
|
39152
|
+
// },
|
|
39153
|
+
// ]
|
|
39154
|
+
// }
|
|
39155
|
+
//
|
|
39156
|
+
// swap
|
|
39157
|
+
//
|
|
39158
|
+
// {
|
|
39159
|
+
// "code": "00000",
|
|
39160
|
+
// "msg": "success",
|
|
39161
|
+
// "requestTime": 1692073522689,
|
|
39162
|
+
// "data": [
|
|
39163
|
+
// {
|
|
39164
|
+
// "tradeId": "1075199767891652609",
|
|
39165
|
+
// "price": "29376.5",
|
|
39166
|
+
// "size": "6.035",
|
|
39167
|
+
// "side": "Buy",
|
|
39168
|
+
// "timestamp": "1692073521000",
|
|
39169
|
+
// "symbol": "BTCUSDT_UMCBL"
|
|
39170
|
+
// },
|
|
39171
|
+
// ]
|
|
39124
39172
|
// }
|
|
39125
39173
|
//
|
|
39126
39174
|
const data = this.safeValue(response, 'data', []);
|
|
@@ -39257,8 +39305,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39257
39305
|
* @method
|
|
39258
39306
|
* @name bitget#fetchOHLCV
|
|
39259
39307
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
39308
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-candle-data
|
|
39309
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-history-candle-data
|
|
39260
39310
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-candle-data
|
|
39261
|
-
* @see https://bitgetlimited.github.io/apidoc/en/
|
|
39311
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-candle-data
|
|
39312
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-index-candle-data
|
|
39313
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-mark-candle-data
|
|
39262
39314
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
39263
39315
|
* @param {string} timeframe the length of time each candle represents
|
|
39264
39316
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -39273,8 +39325,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39273
39325
|
'symbol': market['id'],
|
|
39274
39326
|
};
|
|
39275
39327
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
39328
|
+
const limitIsUndefined = (limit === undefined);
|
|
39276
39329
|
if (limit === undefined) {
|
|
39277
|
-
limit =
|
|
39330
|
+
limit = 200;
|
|
39278
39331
|
}
|
|
39279
39332
|
request['limit'] = limit;
|
|
39280
39333
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
@@ -39312,35 +39365,43 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39312
39365
|
}
|
|
39313
39366
|
}
|
|
39314
39367
|
const options = this.safeValue(this.options, 'fetchOHLCV', {});
|
|
39315
|
-
|
|
39316
|
-
const extended = this.extend(request, ommitted);
|
|
39368
|
+
params = this.omit(params, ['until', 'till']);
|
|
39317
39369
|
let response = undefined;
|
|
39318
39370
|
if (market['spot']) {
|
|
39319
39371
|
const spotOptions = this.safeValue(options, 'spot', {});
|
|
39320
|
-
const defaultSpotMethod = this.safeString(
|
|
39321
|
-
const method = this.safeString(
|
|
39372
|
+
const defaultSpotMethod = this.safeString(spotOptions, 'method', 'publicSpotGetMarketCandles');
|
|
39373
|
+
const method = this.safeString(params, 'method', defaultSpotMethod);
|
|
39374
|
+
params = this.omit(params, 'method');
|
|
39322
39375
|
if (method === 'publicSpotGetMarketCandles') {
|
|
39323
|
-
|
|
39376
|
+
if (limitIsUndefined) {
|
|
39377
|
+
request['limit'] = 1000;
|
|
39378
|
+
}
|
|
39379
|
+
response = await this.publicSpotGetMarketCandles(this.extend(request, params));
|
|
39324
39380
|
}
|
|
39325
39381
|
else if (method === 'publicSpotGetMarketHistoryCandles') {
|
|
39326
|
-
response = await this.publicSpotGetMarketHistoryCandles(
|
|
39382
|
+
response = await this.publicSpotGetMarketHistoryCandles(this.extend(request, params));
|
|
39327
39383
|
}
|
|
39328
39384
|
}
|
|
39329
39385
|
else {
|
|
39330
39386
|
const swapOptions = this.safeValue(options, 'swap', {});
|
|
39331
|
-
const defaultSwapMethod = this.safeString(
|
|
39332
|
-
const swapMethod = this.safeString(
|
|
39333
|
-
|
|
39334
|
-
|
|
39387
|
+
const defaultSwapMethod = this.safeString(swapOptions, 'method', 'publicMixGetMarketCandles');
|
|
39388
|
+
const swapMethod = this.safeString(params, 'method', defaultSwapMethod);
|
|
39389
|
+
const priceType = this.safeString(params, 'price');
|
|
39390
|
+
params = this.omit(params, ['method', 'price']);
|
|
39391
|
+
if ((priceType === 'mark') || (swapMethod === 'publicMixGetMarketHistoryMarkCandles')) {
|
|
39392
|
+
response = await this.publicMixGetMarketHistoryMarkCandles(this.extend(request, params));
|
|
39335
39393
|
}
|
|
39336
|
-
else if (swapMethod === '
|
|
39337
|
-
response = await this.
|
|
39394
|
+
else if ((priceType === 'index') || (swapMethod === 'publicMixGetMarketHistoryIndexCandles')) {
|
|
39395
|
+
response = await this.publicMixGetMarketHistoryIndexCandles(this.extend(request, params));
|
|
39338
39396
|
}
|
|
39339
|
-
else if (swapMethod === '
|
|
39340
|
-
|
|
39397
|
+
else if (swapMethod === 'publicMixGetMarketCandles') {
|
|
39398
|
+
if (limitIsUndefined) {
|
|
39399
|
+
request['limit'] = 1000;
|
|
39400
|
+
}
|
|
39401
|
+
response = await this.publicMixGetMarketCandles(this.extend(request, params));
|
|
39341
39402
|
}
|
|
39342
|
-
else if (swapMethod === '
|
|
39343
|
-
response = await this.
|
|
39403
|
+
else if (swapMethod === 'publicMixGetMarketHistoryCandles') {
|
|
39404
|
+
response = await this.publicMixGetMarketHistoryCandles(this.extend(request, params));
|
|
39344
39405
|
}
|
|
39345
39406
|
}
|
|
39346
39407
|
// [ ["1645911960000","39406","39407","39374.5","39379","35.526","1399132.341"] ]
|
|
@@ -73053,10 +73114,10 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73053
73114
|
// "change24h": "86"
|
|
73054
73115
|
// }
|
|
73055
73116
|
//
|
|
73117
|
+
const isSpot = this.safeString(ticker, 'openInterestValue') === undefined;
|
|
73056
73118
|
const timestamp = this.safeInteger(ticker, 'time');
|
|
73057
73119
|
const marketId = this.safeString(ticker, 'symbol');
|
|
73058
|
-
const
|
|
73059
|
-
const type = this.safeString(market, 'type', defaultType);
|
|
73120
|
+
const type = isSpot ? 'spot' : 'contract';
|
|
73060
73121
|
market = this.safeMarket(marketId, market, undefined, type);
|
|
73061
73122
|
const symbol = this.safeSymbol(marketId, market, undefined, type);
|
|
73062
73123
|
const last = this.safeString(ticker, 'lastPrice');
|
|
@@ -124643,6 +124704,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124643
124704
|
* @method
|
|
124644
124705
|
* @name hitbtc#createOrder
|
|
124645
124706
|
* @description create a trade order
|
|
124707
|
+
* @see https://api.hitbtc.com/#create-new-spot-order
|
|
124708
|
+
* @see https://api.hitbtc.com/#create-margin-order
|
|
124709
|
+
* @see https://api.hitbtc.com/#create-futures-order
|
|
124646
124710
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
124647
124711
|
* @param {string} type 'market' or 'limit'
|
|
124648
124712
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -124651,10 +124715,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124651
124715
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
124652
124716
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
|
|
124653
124717
|
* @param {bool} [params.margin] true for creating a margin order
|
|
124718
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
124654
124719
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
124655
124720
|
*/
|
|
124656
124721
|
await this.loadMarkets();
|
|
124657
124722
|
const market = this.market(symbol);
|
|
124723
|
+
const isLimit = (type === 'limit');
|
|
124658
124724
|
const request = {
|
|
124659
124725
|
'type': type,
|
|
124660
124726
|
'side': side,
|
|
@@ -124682,25 +124748,30 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124682
124748
|
request['reduce_only'] = reduceOnly;
|
|
124683
124749
|
}
|
|
124684
124750
|
const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force');
|
|
124685
|
-
const
|
|
124686
|
-
|
|
124687
|
-
if ((type === 'limit') || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
|
|
124751
|
+
const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
|
|
124752
|
+
if (isLimit || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
|
|
124688
124753
|
if (price === undefined) {
|
|
124689
124754
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires a price argument for limit orders');
|
|
124690
124755
|
}
|
|
124691
124756
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
124692
124757
|
}
|
|
124693
124758
|
if ((timeInForce === 'GTD')) {
|
|
124759
|
+
const expireTime = this.safeString(params, 'expire_time');
|
|
124694
124760
|
if (expireTime === undefined) {
|
|
124695
124761
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires an expire_time parameter for a GTD order');
|
|
124696
124762
|
}
|
|
124697
|
-
request['expire_time'] = expireTime;
|
|
124698
124763
|
}
|
|
124699
|
-
if (
|
|
124700
|
-
|
|
124701
|
-
|
|
124764
|
+
if (triggerPrice !== undefined) {
|
|
124765
|
+
request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
124766
|
+
if (isLimit) {
|
|
124767
|
+
request['type'] = 'stopLimit';
|
|
124768
|
+
}
|
|
124769
|
+
else if (type === 'market') {
|
|
124770
|
+
request['type'] = 'stopMarket';
|
|
124702
124771
|
}
|
|
124703
|
-
|
|
124772
|
+
}
|
|
124773
|
+
else if ((type === 'stopLimit') || (type === 'stopMarket') || (type === 'takeProfitLimit') || (type === 'takeProfitMarket')) {
|
|
124774
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders');
|
|
124704
124775
|
}
|
|
124705
124776
|
let marketType = undefined;
|
|
124706
124777
|
[marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
|
|
@@ -124713,6 +124784,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124713
124784
|
if (marginMode !== undefined) {
|
|
124714
124785
|
method = 'privatePostMarginOrder';
|
|
124715
124786
|
}
|
|
124787
|
+
params = this.omit(params, ['triggerPrice', 'timeInForce', 'time_in_force', 'stopPrice', 'stop_price', 'reduceOnly']);
|
|
124716
124788
|
const response = await this[method](this.extend(request, query));
|
|
124717
124789
|
return this.parseOrder(response, market);
|
|
124718
124790
|
}
|
|
@@ -124817,6 +124889,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124817
124889
|
const postOnly = this.safeValue(order, 'post_only');
|
|
124818
124890
|
const timeInForce = this.safeString(order, 'time_in_force');
|
|
124819
124891
|
const rawTrades = this.safeValue(order, 'trades');
|
|
124892
|
+
const stopPrice = this.safeString(order, 'stop_price');
|
|
124820
124893
|
return this.safeOrder({
|
|
124821
124894
|
'info': order,
|
|
124822
124895
|
'id': id,
|
|
@@ -124824,6 +124897,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124824
124897
|
'timestamp': timestamp,
|
|
124825
124898
|
'datetime': this.iso8601(timestamp),
|
|
124826
124899
|
'lastTradeTimestamp': lastTradeTimestamp,
|
|
124900
|
+
'lastUpdateTimestamp': lastTradeTimestamp,
|
|
124827
124901
|
'symbol': symbol,
|
|
124828
124902
|
'price': price,
|
|
124829
124903
|
'amount': amount,
|
|
@@ -124839,6 +124913,10 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124839
124913
|
'average': average,
|
|
124840
124914
|
'trades': rawTrades,
|
|
124841
124915
|
'fee': undefined,
|
|
124916
|
+
'stopPrice': stopPrice,
|
|
124917
|
+
'triggerPrice': stopPrice,
|
|
124918
|
+
'takeProfitPrice': undefined,
|
|
124919
|
+
'stopLossPrice': undefined,
|
|
124842
124920
|
}, market);
|
|
124843
124921
|
}
|
|
124844
124922
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
@@ -206605,7 +206683,8 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
206605
206683
|
const topic = this.safeString(message, 'topic', '');
|
|
206606
206684
|
const updateType = this.safeString(message, 'type', '');
|
|
206607
206685
|
const data = this.safeValue(message, 'data', {});
|
|
206608
|
-
const isSpot = this.safeString(data, '
|
|
206686
|
+
const isSpot = this.safeString(data, 'openInterestValue') === undefined;
|
|
206687
|
+
const type = isSpot ? 'spot' : 'contract';
|
|
206609
206688
|
let symbol = undefined;
|
|
206610
206689
|
let parsed = undefined;
|
|
206611
206690
|
if ((updateType === 'snapshot') || isSpot) {
|
|
@@ -206616,7 +206695,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
206616
206695
|
const topicParts = topic.split('.');
|
|
206617
206696
|
const topicLength = topicParts.length;
|
|
206618
206697
|
const marketId = this.safeString(topicParts, topicLength - 1);
|
|
206619
|
-
const market = this.
|
|
206698
|
+
const market = this.safeMarket(marketId, undefined, undefined, type);
|
|
206620
206699
|
symbol = market['symbol'];
|
|
206621
206700
|
// update the info in place
|
|
206622
206701
|
const ticker = this.safeValue(this.tickers, symbol, {});
|
|
@@ -250641,13 +250720,19 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250641
250720
|
*/
|
|
250642
250721
|
await this.loadMarkets();
|
|
250643
250722
|
const market = this.market(symbol);
|
|
250644
|
-
const request = {
|
|
250645
|
-
'symbol': market['baseId'] + market['quoteId'],
|
|
250646
|
-
};
|
|
250723
|
+
const request = {};
|
|
250647
250724
|
if (limit !== undefined) {
|
|
250648
250725
|
request['limit'] = limit; // default 100, max 5000, see https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#order-book
|
|
250649
250726
|
}
|
|
250650
|
-
|
|
250727
|
+
let response = undefined;
|
|
250728
|
+
if (market['quote'] === 'USDT') {
|
|
250729
|
+
request['symbol'] = market['baseId'] + market['quoteId'];
|
|
250730
|
+
response = await this.binanceGetDepth(this.extend(request, params));
|
|
250731
|
+
}
|
|
250732
|
+
else {
|
|
250733
|
+
request['symbol'] = market['id'];
|
|
250734
|
+
response = await this.publicGetOpenV1MarketDepth(this.extend(request, params));
|
|
250735
|
+
}
|
|
250651
250736
|
//
|
|
250652
250737
|
// future
|
|
250653
250738
|
//
|
|
@@ -250666,9 +250751,21 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250666
250751
|
// ["2493.71","12.054"],
|
|
250667
250752
|
// ]
|
|
250668
250753
|
// }
|
|
250669
|
-
|
|
250670
|
-
|
|
250671
|
-
|
|
250754
|
+
// type not 1
|
|
250755
|
+
// {
|
|
250756
|
+
// "code":0,
|
|
250757
|
+
// "msg":"Success",
|
|
250758
|
+
// "data":{
|
|
250759
|
+
// "lastUpdateId":3204783,
|
|
250760
|
+
// "bids":[],
|
|
250761
|
+
// "asks": []
|
|
250762
|
+
// },
|
|
250763
|
+
// "timestamp":1692262634599
|
|
250764
|
+
// }
|
|
250765
|
+
const data = this.safeValue(response, 'data', response);
|
|
250766
|
+
const timestamp = this.safeInteger2(response, 'T', 'timestamp');
|
|
250767
|
+
const orderbook = this.parseOrderBook(data, symbol, timestamp);
|
|
250768
|
+
orderbook['nonce'] = this.safeInteger(data, 'lastUpdateId');
|
|
250672
250769
|
return orderbook;
|
|
250673
250770
|
}
|
|
250674
250771
|
parseTrade(trade, market = undefined) {
|
|
@@ -250834,12 +250931,20 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250834
250931
|
await this.loadMarkets();
|
|
250835
250932
|
const market = this.market(symbol);
|
|
250836
250933
|
const request = {
|
|
250837
|
-
'symbol': market
|
|
250934
|
+
'symbol': this.getMarketIdByType(market),
|
|
250838
250935
|
// 'fromId': 123, // ID to get aggregate trades from INCLUSIVE.
|
|
250839
250936
|
// 'startTime': 456, // Timestamp in ms to get aggregate trades from INCLUSIVE.
|
|
250840
250937
|
// 'endTime': 789, // Timestamp in ms to get aggregate trades until INCLUSIVE.
|
|
250841
250938
|
// 'limit': 500, // default = 500, maximum = 1000
|
|
250842
250939
|
};
|
|
250940
|
+
if (market['quote'] !== 'USDT') {
|
|
250941
|
+
if (limit !== undefined) {
|
|
250942
|
+
request['limit'] = limit;
|
|
250943
|
+
}
|
|
250944
|
+
const responseInner = this.publicGetOpenV1MarketTrades(this.extend(request, params));
|
|
250945
|
+
const data = this.safeValue(responseInner, 'data', {});
|
|
250946
|
+
return this.parseTrades(data, market, since, limit);
|
|
250947
|
+
}
|
|
250843
250948
|
const defaultMethod = 'binanceGetTrades';
|
|
250844
250949
|
const method = this.safeString(this.options, 'fetchTradesMethod', defaultMethod);
|
|
250845
250950
|
if ((method === 'binanceGetAggTrades') && (since !== undefined)) {
|
|
@@ -250993,6 +251098,12 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250993
251098
|
const response = await this[method](params);
|
|
250994
251099
|
return this.parseTickers(response, symbols);
|
|
250995
251100
|
}
|
|
251101
|
+
getMarketIdByType(market) {
|
|
251102
|
+
if (market['quote'] === 'USDT') {
|
|
251103
|
+
return market['baseId'] + market['quoteId'];
|
|
251104
|
+
}
|
|
251105
|
+
return market['id'];
|
|
251106
|
+
}
|
|
250996
251107
|
async fetchTicker(symbol, params = {}) {
|
|
250997
251108
|
/**
|
|
250998
251109
|
* @method
|
|
@@ -251106,7 +251217,7 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
251106
251217
|
request['pair'] = market['id']; // Index price takes this argument instead of symbol
|
|
251107
251218
|
}
|
|
251108
251219
|
else {
|
|
251109
|
-
request['symbol'] = market
|
|
251220
|
+
request['symbol'] = this.getMarketIdByType(market);
|
|
251110
251221
|
}
|
|
251111
251222
|
// const duration = this.parseTimeframe (timeframe);
|
|
251112
251223
|
if (since !== undefined) {
|
|
@@ -251115,7 +251226,13 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
251115
251226
|
if (until !== undefined) {
|
|
251116
251227
|
request['endTime'] = until;
|
|
251117
251228
|
}
|
|
251118
|
-
|
|
251229
|
+
let response = undefined;
|
|
251230
|
+
if (market['quote'] === 'USDT') {
|
|
251231
|
+
response = await this.binanceGetKlines(this.extend(request, params));
|
|
251232
|
+
}
|
|
251233
|
+
else {
|
|
251234
|
+
response = await this.publicGetOpenV1MarketKlines(this.extend(request, params));
|
|
251235
|
+
}
|
|
251119
251236
|
//
|
|
251120
251237
|
// [
|
|
251121
251238
|
// [1591478520000,"0.02501300","0.02501800","0.02500000","0.02500000","22.19000000",1591478579999,"0.55490906",40,"10.92900000","0.27336462","0"],
|
|
@@ -251123,7 +251240,8 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
251123
251240
|
// [1591478640000,"0.02500800","0.02501100","0.02500300","0.02500800","154.14200000",1591478699999,"3.85405839",97,"5.32300000","0.13312641","0"],
|
|
251124
251241
|
// ]
|
|
251125
251242
|
//
|
|
251126
|
-
|
|
251243
|
+
const data = this.safeValue(response, 'data', response);
|
|
251244
|
+
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
251127
251245
|
}
|
|
251128
251246
|
async fetchBalance(params = {}) {
|
|
251129
251247
|
/**
|
|
@@ -272108,7 +272226,7 @@ SOFTWARE.
|
|
|
272108
272226
|
|
|
272109
272227
|
//-----------------------------------------------------------------------------
|
|
272110
272228
|
// this is updated by vss.js when building
|
|
272111
|
-
const version = '4.0.
|
|
272229
|
+
const version = '4.0.67';
|
|
272112
272230
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
272113
272231
|
//-----------------------------------------------------------------------------
|
|
272114
272232
|
|