ccxt 4.0.65 → 4.0.66
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 +6 -6
- package/dist/ccxt.browser.js +189 -79
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitget.js +113 -59
- package/dist/cjs/src/hitbtc.js +25 -8
- 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 +113 -59
- package/js/src/hitbtc.js +25 -8
- 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
|
@@ -211,20 +211,20 @@ console.log(version, Object.keys(exchanges));
|
|
|
211
211
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
212
212
|
|
|
213
213
|
<<<<<<< HEAD
|
|
214
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
215
|
-
* unpkg: https://unpkg.com/ccxt@4.0.
|
|
214
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.66/dist/ccxt.browser.js
|
|
215
|
+
* unpkg: https://unpkg.com/ccxt@4.0.66/dist/ccxt.browser.js
|
|
216
216
|
=======
|
|
217
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
218
|
-
* unpkg: https://unpkg.com/ccxt@4.0.
|
|
217
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.66/dist/ccxt.browser.js
|
|
218
|
+
* unpkg: https://unpkg.com/ccxt@4.0.66/dist/ccxt.browser.js
|
|
219
219
|
>>>>>>> e74b18a3a8a8cbcfe45ce4c1d32b9c03d4fae41c
|
|
220
220
|
|
|
221
221
|
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
222
|
|
|
223
223
|
```HTML
|
|
224
224
|
<<<<<<< HEAD
|
|
225
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
225
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.66/dist/ccxt.browser.js"></script>
|
|
226
226
|
=======
|
|
227
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
227
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.66/dist/ccxt.browser.js"></script>
|
|
228
228
|
>>>>>>> e74b18a3a8a8cbcfe45ce4c1d32b9c03d4fae41c
|
|
229
229
|
```
|
|
230
230
|
|
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
|
|
@@ -39312,35 +39364,37 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39312
39364
|
}
|
|
39313
39365
|
}
|
|
39314
39366
|
const options = this.safeValue(this.options, 'fetchOHLCV', {});
|
|
39315
|
-
|
|
39316
|
-
const extended = this.extend(request, ommitted);
|
|
39367
|
+
params = this.omit(params, ['until', 'till']);
|
|
39317
39368
|
let response = undefined;
|
|
39318
39369
|
if (market['spot']) {
|
|
39319
39370
|
const spotOptions = this.safeValue(options, 'spot', {});
|
|
39320
|
-
const defaultSpotMethod = this.safeString(
|
|
39321
|
-
const method = this.safeString(
|
|
39371
|
+
const defaultSpotMethod = this.safeString(spotOptions, 'method', 'publicSpotGetMarketCandles');
|
|
39372
|
+
const method = this.safeString(params, 'method', defaultSpotMethod);
|
|
39373
|
+
params = this.omit(params, 'method');
|
|
39322
39374
|
if (method === 'publicSpotGetMarketCandles') {
|
|
39323
|
-
response = await this.publicSpotGetMarketCandles(
|
|
39375
|
+
response = await this.publicSpotGetMarketCandles(this.extend(request, params));
|
|
39324
39376
|
}
|
|
39325
39377
|
else if (method === 'publicSpotGetMarketHistoryCandles') {
|
|
39326
|
-
response = await this.publicSpotGetMarketHistoryCandles(
|
|
39378
|
+
response = await this.publicSpotGetMarketHistoryCandles(this.extend(request, params));
|
|
39327
39379
|
}
|
|
39328
39380
|
}
|
|
39329
39381
|
else {
|
|
39330
39382
|
const swapOptions = this.safeValue(options, 'swap', {});
|
|
39331
|
-
const defaultSwapMethod = this.safeString(
|
|
39332
|
-
const swapMethod = this.safeString(
|
|
39333
|
-
|
|
39334
|
-
|
|
39383
|
+
const defaultSwapMethod = this.safeString(swapOptions, 'method', 'publicMixGetMarketCandles');
|
|
39384
|
+
const swapMethod = this.safeString(params, 'method', defaultSwapMethod);
|
|
39385
|
+
const priceType = this.safeString(params, 'price');
|
|
39386
|
+
params = this.omit(params, ['method', 'price']);
|
|
39387
|
+
if ((priceType === 'mark') || (swapMethod === 'publicMixGetMarketHistoryMarkCandles')) {
|
|
39388
|
+
response = await this.publicMixGetMarketHistoryMarkCandles(this.extend(request, params));
|
|
39335
39389
|
}
|
|
39336
|
-
else if (swapMethod === '
|
|
39337
|
-
response = await this.
|
|
39390
|
+
else if ((priceType === 'index') || (swapMethod === 'publicMixGetMarketHistoryIndexCandles')) {
|
|
39391
|
+
response = await this.publicMixGetMarketHistoryIndexCandles(this.extend(request, params));
|
|
39338
39392
|
}
|
|
39339
|
-
else if (swapMethod === '
|
|
39340
|
-
response = await this.
|
|
39393
|
+
else if (swapMethod === 'publicMixGetMarketCandles') {
|
|
39394
|
+
response = await this.publicMixGetMarketCandles(this.extend(request, params));
|
|
39341
39395
|
}
|
|
39342
|
-
else if (swapMethod === '
|
|
39343
|
-
response = await this.
|
|
39396
|
+
else if (swapMethod === 'publicMixGetMarketHistoryCandles') {
|
|
39397
|
+
response = await this.publicMixGetMarketHistoryCandles(this.extend(request, params));
|
|
39344
39398
|
}
|
|
39345
39399
|
}
|
|
39346
39400
|
// [ ["1645911960000","39406","39407","39374.5","39379","35.526","1399132.341"] ]
|
|
@@ -124643,6 +124697,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124643
124697
|
* @method
|
|
124644
124698
|
* @name hitbtc#createOrder
|
|
124645
124699
|
* @description create a trade order
|
|
124700
|
+
* @see https://api.hitbtc.com/#create-new-spot-order
|
|
124701
|
+
* @see https://api.hitbtc.com/#create-margin-order
|
|
124702
|
+
* @see https://api.hitbtc.com/#create-futures-order
|
|
124646
124703
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
124647
124704
|
* @param {string} type 'market' or 'limit'
|
|
124648
124705
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -124651,10 +124708,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124651
124708
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
124652
124709
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
|
|
124653
124710
|
* @param {bool} [params.margin] true for creating a margin order
|
|
124711
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
124654
124712
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
124655
124713
|
*/
|
|
124656
124714
|
await this.loadMarkets();
|
|
124657
124715
|
const market = this.market(symbol);
|
|
124716
|
+
const isLimit = (type === 'limit');
|
|
124658
124717
|
const request = {
|
|
124659
124718
|
'type': type,
|
|
124660
124719
|
'side': side,
|
|
@@ -124682,25 +124741,30 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124682
124741
|
request['reduce_only'] = reduceOnly;
|
|
124683
124742
|
}
|
|
124684
124743
|
const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force');
|
|
124685
|
-
const
|
|
124686
|
-
|
|
124687
|
-
if ((type === 'limit') || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
|
|
124744
|
+
const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
|
|
124745
|
+
if (isLimit || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
|
|
124688
124746
|
if (price === undefined) {
|
|
124689
124747
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires a price argument for limit orders');
|
|
124690
124748
|
}
|
|
124691
124749
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
124692
124750
|
}
|
|
124693
124751
|
if ((timeInForce === 'GTD')) {
|
|
124752
|
+
const expireTime = this.safeString(params, 'expire_time');
|
|
124694
124753
|
if (expireTime === undefined) {
|
|
124695
124754
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires an expire_time parameter for a GTD order');
|
|
124696
124755
|
}
|
|
124697
|
-
request['expire_time'] = expireTime;
|
|
124698
124756
|
}
|
|
124699
|
-
if (
|
|
124700
|
-
|
|
124701
|
-
|
|
124757
|
+
if (triggerPrice !== undefined) {
|
|
124758
|
+
request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
124759
|
+
if (isLimit) {
|
|
124760
|
+
request['type'] = 'stopLimit';
|
|
124761
|
+
}
|
|
124762
|
+
else if (type === 'market') {
|
|
124763
|
+
request['type'] = 'stopMarket';
|
|
124702
124764
|
}
|
|
124703
|
-
|
|
124765
|
+
}
|
|
124766
|
+
else if ((type === 'stopLimit') || (type === 'stopMarket') || (type === 'takeProfitLimit') || (type === 'takeProfitMarket')) {
|
|
124767
|
+
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
124768
|
}
|
|
124705
124769
|
let marketType = undefined;
|
|
124706
124770
|
[marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
|
|
@@ -124713,6 +124777,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124713
124777
|
if (marginMode !== undefined) {
|
|
124714
124778
|
method = 'privatePostMarginOrder';
|
|
124715
124779
|
}
|
|
124780
|
+
params = this.omit(params, ['triggerPrice', 'timeInForce', 'time_in_force', 'stopPrice', 'stop_price', 'reduceOnly']);
|
|
124716
124781
|
const response = await this[method](this.extend(request, query));
|
|
124717
124782
|
return this.parseOrder(response, market);
|
|
124718
124783
|
}
|
|
@@ -124817,6 +124882,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124817
124882
|
const postOnly = this.safeValue(order, 'post_only');
|
|
124818
124883
|
const timeInForce = this.safeString(order, 'time_in_force');
|
|
124819
124884
|
const rawTrades = this.safeValue(order, 'trades');
|
|
124885
|
+
const stopPrice = this.safeString(order, 'stop_price');
|
|
124820
124886
|
return this.safeOrder({
|
|
124821
124887
|
'info': order,
|
|
124822
124888
|
'id': id,
|
|
@@ -124824,6 +124890,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124824
124890
|
'timestamp': timestamp,
|
|
124825
124891
|
'datetime': this.iso8601(timestamp),
|
|
124826
124892
|
'lastTradeTimestamp': lastTradeTimestamp,
|
|
124893
|
+
'lastUpdateTimestamp': lastTradeTimestamp,
|
|
124827
124894
|
'symbol': symbol,
|
|
124828
124895
|
'price': price,
|
|
124829
124896
|
'amount': amount,
|
|
@@ -124839,6 +124906,10 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
124839
124906
|
'average': average,
|
|
124840
124907
|
'trades': rawTrades,
|
|
124841
124908
|
'fee': undefined,
|
|
124909
|
+
'stopPrice': stopPrice,
|
|
124910
|
+
'triggerPrice': stopPrice,
|
|
124911
|
+
'takeProfitPrice': undefined,
|
|
124912
|
+
'stopLossPrice': undefined,
|
|
124842
124913
|
}, market);
|
|
124843
124914
|
}
|
|
124844
124915
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
@@ -250641,13 +250712,19 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250641
250712
|
*/
|
|
250642
250713
|
await this.loadMarkets();
|
|
250643
250714
|
const market = this.market(symbol);
|
|
250644
|
-
const request = {
|
|
250645
|
-
'symbol': market['baseId'] + market['quoteId'],
|
|
250646
|
-
};
|
|
250715
|
+
const request = {};
|
|
250647
250716
|
if (limit !== undefined) {
|
|
250648
250717
|
request['limit'] = limit; // default 100, max 5000, see https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#order-book
|
|
250649
250718
|
}
|
|
250650
|
-
|
|
250719
|
+
let response = undefined;
|
|
250720
|
+
if (market['quote'] === 'USDT') {
|
|
250721
|
+
request['symbol'] = market['baseId'] + market['quoteId'];
|
|
250722
|
+
response = await this.binanceGetDepth(this.extend(request, params));
|
|
250723
|
+
}
|
|
250724
|
+
else {
|
|
250725
|
+
request['symbol'] = market['id'];
|
|
250726
|
+
response = await this.publicGetOpenV1MarketDepth(this.extend(request, params));
|
|
250727
|
+
}
|
|
250651
250728
|
//
|
|
250652
250729
|
// future
|
|
250653
250730
|
//
|
|
@@ -250666,9 +250743,21 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250666
250743
|
// ["2493.71","12.054"],
|
|
250667
250744
|
// ]
|
|
250668
250745
|
// }
|
|
250669
|
-
|
|
250670
|
-
|
|
250671
|
-
|
|
250746
|
+
// type not 1
|
|
250747
|
+
// {
|
|
250748
|
+
// "code":0,
|
|
250749
|
+
// "msg":"Success",
|
|
250750
|
+
// "data":{
|
|
250751
|
+
// "lastUpdateId":3204783,
|
|
250752
|
+
// "bids":[],
|
|
250753
|
+
// "asks": []
|
|
250754
|
+
// },
|
|
250755
|
+
// "timestamp":1692262634599
|
|
250756
|
+
// }
|
|
250757
|
+
const data = this.safeValue(response, 'data', response);
|
|
250758
|
+
const timestamp = this.safeInteger2(response, 'T', 'timestamp');
|
|
250759
|
+
const orderbook = this.parseOrderBook(data, symbol, timestamp);
|
|
250760
|
+
orderbook['nonce'] = this.safeInteger(data, 'lastUpdateId');
|
|
250672
250761
|
return orderbook;
|
|
250673
250762
|
}
|
|
250674
250763
|
parseTrade(trade, market = undefined) {
|
|
@@ -250834,12 +250923,20 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250834
250923
|
await this.loadMarkets();
|
|
250835
250924
|
const market = this.market(symbol);
|
|
250836
250925
|
const request = {
|
|
250837
|
-
'symbol': market
|
|
250926
|
+
'symbol': this.getMarketIdByType(market),
|
|
250838
250927
|
// 'fromId': 123, // ID to get aggregate trades from INCLUSIVE.
|
|
250839
250928
|
// 'startTime': 456, // Timestamp in ms to get aggregate trades from INCLUSIVE.
|
|
250840
250929
|
// 'endTime': 789, // Timestamp in ms to get aggregate trades until INCLUSIVE.
|
|
250841
250930
|
// 'limit': 500, // default = 500, maximum = 1000
|
|
250842
250931
|
};
|
|
250932
|
+
if (market['quote'] !== 'USDT') {
|
|
250933
|
+
if (limit !== undefined) {
|
|
250934
|
+
request['limit'] = limit;
|
|
250935
|
+
}
|
|
250936
|
+
const responseInner = this.publicGetOpenV1MarketTrades(this.extend(request, params));
|
|
250937
|
+
const data = this.safeValue(responseInner, 'data', {});
|
|
250938
|
+
return this.parseTrades(data, market, since, limit);
|
|
250939
|
+
}
|
|
250843
250940
|
const defaultMethod = 'binanceGetTrades';
|
|
250844
250941
|
const method = this.safeString(this.options, 'fetchTradesMethod', defaultMethod);
|
|
250845
250942
|
if ((method === 'binanceGetAggTrades') && (since !== undefined)) {
|
|
@@ -250993,6 +251090,12 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
250993
251090
|
const response = await this[method](params);
|
|
250994
251091
|
return this.parseTickers(response, symbols);
|
|
250995
251092
|
}
|
|
251093
|
+
getMarketIdByType(market) {
|
|
251094
|
+
if (market['quote'] === 'USDT') {
|
|
251095
|
+
return market['baseId'] + market['quoteId'];
|
|
251096
|
+
}
|
|
251097
|
+
return market['id'];
|
|
251098
|
+
}
|
|
250996
251099
|
async fetchTicker(symbol, params = {}) {
|
|
250997
251100
|
/**
|
|
250998
251101
|
* @method
|
|
@@ -251106,7 +251209,7 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
251106
251209
|
request['pair'] = market['id']; // Index price takes this argument instead of symbol
|
|
251107
251210
|
}
|
|
251108
251211
|
else {
|
|
251109
|
-
request['symbol'] = market
|
|
251212
|
+
request['symbol'] = this.getMarketIdByType(market);
|
|
251110
251213
|
}
|
|
251111
251214
|
// const duration = this.parseTimeframe (timeframe);
|
|
251112
251215
|
if (since !== undefined) {
|
|
@@ -251115,7 +251218,13 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
251115
251218
|
if (until !== undefined) {
|
|
251116
251219
|
request['endTime'] = until;
|
|
251117
251220
|
}
|
|
251118
|
-
|
|
251221
|
+
let response = undefined;
|
|
251222
|
+
if (market['quote'] === 'USDT') {
|
|
251223
|
+
response = await this.binanceGetKlines(this.extend(request, params));
|
|
251224
|
+
}
|
|
251225
|
+
else {
|
|
251226
|
+
response = await this.publicGetOpenV1MarketKlines(this.extend(request, params));
|
|
251227
|
+
}
|
|
251119
251228
|
//
|
|
251120
251229
|
// [
|
|
251121
251230
|
// [1591478520000,"0.02501300","0.02501800","0.02500000","0.02500000","22.19000000",1591478579999,"0.55490906",40,"10.92900000","0.27336462","0"],
|
|
@@ -251123,7 +251232,8 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
251123
251232
|
// [1591478640000,"0.02500800","0.02501100","0.02500300","0.02500800","154.14200000",1591478699999,"3.85405839",97,"5.32300000","0.13312641","0"],
|
|
251124
251233
|
// ]
|
|
251125
251234
|
//
|
|
251126
|
-
|
|
251235
|
+
const data = this.safeValue(response, 'data', response);
|
|
251236
|
+
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
251127
251237
|
}
|
|
251128
251238
|
async fetchBalance(params = {}) {
|
|
251129
251239
|
/**
|
|
@@ -272108,7 +272218,7 @@ SOFTWARE.
|
|
|
272108
272218
|
|
|
272109
272219
|
//-----------------------------------------------------------------------------
|
|
272110
272220
|
// this is updated by vss.js when building
|
|
272111
|
-
const version = '4.0.
|
|
272221
|
+
const version = '4.0.66';
|
|
272112
272222
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
272113
272223
|
//-----------------------------------------------------------------------------
|
|
272114
272224
|
|