ccxt 4.2.35 → 4.2.36
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 +419 -165
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -3
- package/dist/cjs/src/base/ws/Client.js +5 -2
- package/dist/cjs/src/binance.js +281 -83
- package/dist/cjs/src/bitfinex.js +21 -0
- package/dist/cjs/src/bitget.js +28 -39
- package/dist/cjs/src/bithumb.js +14 -0
- package/dist/cjs/src/pro/binance.js +2 -2
- package/dist/cjs/src/woo.js +64 -35
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -3
- package/js/src/base/ws/Client.js +5 -2
- package/js/src/binance.js +281 -83
- package/js/src/bitfinex.js +21 -0
- package/js/src/bitget.js +28 -39
- package/js/src/bithumb.js +14 -0
- package/js/src/pro/binance.js +2 -2
- package/js/src/woo.js +64 -35
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -8080,9 +8080,9 @@ class Exchange {
|
|
|
8080
8080
|
}
|
|
8081
8081
|
handleMessage(client, message) { } // stub to override
|
|
8082
8082
|
// ping (client) {} // stub to override
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8083
|
+
ping(client) {
|
|
8084
|
+
return undefined;
|
|
8085
|
+
}
|
|
8086
8086
|
client(url) {
|
|
8087
8087
|
this.clients = this.clients || {};
|
|
8088
8088
|
if (!this.clients[url]) {
|
|
@@ -14964,9 +14964,12 @@ class Client {
|
|
|
14964
14964
|
this.onError(new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout('Connection to ' + this.url + ' timed out due to a ping-pong keepalive missing on time'));
|
|
14965
14965
|
}
|
|
14966
14966
|
else {
|
|
14967
|
+
let message;
|
|
14967
14968
|
if (this.ping) {
|
|
14968
|
-
this.
|
|
14969
|
-
|
|
14969
|
+
message = this.ping(this);
|
|
14970
|
+
}
|
|
14971
|
+
if (message) {
|
|
14972
|
+
this.send(message).catch((error) => {
|
|
14970
14973
|
this.onError(error);
|
|
14971
14974
|
});
|
|
14972
14975
|
}
|
|
@@ -22688,7 +22691,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22688
22691
|
}
|
|
22689
22692
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
22690
22693
|
}
|
|
22691
|
-
if (timeInForceIsRequired) {
|
|
22694
|
+
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined)) {
|
|
22692
22695
|
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
22693
22696
|
}
|
|
22694
22697
|
if (stopPriceIsRequired) {
|
|
@@ -22993,18 +22996,128 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22993
22996
|
// "lastTrade": {"id":"69","time":"1676084430567","price":"24.9","qty":"1.00"},
|
|
22994
22997
|
// "mmp": false
|
|
22995
22998
|
// }
|
|
22996
|
-
//
|
|
22999
|
+
//
|
|
22997
23000
|
// cancelOrders/createOrders
|
|
22998
|
-
//
|
|
22999
|
-
//
|
|
23000
|
-
//
|
|
23001
|
+
//
|
|
23002
|
+
// {
|
|
23003
|
+
// "code": -4005,
|
|
23004
|
+
// "msg": "Quantity greater than max quantity."
|
|
23005
|
+
// }
|
|
23006
|
+
//
|
|
23007
|
+
// createOrder: portfolio margin linear swap and future
|
|
23008
|
+
//
|
|
23009
|
+
// {
|
|
23010
|
+
// "symbol": "BTCUSDT",
|
|
23011
|
+
// "side": "BUY",
|
|
23012
|
+
// "executedQty": "0.000",
|
|
23013
|
+
// "orderId": 258649539704,
|
|
23014
|
+
// "goodTillDate": 0,
|
|
23015
|
+
// "avgPrice": "0",
|
|
23016
|
+
// "origQty": "0.010",
|
|
23017
|
+
// "clientOrderId": "x-xcKtGhcu02573c6f15e544e990057b",
|
|
23018
|
+
// "positionSide": "BOTH",
|
|
23019
|
+
// "cumQty": "0.000",
|
|
23020
|
+
// "updateTime": 1707110415436,
|
|
23021
|
+
// "type": "LIMIT",
|
|
23022
|
+
// "reduceOnly": false,
|
|
23023
|
+
// "price": "35000.00",
|
|
23024
|
+
// "cumQuote": "0.00000",
|
|
23025
|
+
// "selfTradePreventionMode": "NONE",
|
|
23026
|
+
// "timeInForce": "GTC",
|
|
23027
|
+
// "status": "NEW"
|
|
23028
|
+
// }
|
|
23029
|
+
//
|
|
23030
|
+
// createOrder: portfolio margin inverse swap and future
|
|
23031
|
+
//
|
|
23032
|
+
// {
|
|
23033
|
+
// "symbol": "ETHUSD_PERP",
|
|
23034
|
+
// "side": "BUY",
|
|
23035
|
+
// "cumBase": "0",
|
|
23036
|
+
// "executedQty": "0",
|
|
23037
|
+
// "orderId": 71275227732,
|
|
23038
|
+
// "avgPrice": "0.00",
|
|
23039
|
+
// "origQty": "1",
|
|
23040
|
+
// "clientOrderId": "x-xcKtGhcuca5af3acfb5044198c5398",
|
|
23041
|
+
// "positionSide": "BOTH",
|
|
23042
|
+
// "cumQty": "0",
|
|
23043
|
+
// "updateTime": 1707110994334,
|
|
23044
|
+
// "type": "LIMIT",
|
|
23045
|
+
// "pair": "ETHUSD",
|
|
23046
|
+
// "reduceOnly": false,
|
|
23047
|
+
// "price": "2000",
|
|
23048
|
+
// "timeInForce": "GTC",
|
|
23049
|
+
// "status": "NEW"
|
|
23050
|
+
// }
|
|
23051
|
+
//
|
|
23052
|
+
// createOrder: portfolio margin linear swap and future conditional
|
|
23053
|
+
//
|
|
23054
|
+
// {
|
|
23055
|
+
// "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
|
|
23056
|
+
// "strategyId": 3645916,
|
|
23057
|
+
// "strategyStatus": "NEW",
|
|
23058
|
+
// "strategyType": "STOP",
|
|
23059
|
+
// "origQty": "0.010",
|
|
23060
|
+
// "price": "35000.00",
|
|
23061
|
+
// "reduceOnly": false,
|
|
23062
|
+
// "side": "BUY",
|
|
23063
|
+
// "positionSide": "BOTH",
|
|
23064
|
+
// "stopPrice": "45000.00",
|
|
23065
|
+
// "symbol": "BTCUSDT",
|
|
23066
|
+
// "timeInForce": "GTC",
|
|
23067
|
+
// "bookTime": 1707112625879,
|
|
23068
|
+
// "updateTime": 1707112625879,
|
|
23069
|
+
// "workingType": "CONTRACT_PRICE",
|
|
23070
|
+
// "priceProtect": false,
|
|
23071
|
+
// "goodTillDate": 0,
|
|
23072
|
+
// "selfTradePreventionMode": "NONE"
|
|
23073
|
+
// }
|
|
23074
|
+
//
|
|
23075
|
+
// createOrder: portfolio margin inverse swap and future conditional
|
|
23076
|
+
//
|
|
23077
|
+
// {
|
|
23078
|
+
// "newClientStrategyId": "x-xcKtGhcuc6b86f053bb34933850739",
|
|
23079
|
+
// "strategyId": 1423462,
|
|
23080
|
+
// "strategyStatus": "NEW",
|
|
23081
|
+
// "strategyType": "STOP",
|
|
23082
|
+
// "origQty": "1",
|
|
23083
|
+
// "price": "2000",
|
|
23084
|
+
// "reduceOnly": false,
|
|
23085
|
+
// "side": "BUY",
|
|
23086
|
+
// "positionSide": "BOTH",
|
|
23087
|
+
// "stopPrice": "3000",
|
|
23088
|
+
// "symbol": "ETHUSD_PERP",
|
|
23089
|
+
// "timeInForce": "GTC",
|
|
23090
|
+
// "bookTime": 1707113098840,
|
|
23091
|
+
// "updateTime": 1707113098840,
|
|
23092
|
+
// "workingType": "CONTRACT_PRICE",
|
|
23093
|
+
// "priceProtect": false
|
|
23094
|
+
// }
|
|
23095
|
+
//
|
|
23096
|
+
// createOrder: portfolio margin spot margin
|
|
23097
|
+
//
|
|
23098
|
+
// {
|
|
23099
|
+
// "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
|
|
23100
|
+
// "cummulativeQuoteQty": "0.00000000",
|
|
23101
|
+
// "executedQty": "0.00000000",
|
|
23102
|
+
// "fills": [],
|
|
23103
|
+
// "orderId": 24684460474,
|
|
23104
|
+
// "origQty": "0.00100000",
|
|
23105
|
+
// "price": "35000.00000000",
|
|
23106
|
+
// "selfTradePreventionMode": "EXPIRE_MAKER",
|
|
23107
|
+
// "side": "BUY",
|
|
23108
|
+
// "status": "NEW",
|
|
23109
|
+
// "symbol": "BTCUSDT",
|
|
23110
|
+
// "timeInForce": "GTC",
|
|
23111
|
+
// "transactTime": 1707113538870,
|
|
23112
|
+
// "type": "LIMIT"
|
|
23113
|
+
// }
|
|
23001
23114
|
//
|
|
23002
23115
|
const code = this.safeString(order, 'code');
|
|
23003
23116
|
if (code !== undefined) {
|
|
23004
23117
|
// cancelOrders/createOrders might have a partial success
|
|
23005
23118
|
return this.safeOrder({ 'info': order, 'status': 'rejected' }, market);
|
|
23006
23119
|
}
|
|
23007
|
-
const status = this.parseOrderStatus(this.
|
|
23120
|
+
const status = this.parseOrderStatus(this.safeString2(order, 'status', 'strategyStatus'));
|
|
23008
23121
|
const marketId = this.safeString(order, 'symbol');
|
|
23009
23122
|
const marketType = ('closePosition' in order) ? 'contract' : 'spot';
|
|
23010
23123
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
@@ -23031,11 +23144,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23031
23144
|
// Note this is not the actual cost, since Binance futures uses leverage to calculate margins.
|
|
23032
23145
|
let cost = this.safeString2(order, 'cummulativeQuoteQty', 'cumQuote');
|
|
23033
23146
|
cost = this.safeString(order, 'cumBase', cost);
|
|
23034
|
-
const id = this.safeString(order, 'orderId');
|
|
23035
23147
|
let type = this.safeStringLower(order, 'type');
|
|
23036
23148
|
const side = this.safeStringLower(order, 'side');
|
|
23037
23149
|
const fills = this.safeValue(order, 'fills', []);
|
|
23038
|
-
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
23039
23150
|
let timeInForce = this.safeString(order, 'timeInForce');
|
|
23040
23151
|
if (timeInForce === 'GTX') {
|
|
23041
23152
|
// GTX means "Good Till Crossing" and is an equivalent way of saying Post Only
|
|
@@ -23058,8 +23169,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23058
23169
|
}
|
|
23059
23170
|
return this.safeOrder({
|
|
23060
23171
|
'info': order,
|
|
23061
|
-
'id':
|
|
23062
|
-
'clientOrderId': clientOrderId,
|
|
23172
|
+
'id': this.safeString2(order, 'orderId', 'strategyId'),
|
|
23173
|
+
'clientOrderId': this.safeString2(order, 'clientOrderId', 'newClientStrategyId'),
|
|
23063
23174
|
'timestamp': timestamp,
|
|
23064
23175
|
'datetime': this.iso8601(timestamp),
|
|
23065
23176
|
'lastTradeTimestamp': lastTradeTimestamp,
|
|
@@ -23173,50 +23284,105 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23173
23284
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#new-order-trade
|
|
23174
23285
|
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-using-sor-trade
|
|
23175
23286
|
* @see https://binance-docs.github.io/apidocs/spot/en/#test-new-order-using-sor-trade
|
|
23287
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-um-order-trade
|
|
23288
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-cm-order-trade
|
|
23289
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-margin-order-trade
|
|
23290
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-um-conditional-order-trade
|
|
23291
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-cm-conditional-order-trade
|
|
23176
23292
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
23177
23293
|
* @param {string} type 'market' or 'limit' or 'STOP_LOSS' or 'STOP_LOSS_LIMIT' or 'TAKE_PROFIT' or 'TAKE_PROFIT_LIMIT' or 'STOP'
|
|
23178
23294
|
* @param {string} side 'buy' or 'sell'
|
|
23179
|
-
* @param {float} amount how much of
|
|
23180
|
-
* @param {float} [price] the price
|
|
23295
|
+
* @param {float} amount how much of you want to trade in units of the base currency
|
|
23296
|
+
* @param {float} [price] the price that the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
23181
23297
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23298
|
+
* @param {string} [params.reduceOnly] for swap and future reduceOnly is a string 'true' or 'false' that cant be sent with close position set to true or in hedge mode. For spot margin and option reduceOnly is a boolean.
|
|
23182
23299
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
23183
23300
|
* @param {boolean} [params.sor] *spot only* whether to use SOR (Smart Order Routing) or not, default is false
|
|
23184
23301
|
* @param {boolean} [params.test] *spot only* whether to use the test endpoint or not, default is false
|
|
23185
23302
|
* @param {float} [params.trailingPercent] the percent to trail away from the current market price
|
|
23186
23303
|
* @param {float} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
23304
|
+
* @param {float} [params.triggerPrice] the price that a trigger order is triggered at
|
|
23305
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
23306
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
23307
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
|
|
23187
23308
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
23188
23309
|
*/
|
|
23189
23310
|
await this.loadMarkets();
|
|
23190
23311
|
const market = this.market(symbol);
|
|
23191
23312
|
const marketType = this.safeString(params, 'type', market['type']);
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23313
|
+
let marginMode = undefined;
|
|
23314
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
23315
|
+
let isPortfolioMargin = undefined;
|
|
23316
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'createOrder', 'papi', 'portfolioMargin', false);
|
|
23317
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
23318
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
23319
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
23320
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23321
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23322
|
+
const isStopLoss = stopLossPrice !== undefined;
|
|
23323
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23324
|
+
const isConditional = (triggerPrice !== undefined) || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
23325
|
+
const sor = this.safeBool2(params, 'sor', 'SOR', false);
|
|
23326
|
+
const test = this.safeBool(params, 'test', false);
|
|
23327
|
+
params = this.omit(params, ['sor', 'SOR', 'test']);
|
|
23328
|
+
if (isPortfolioMargin) {
|
|
23329
|
+
params['portfolioMargin'] = isPortfolioMargin;
|
|
23330
|
+
}
|
|
23195
23331
|
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
23196
|
-
let
|
|
23197
|
-
if (
|
|
23198
|
-
|
|
23332
|
+
let response = undefined;
|
|
23333
|
+
if (market['option']) {
|
|
23334
|
+
response = await this.eapiPrivatePostOrder(request);
|
|
23335
|
+
}
|
|
23336
|
+
else if (sor) {
|
|
23337
|
+
if (test) {
|
|
23338
|
+
response = await this.privatePostSorOrderTest(request);
|
|
23339
|
+
}
|
|
23340
|
+
else {
|
|
23341
|
+
response = await this.privatePostSorOrder(request);
|
|
23342
|
+
}
|
|
23199
23343
|
}
|
|
23200
23344
|
else if (market['linear']) {
|
|
23201
|
-
|
|
23345
|
+
if (isPortfolioMargin) {
|
|
23346
|
+
if (isConditional) {
|
|
23347
|
+
response = await this.papiPostUmConditionalOrder(request);
|
|
23348
|
+
}
|
|
23349
|
+
else {
|
|
23350
|
+
response = await this.papiPostUmOrder(request);
|
|
23351
|
+
}
|
|
23352
|
+
}
|
|
23353
|
+
else {
|
|
23354
|
+
response = await this.fapiPrivatePostOrder(request);
|
|
23355
|
+
}
|
|
23202
23356
|
}
|
|
23203
23357
|
else if (market['inverse']) {
|
|
23204
|
-
|
|
23358
|
+
if (isPortfolioMargin) {
|
|
23359
|
+
if (isConditional) {
|
|
23360
|
+
response = await this.papiPostCmConditionalOrder(request);
|
|
23361
|
+
}
|
|
23362
|
+
else {
|
|
23363
|
+
response = await this.papiPostCmOrder(request);
|
|
23364
|
+
}
|
|
23365
|
+
}
|
|
23366
|
+
else {
|
|
23367
|
+
response = await this.dapiPrivatePostOrder(request);
|
|
23368
|
+
}
|
|
23205
23369
|
}
|
|
23206
23370
|
else if (marketType === 'margin' || marginMode !== undefined) {
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
|
|
23210
|
-
|
|
23371
|
+
if (isPortfolioMargin) {
|
|
23372
|
+
response = await this.papiPostMarginOrder(request);
|
|
23373
|
+
}
|
|
23374
|
+
else {
|
|
23375
|
+
response = await this.sapiPostMarginOrder(request);
|
|
23376
|
+
}
|
|
23211
23377
|
}
|
|
23212
|
-
|
|
23213
|
-
if (market['spot'] || marketType === 'margin') {
|
|
23214
|
-
const test = this.safeBool(query, 'test', false);
|
|
23378
|
+
else {
|
|
23215
23379
|
if (test) {
|
|
23216
|
-
|
|
23380
|
+
response = await this.privatePostOrderTest(request);
|
|
23381
|
+
}
|
|
23382
|
+
else {
|
|
23383
|
+
response = await this.privatePostOrder(request);
|
|
23217
23384
|
}
|
|
23218
23385
|
}
|
|
23219
|
-
const response = await this[method](request);
|
|
23220
23386
|
return this.parseOrder(response, market);
|
|
23221
23387
|
}
|
|
23222
23388
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -23224,16 +23390,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23224
23390
|
* @method
|
|
23225
23391
|
* @ignore
|
|
23226
23392
|
* @name binance#createOrderRequest
|
|
23227
|
-
* @description helper function to build request
|
|
23393
|
+
* @description helper function to build the request
|
|
23228
23394
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
23229
|
-
* @param {string} type 'market' or 'limit'
|
|
23395
|
+
* @param {string} type 'market' or 'limit'
|
|
23230
23396
|
* @param {string} side 'buy' or 'sell'
|
|
23231
|
-
* @param {float} amount how much
|
|
23232
|
-
* @param {float
|
|
23233
|
-
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
23234
|
-
* @param {string|undefined} params.marginMode 'cross' or 'isolated', for spot margin trading
|
|
23235
|
-
* @param {float} [params.trailingPercent] the percent to trail away from the current market price
|
|
23236
|
-
* @param {float} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
23397
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
23398
|
+
* @param {float} [price] the price that the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
23399
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23237
23400
|
* @returns {object} request to be sent to the exchange
|
|
23238
23401
|
*/
|
|
23239
23402
|
const market = this.market(symbol);
|
|
@@ -23242,35 +23405,54 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23242
23405
|
const initialUppercaseType = type.toUpperCase();
|
|
23243
23406
|
const isMarketOrder = initialUppercaseType === 'MARKET';
|
|
23244
23407
|
const isLimitOrder = initialUppercaseType === 'LIMIT';
|
|
23245
|
-
const postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
|
|
23246
|
-
const triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
23247
|
-
const stopLossPrice = this.safeValue(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
23248
|
-
const takeProfitPrice = this.safeValue(params, 'takeProfitPrice');
|
|
23249
|
-
const trailingDelta = this.safeValue(params, 'trailingDelta');
|
|
23250
|
-
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
|
|
23251
|
-
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23252
|
-
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23253
|
-
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
23254
|
-
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23255
|
-
params = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent']);
|
|
23256
|
-
const [marginMode, query] = this.handleMarginModeAndParams('createOrder', params);
|
|
23257
23408
|
const request = {
|
|
23258
23409
|
'symbol': market['id'],
|
|
23259
23410
|
'side': side.toUpperCase(),
|
|
23260
23411
|
};
|
|
23261
|
-
|
|
23262
|
-
|
|
23263
|
-
|
|
23264
|
-
|
|
23412
|
+
let isPortfolioMargin = undefined;
|
|
23413
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'createOrder', 'papi', 'portfolioMargin', false);
|
|
23414
|
+
let marginMode = undefined;
|
|
23415
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
23416
|
+
if ((marketType === 'margin') || (marginMode !== undefined) || market['option']) {
|
|
23417
|
+
// for swap and future reduceOnly is a string that cant be sent with close position set to true or in hedge mode
|
|
23418
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
23419
|
+
params = this.omit(params, 'reduceOnly');
|
|
23420
|
+
if (market['option']) {
|
|
23421
|
+
request['reduceOnly'] = reduceOnly;
|
|
23422
|
+
}
|
|
23423
|
+
else {
|
|
23424
|
+
if (reduceOnly) {
|
|
23425
|
+
request['sideEffectType'] = 'AUTO_REPAY';
|
|
23426
|
+
}
|
|
23265
23427
|
}
|
|
23266
23428
|
}
|
|
23267
|
-
if (
|
|
23268
|
-
const
|
|
23269
|
-
if (
|
|
23270
|
-
|
|
23271
|
-
|
|
23429
|
+
if (!isPortfolioMargin) {
|
|
23430
|
+
const postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
|
|
23431
|
+
if (market['spot'] || marketType === 'margin') {
|
|
23432
|
+
// only supported for spot/margin api (all margin markets are spot markets)
|
|
23433
|
+
if (postOnly) {
|
|
23434
|
+
type = 'LIMIT_MAKER';
|
|
23435
|
+
}
|
|
23436
|
+
if (marginMode === 'isolated') {
|
|
23437
|
+
request['isIsolated'] = true;
|
|
23438
|
+
}
|
|
23439
|
+
}
|
|
23440
|
+
if (market['contract'] && postOnly) {
|
|
23441
|
+
request['timeInForce'] = 'GTX';
|
|
23272
23442
|
}
|
|
23273
23443
|
}
|
|
23444
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
23445
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
23446
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
23447
|
+
const trailingDelta = this.safeString(params, 'trailingDelta');
|
|
23448
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
|
|
23449
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23450
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23451
|
+
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
23452
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23453
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
23454
|
+
const isConditional = isTriggerOrder || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
23455
|
+
const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
|
|
23274
23456
|
let uppercaseType = type.toUpperCase();
|
|
23275
23457
|
let stopPrice = undefined;
|
|
23276
23458
|
if (isTrailingPercentOrder) {
|
|
@@ -23300,24 +23482,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23300
23482
|
uppercaseType = market['contract'] ? 'TAKE_PROFIT' : 'TAKE_PROFIT_LIMIT';
|
|
23301
23483
|
}
|
|
23302
23484
|
}
|
|
23303
|
-
if (marginMode === 'isolated') {
|
|
23304
|
-
request['isIsolated'] = true;
|
|
23305
|
-
}
|
|
23306
|
-
if (clientOrderId === undefined) {
|
|
23307
|
-
const broker = this.safeValue(this.options, 'broker', {});
|
|
23308
|
-
const defaultId = (market['contract']) ? 'x-xcKtGhcu' : 'x-R4BD3S82';
|
|
23309
|
-
const brokerId = this.safeString(broker, marketType, defaultId);
|
|
23310
|
-
request['newClientOrderId'] = brokerId + this.uuid22();
|
|
23311
|
-
}
|
|
23312
|
-
else {
|
|
23313
|
-
request['newClientOrderId'] = clientOrderId;
|
|
23314
|
-
}
|
|
23315
23485
|
if ((marketType === 'spot') || (marketType === 'margin')) {
|
|
23316
|
-
request['newOrderRespType'] = this.
|
|
23486
|
+
request['newOrderRespType'] = this.safeString(this.options['newOrderRespType'], type, 'RESULT'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
|
|
23317
23487
|
}
|
|
23318
23488
|
else {
|
|
23319
23489
|
// swap, futures and options
|
|
23320
|
-
|
|
23490
|
+
if (!isPortfolioMargin) {
|
|
23491
|
+
request['newOrderRespType'] = 'RESULT'; // "ACK", "RESULT", default "ACK"
|
|
23492
|
+
}
|
|
23321
23493
|
}
|
|
23322
23494
|
if (market['option']) {
|
|
23323
23495
|
if (type === 'market') {
|
|
@@ -23325,7 +23497,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23325
23497
|
}
|
|
23326
23498
|
}
|
|
23327
23499
|
else {
|
|
23328
|
-
const validOrderTypes = this.
|
|
23500
|
+
const validOrderTypes = this.safeList(market['info'], 'orderTypes');
|
|
23329
23501
|
if (!this.inArray(uppercaseType, validOrderTypes)) {
|
|
23330
23502
|
if (initialUppercaseType !== uppercaseType) {
|
|
23331
23503
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' stopPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
|
|
@@ -23335,7 +23507,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23335
23507
|
}
|
|
23336
23508
|
}
|
|
23337
23509
|
}
|
|
23338
|
-
|
|
23510
|
+
const clientOrderIdRequest = isPortfolioMarginConditional ? 'newClientStrategyId' : 'newClientOrderId';
|
|
23511
|
+
if (clientOrderId === undefined) {
|
|
23512
|
+
const broker = this.safeDict(this.options, 'broker', {});
|
|
23513
|
+
const defaultId = (market['contract']) ? 'x-xcKtGhcu' : 'x-R4BD3S82';
|
|
23514
|
+
const brokerId = this.safeString(broker, marketType, defaultId);
|
|
23515
|
+
request[clientOrderIdRequest] = brokerId + this.uuid22();
|
|
23516
|
+
}
|
|
23517
|
+
else {
|
|
23518
|
+
request[clientOrderIdRequest] = clientOrderId;
|
|
23519
|
+
}
|
|
23520
|
+
const typeRequest = isPortfolioMarginConditional ? 'strategyType' : 'type';
|
|
23521
|
+
request[typeRequest] = uppercaseType;
|
|
23339
23522
|
// additional required fields depending on the order type
|
|
23340
23523
|
let timeInForceIsRequired = false;
|
|
23341
23524
|
let priceIsRequired = false;
|
|
@@ -23363,9 +23546,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23363
23546
|
//
|
|
23364
23547
|
if (uppercaseType === 'MARKET') {
|
|
23365
23548
|
if (market['spot']) {
|
|
23366
|
-
const quoteOrderQty = this.
|
|
23549
|
+
const quoteOrderQty = this.safeBool(this.options, 'quoteOrderQty', true);
|
|
23367
23550
|
if (quoteOrderQty) {
|
|
23368
|
-
const quoteOrderQtyNew = this.
|
|
23551
|
+
const quoteOrderQtyNew = this.safeString2(params, 'quoteOrderQty', 'cost');
|
|
23369
23552
|
const precision = market['precision']['price'];
|
|
23370
23553
|
if (quoteOrderQtyNew !== undefined) {
|
|
23371
23554
|
request['quoteOrderQty'] = this.decimalToPrecision(quoteOrderQtyNew, _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TRUNCATE */ .tk, precision, this.precisionMode);
|
|
@@ -23416,7 +23599,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23416
23599
|
priceIsRequired = true;
|
|
23417
23600
|
}
|
|
23418
23601
|
else if ((uppercaseType === 'STOP_MARKET') || (uppercaseType === 'TAKE_PROFIT_MARKET')) {
|
|
23419
|
-
const closePosition = this.
|
|
23602
|
+
const closePosition = this.safeBool(params, 'closePosition');
|
|
23420
23603
|
if (closePosition === undefined) {
|
|
23421
23604
|
quantityIsRequired = true;
|
|
23422
23605
|
}
|
|
@@ -23429,7 +23612,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23429
23612
|
}
|
|
23430
23613
|
}
|
|
23431
23614
|
if (quantityIsRequired) {
|
|
23432
|
-
|
|
23615
|
+
// portfolio margin has a different amount precision
|
|
23616
|
+
if (isPortfolioMargin) {
|
|
23617
|
+
request['quantity'] = this.parseToNumeric(amount);
|
|
23618
|
+
}
|
|
23619
|
+
else {
|
|
23620
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
23621
|
+
}
|
|
23433
23622
|
}
|
|
23434
23623
|
if (priceIsRequired) {
|
|
23435
23624
|
if (price === undefined) {
|
|
@@ -23440,9 +23629,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23440
23629
|
if (timeInForceIsRequired) {
|
|
23441
23630
|
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
23442
23631
|
}
|
|
23443
|
-
if (market['contract'] && postOnly) {
|
|
23444
|
-
request['timeInForce'] = 'GTX';
|
|
23445
|
-
}
|
|
23446
23632
|
if (stopPriceIsRequired) {
|
|
23447
23633
|
if (market['contract']) {
|
|
23448
23634
|
if (stopPrice === undefined) {
|
|
@@ -23459,11 +23645,26 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23459
23645
|
request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
|
|
23460
23646
|
}
|
|
23461
23647
|
}
|
|
23648
|
+
if (!isPortfolioMargin) {
|
|
23649
|
+
const postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
|
|
23650
|
+
if (market['spot'] || marketType === 'margin') {
|
|
23651
|
+
// only supported for spot/margin api (all margin markets are spot markets)
|
|
23652
|
+
if (postOnly) {
|
|
23653
|
+
type = 'LIMIT_MAKER';
|
|
23654
|
+
}
|
|
23655
|
+
if (marginMode === 'isolated') {
|
|
23656
|
+
request['isIsolated'] = true;
|
|
23657
|
+
}
|
|
23658
|
+
}
|
|
23659
|
+
if (market['contract'] && postOnly) {
|
|
23660
|
+
request['timeInForce'] = 'GTX';
|
|
23661
|
+
}
|
|
23662
|
+
}
|
|
23462
23663
|
// remove timeInForce from params because PO is only used by this.isPostOnly and it's not a valid value for Binance
|
|
23463
23664
|
if (this.safeString(params, 'timeInForce') === 'PO') {
|
|
23464
|
-
params = this.omit(params,
|
|
23665
|
+
params = this.omit(params, 'timeInForce');
|
|
23465
23666
|
}
|
|
23466
|
-
const requestParams = this.omit(params, ['
|
|
23667
|
+
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test']);
|
|
23467
23668
|
return this.extend(request, requestParams);
|
|
23468
23669
|
}
|
|
23469
23670
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
@@ -36511,6 +36712,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36511
36712
|
* @method
|
|
36512
36713
|
* @name bitfinex#fetchTradingFees
|
|
36513
36714
|
* @description fetch the trading fees for multiple markets
|
|
36715
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-summary
|
|
36514
36716
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36515
36717
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
36516
36718
|
*/
|
|
@@ -36593,6 +36795,8 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36593
36795
|
* @method
|
|
36594
36796
|
* @name bitfinex#fetchMarkets
|
|
36595
36797
|
* @description retrieves data on all markets for bitfinex
|
|
36798
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-symbols
|
|
36799
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-symbol-details
|
|
36596
36800
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36597
36801
|
* @returns {object[]} an array of objects representing market data
|
|
36598
36802
|
*/
|
|
@@ -36717,6 +36921,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36717
36921
|
* @method
|
|
36718
36922
|
* @name bitfinex#fetchBalance
|
|
36719
36923
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
36924
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-wallet-balances
|
|
36720
36925
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36721
36926
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
36722
36927
|
*/
|
|
@@ -36774,6 +36979,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36774
36979
|
* @method
|
|
36775
36980
|
* @name bitfinex#transfer
|
|
36776
36981
|
* @description transfer currency internally between wallets on the same account
|
|
36982
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-transfer-between-wallets
|
|
36777
36983
|
* @param {string} code unified currency code
|
|
36778
36984
|
* @param {float} amount amount to transfer
|
|
36779
36985
|
* @param {string} fromAccount account to transfer from
|
|
@@ -36859,6 +37065,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36859
37065
|
* @method
|
|
36860
37066
|
* @name bitfinex#fetchOrderBook
|
|
36861
37067
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
37068
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-orderbook
|
|
36862
37069
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
36863
37070
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
36864
37071
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -36901,6 +37108,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36901
37108
|
* @method
|
|
36902
37109
|
* @name bitfinex#fetchTicker
|
|
36903
37110
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
37111
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-ticker
|
|
36904
37112
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
36905
37113
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36906
37114
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -37017,6 +37225,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37017
37225
|
* @method
|
|
37018
37226
|
* @name bitfinex#fetchTrades
|
|
37019
37227
|
* @description get the list of most recent trades for a particular symbol
|
|
37228
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-trades
|
|
37020
37229
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
37021
37230
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
37022
37231
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -37052,6 +37261,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37052
37261
|
* @method
|
|
37053
37262
|
* @name bitfinex#fetchMyTrades
|
|
37054
37263
|
* @description fetch all trades made by the user
|
|
37264
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-past-trades
|
|
37055
37265
|
* @param {string} symbol unified market symbol
|
|
37056
37266
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
37057
37267
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -37080,6 +37290,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37080
37290
|
* @method
|
|
37081
37291
|
* @name bitfinex#createOrder
|
|
37082
37292
|
* @description create a trade order
|
|
37293
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-new-order
|
|
37083
37294
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
37084
37295
|
* @param {string} type 'market' or 'limit'
|
|
37085
37296
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -37147,6 +37358,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37147
37358
|
* @method
|
|
37148
37359
|
* @name bitfinex#cancelOrder
|
|
37149
37360
|
* @description cancels an open order
|
|
37361
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-cancel-order
|
|
37150
37362
|
* @param {string} id order id
|
|
37151
37363
|
* @param {string} symbol not used by bitfinex cancelOrder ()
|
|
37152
37364
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -37163,6 +37375,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37163
37375
|
* @method
|
|
37164
37376
|
* @name bitfinex#cancelAllOrders
|
|
37165
37377
|
* @description cancel all open orders
|
|
37378
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-cancel-all-orders
|
|
37166
37379
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
37167
37380
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37168
37381
|
* @returns {object} response from exchange
|
|
@@ -37247,6 +37460,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37247
37460
|
* @method
|
|
37248
37461
|
* @name bitfinex#fetchOpenOrders
|
|
37249
37462
|
* @description fetch all unfilled currently open orders
|
|
37463
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-active-orders
|
|
37250
37464
|
* @param {string} symbol unified market symbol
|
|
37251
37465
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
37252
37466
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -37271,6 +37485,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37271
37485
|
* @method
|
|
37272
37486
|
* @name bitfinex#fetchClosedOrders
|
|
37273
37487
|
* @description fetches information on multiple closed orders made by the user
|
|
37488
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-orders-history
|
|
37274
37489
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
37275
37490
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
37276
37491
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -37296,6 +37511,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37296
37511
|
* @method
|
|
37297
37512
|
* @name bitfinex#fetchOrder
|
|
37298
37513
|
* @description fetches information on an order made by the user
|
|
37514
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-order-status
|
|
37299
37515
|
* @param {string} symbol not used by bitfinex fetchOrder
|
|
37300
37516
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37301
37517
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -37332,6 +37548,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37332
37548
|
* @method
|
|
37333
37549
|
* @name bitfinex#fetchOHLCV
|
|
37334
37550
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
37551
|
+
* @see https://docs.bitfinex.com/reference/rest-public-candles#aggregate-funding-currency-candles
|
|
37335
37552
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
37336
37553
|
* @param {string} timeframe the length of time each candle represents
|
|
37337
37554
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -37376,6 +37593,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37376
37593
|
* @method
|
|
37377
37594
|
* @name bitfinex#createDepositAddress
|
|
37378
37595
|
* @description create a currency deposit address
|
|
37596
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-deposit
|
|
37379
37597
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
37380
37598
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37381
37599
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -37391,6 +37609,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37391
37609
|
* @method
|
|
37392
37610
|
* @name bitfinex#fetchDepositAddress
|
|
37393
37611
|
* @description fetch the deposit address for a currency associated with this account
|
|
37612
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-deposit
|
|
37394
37613
|
* @param {string} code unified currency code
|
|
37395
37614
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37396
37615
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -37424,6 +37643,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37424
37643
|
* @method
|
|
37425
37644
|
* @name bitfinex#fetchDepositsWithdrawals
|
|
37426
37645
|
* @description fetch history of deposits and withdrawals
|
|
37646
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-deposit-withdrawal-history
|
|
37427
37647
|
* @param {string} code unified currency code for the currency of the deposit/withdrawals
|
|
37428
37648
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
37429
37649
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -37560,6 +37780,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37560
37780
|
* @method
|
|
37561
37781
|
* @name bitfinex#withdraw
|
|
37562
37782
|
* @description make a withdrawal
|
|
37783
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-withdrawal
|
|
37563
37784
|
* @param {string} code unified currency code
|
|
37564
37785
|
* @param {float} amount the amount to withdraw
|
|
37565
37786
|
* @param {string} address the address to withdraw to
|
|
@@ -37610,6 +37831,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37610
37831
|
* @method
|
|
37611
37832
|
* @name bitfinex#fetchPositions
|
|
37612
37833
|
* @description fetch all open positions
|
|
37834
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-active-positions
|
|
37613
37835
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
37614
37836
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37615
37837
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -46638,6 +46860,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
46638
46860
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
46639
46861
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
46640
46862
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
46863
|
+
* @param {string} [params.price] *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles)
|
|
46641
46864
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
46642
46865
|
*/
|
|
46643
46866
|
await this.loadMarkets();
|
|
@@ -46667,68 +46890,56 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
46667
46890
|
if (limit !== undefined) {
|
|
46668
46891
|
request['limit'] = limit;
|
|
46669
46892
|
}
|
|
46670
|
-
|
|
46671
|
-
|
|
46672
|
-
|
|
46673
|
-
|
|
46674
|
-
|
|
46675
|
-
|
|
46676
|
-
if (since !== undefined) {
|
|
46677
|
-
request['startTime'] = since;
|
|
46678
|
-
}
|
|
46679
|
-
if (until !== undefined) {
|
|
46680
|
-
request['endTime'] = until;
|
|
46893
|
+
if (since !== undefined) {
|
|
46894
|
+
request['startTime'] = since;
|
|
46895
|
+
}
|
|
46896
|
+
if (since !== undefined) {
|
|
46897
|
+
if (limit === undefined) {
|
|
46898
|
+
limit = 100; // exchange default
|
|
46681
46899
|
}
|
|
46900
|
+
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
46901
|
+
request['endTime'] = this.sum(since, duration * (limit + 1)) - 1; // limit + 1)) - 1 is needed for when since is not the exact timestamp of a candle
|
|
46902
|
+
}
|
|
46903
|
+
else if (until !== undefined) {
|
|
46904
|
+
request['endTime'] = until;
|
|
46905
|
+
}
|
|
46906
|
+
else {
|
|
46907
|
+
request['endTime'] = this.milliseconds();
|
|
46682
46908
|
}
|
|
46683
46909
|
let response = undefined;
|
|
46910
|
+
const thirtyOneDaysAgo = this.milliseconds() - 2678400000;
|
|
46684
46911
|
if (market['spot']) {
|
|
46685
|
-
if (
|
|
46686
|
-
response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
|
|
46687
|
-
}
|
|
46688
|
-
else if (method === 'publicSpotGetV2SpotMarketHistoryCandles') {
|
|
46689
|
-
if (since !== undefined) {
|
|
46690
|
-
if (limit === undefined) {
|
|
46691
|
-
limit = 100; // exchange default
|
|
46692
|
-
}
|
|
46693
|
-
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
46694
|
-
request['endTime'] = this.sum(since, duration * limit);
|
|
46695
|
-
}
|
|
46696
|
-
else if (until !== undefined) {
|
|
46697
|
-
request['endTime'] = until;
|
|
46698
|
-
}
|
|
46699
|
-
else {
|
|
46700
|
-
request['endTime'] = this.milliseconds();
|
|
46701
|
-
}
|
|
46912
|
+
if ((since !== undefined) && (since < thirtyOneDaysAgo)) {
|
|
46702
46913
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
46703
46914
|
}
|
|
46915
|
+
else {
|
|
46916
|
+
response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
|
|
46917
|
+
}
|
|
46704
46918
|
}
|
|
46705
46919
|
else {
|
|
46706
|
-
const swapOptions = this.safeValue(options, 'swap', {});
|
|
46707
|
-
const defaultSwapMethod = this.safeString(swapOptions, 'method', 'publicMixGetV2MixMarketCandles');
|
|
46708
|
-
const swapMethod = this.safeString(params, 'method', defaultSwapMethod);
|
|
46709
46920
|
const priceType = this.safeString(params, 'price');
|
|
46710
|
-
params = this.omit(params, ['
|
|
46921
|
+
params = this.omit(params, ['price']);
|
|
46711
46922
|
let productType = undefined;
|
|
46712
46923
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
46713
46924
|
request['productType'] = productType;
|
|
46714
|
-
if (
|
|
46925
|
+
if (priceType === 'mark') {
|
|
46715
46926
|
response = await this.publicMixGetV2MixMarketHistoryMarkCandles(this.extend(request, params));
|
|
46716
46927
|
}
|
|
46717
|
-
else if (
|
|
46928
|
+
else if (priceType === 'index') {
|
|
46718
46929
|
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(this.extend(request, params));
|
|
46719
46930
|
}
|
|
46720
|
-
else if (
|
|
46721
|
-
response = await this.publicMixGetV2MixMarketCandles(this.extend(request, params));
|
|
46722
|
-
}
|
|
46723
|
-
else if (swapMethod === 'publicMixGetV2MixMarketHistoryCandles') {
|
|
46931
|
+
else if ((since !== undefined) && (since < thirtyOneDaysAgo)) {
|
|
46724
46932
|
response = await this.publicMixGetV2MixMarketHistoryCandles(this.extend(request, params));
|
|
46725
46933
|
}
|
|
46934
|
+
else {
|
|
46935
|
+
response = await this.publicMixGetV2MixMarketCandles(this.extend(request, params));
|
|
46936
|
+
}
|
|
46726
46937
|
}
|
|
46727
46938
|
if (response === '') {
|
|
46728
46939
|
return []; // happens when a new token is listed
|
|
46729
46940
|
}
|
|
46730
46941
|
// [ ["1645911960000","39406","39407","39374.5","39379","35.526","1399132.341"] ]
|
|
46731
|
-
const data = this.
|
|
46942
|
+
const data = this.safeList(response, 'data', response);
|
|
46732
46943
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
46733
46944
|
}
|
|
46734
46945
|
async fetchBalance(params = {}) {
|
|
@@ -51885,6 +52096,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51885
52096
|
* @method
|
|
51886
52097
|
* @name bithumb#fetchMarkets
|
|
51887
52098
|
* @description retrieves data on all markets for bithumb
|
|
52099
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
51888
52100
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
51889
52101
|
* @returns {object[]} an array of objects representing market data
|
|
51890
52102
|
*/
|
|
@@ -51987,6 +52199,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51987
52199
|
* @method
|
|
51988
52200
|
* @name bithumb#fetchBalance
|
|
51989
52201
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
52202
|
+
* @see https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
|
51990
52203
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
51991
52204
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
51992
52205
|
*/
|
|
@@ -52002,6 +52215,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52002
52215
|
* @method
|
|
52003
52216
|
* @name bithumb#fetchOrderBook
|
|
52004
52217
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
52218
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
52005
52219
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
52006
52220
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
52007
52221
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -52094,6 +52308,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52094
52308
|
* @method
|
|
52095
52309
|
* @name bithumb#fetchTickers
|
|
52096
52310
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
52311
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
52097
52312
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
52098
52313
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52099
52314
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -52151,6 +52366,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52151
52366
|
* @method
|
|
52152
52367
|
* @name bithumb#fetchTicker
|
|
52153
52368
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
52369
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
52154
52370
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
52155
52371
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52156
52372
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -52209,6 +52425,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52209
52425
|
* @method
|
|
52210
52426
|
* @name bithumb#fetchOHLCV
|
|
52211
52427
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
52428
|
+
* @see https://apidocs.bithumb.com/reference/candlestick-rest-api
|
|
52212
52429
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
52213
52430
|
* @param {string} timeframe the length of time each candle represents
|
|
52214
52431
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -52333,6 +52550,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52333
52550
|
* @method
|
|
52334
52551
|
* @name bithumb#fetchTrades
|
|
52335
52552
|
* @description get the list of most recent trades for a particular symbol
|
|
52553
|
+
* @see https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
|
52336
52554
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
52337
52555
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
52338
52556
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -52371,6 +52589,9 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52371
52589
|
* @method
|
|
52372
52590
|
* @name bithumb#createOrder
|
|
52373
52591
|
* @description create a trade order
|
|
52592
|
+
* @see https://apidocs.bithumb.com/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
|
52593
|
+
* @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
|
|
52594
|
+
* @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
|
|
52374
52595
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
52375
52596
|
* @param {string} type 'market' or 'limit'
|
|
52376
52597
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -52412,6 +52633,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52412
52633
|
* @method
|
|
52413
52634
|
* @name bithumb#fetchOrder
|
|
52414
52635
|
* @description fetches information on an order made by the user
|
|
52636
|
+
* @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
|
|
52415
52637
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
52416
52638
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52417
52639
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -52570,6 +52792,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52570
52792
|
* @method
|
|
52571
52793
|
* @name bithumb#fetchOpenOrders
|
|
52572
52794
|
* @description fetch all unfilled currently open orders
|
|
52795
|
+
* @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
|
|
52573
52796
|
* @param {string} symbol unified market symbol
|
|
52574
52797
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
52575
52798
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -52618,6 +52841,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52618
52841
|
* @method
|
|
52619
52842
|
* @name bithumb#cancelOrder
|
|
52620
52843
|
* @description cancels an open order
|
|
52844
|
+
* @see https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
|
52621
52845
|
* @param {string} id order id
|
|
52622
52846
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
52623
52847
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -52653,6 +52877,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52653
52877
|
* @method
|
|
52654
52878
|
* @name bithumb#withdraw
|
|
52655
52879
|
* @description make a withdrawal
|
|
52880
|
+
* @see https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
|
|
52656
52881
|
* @param {string} code unified currency code
|
|
52657
52882
|
* @param {float} amount the amount to withdraw
|
|
52658
52883
|
* @param {string} address the address to withdraw to
|
|
@@ -214808,8 +215033,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
214808
215033
|
},
|
|
214809
215034
|
'api': {
|
|
214810
215035
|
'ws': {
|
|
214811
|
-
'spot': 'wss://stream.binance.com/ws',
|
|
214812
|
-
'margin': 'wss://stream.binance.com/ws',
|
|
215036
|
+
'spot': 'wss://stream.binance.com:9443/ws',
|
|
215037
|
+
'margin': 'wss://stream.binance.com:9443/ws',
|
|
214813
215038
|
'future': 'wss://fstream.binance.com/ws',
|
|
214814
215039
|
'delivery': 'wss://dstream.binance.com/ws',
|
|
214815
215040
|
'ws': 'wss://ws-api.binance.com:443/ws-api/v3',
|
|
@@ -290611,11 +290836,12 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
290611
290836
|
* @method
|
|
290612
290837
|
* @name woo#fetchOHLCV
|
|
290613
290838
|
* @see https://docs.woo.org/#kline-public
|
|
290839
|
+
* @see https://docs.woo.org/#kline-historical-data-public
|
|
290614
290840
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
290615
290841
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
290616
290842
|
* @param {string} timeframe the length of time each candle represents
|
|
290617
290843
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
290618
|
-
* @param {int} [limit]
|
|
290844
|
+
* @param {int} [limit] max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms)))
|
|
290619
290845
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
290620
290846
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
290621
290847
|
*/
|
|
@@ -290625,42 +290851,70 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
290625
290851
|
'symbol': market['id'],
|
|
290626
290852
|
'type': this.safeString(this.timeframes, timeframe, timeframe),
|
|
290627
290853
|
};
|
|
290628
|
-
|
|
290854
|
+
let useHistEndpoint = since !== undefined;
|
|
290855
|
+
if ((limit !== undefined) && (since !== undefined)) {
|
|
290856
|
+
const oneThousandCandles = this.parseTimeframe(timeframe) * 1000 * 999; // 999 because there will be delay between this and the request, causing the latest candle to be excluded sometimes
|
|
290857
|
+
const startWithLimit = this.milliseconds() - oneThousandCandles;
|
|
290858
|
+
useHistEndpoint = since < startWithLimit;
|
|
290859
|
+
}
|
|
290860
|
+
if (useHistEndpoint) {
|
|
290861
|
+
request['start_time'] = since;
|
|
290862
|
+
}
|
|
290863
|
+
else if (limit !== undefined) { // the hist endpoint does not accept limit
|
|
290629
290864
|
request['limit'] = Math.min(limit, 1000);
|
|
290630
290865
|
}
|
|
290631
|
-
|
|
290632
|
-
|
|
290633
|
-
|
|
290634
|
-
|
|
290635
|
-
|
|
290636
|
-
|
|
290637
|
-
|
|
290638
|
-
|
|
290639
|
-
|
|
290640
|
-
|
|
290641
|
-
|
|
290642
|
-
|
|
290643
|
-
|
|
290644
|
-
|
|
290645
|
-
|
|
290646
|
-
|
|
290647
|
-
|
|
290648
|
-
|
|
290649
|
-
|
|
290650
|
-
|
|
290651
|
-
|
|
290652
|
-
|
|
290653
|
-
|
|
290654
|
-
|
|
290655
|
-
|
|
290656
|
-
|
|
290657
|
-
|
|
290658
|
-
|
|
290659
|
-
|
|
290660
|
-
|
|
290661
|
-
|
|
290662
|
-
|
|
290663
|
-
|
|
290866
|
+
let response = undefined;
|
|
290867
|
+
if (!useHistEndpoint) {
|
|
290868
|
+
response = await this.v1PublicGetKline(this.extend(request, params));
|
|
290869
|
+
//
|
|
290870
|
+
// {
|
|
290871
|
+
// "success": true,
|
|
290872
|
+
// "rows": [
|
|
290873
|
+
// {
|
|
290874
|
+
// "open": "0.94238",
|
|
290875
|
+
// "close": "0.94271",
|
|
290876
|
+
// "low": "0.94238",
|
|
290877
|
+
// "high": "0.94296",
|
|
290878
|
+
// "volume": "73.55",
|
|
290879
|
+
// "amount": "69.32040520",
|
|
290880
|
+
// "symbol": "SPOT_WOO_USDT",
|
|
290881
|
+
// "type": "1m",
|
|
290882
|
+
// "start_timestamp": "1641584700000",
|
|
290883
|
+
// "end_timestamp": "1641584760000"
|
|
290884
|
+
// },
|
|
290885
|
+
// ...
|
|
290886
|
+
// ]
|
|
290887
|
+
// }
|
|
290888
|
+
//
|
|
290889
|
+
}
|
|
290890
|
+
else {
|
|
290891
|
+
response = await this.v1PubGetHistKline(this.extend(request, params));
|
|
290892
|
+
response = this.safeDict(response, 'data');
|
|
290893
|
+
//
|
|
290894
|
+
// {
|
|
290895
|
+
// "success": true,
|
|
290896
|
+
// "data": {
|
|
290897
|
+
// "rows": [
|
|
290898
|
+
// {
|
|
290899
|
+
// "symbol": "SPOT_BTC_USDT",
|
|
290900
|
+
// "open": 44181.40000000,
|
|
290901
|
+
// "close": 44174.29000000,
|
|
290902
|
+
// "high": 44193.44000000,
|
|
290903
|
+
// "low": 44148.34000000,
|
|
290904
|
+
// "volume": 110.11930100,
|
|
290905
|
+
// "amount": 4863796.24318878,
|
|
290906
|
+
// "type": "1m",
|
|
290907
|
+
// "start_timestamp": 1704153600000,
|
|
290908
|
+
// "end_timestamp": 1704153660000
|
|
290909
|
+
// },
|
|
290910
|
+
// ...
|
|
290911
|
+
// ]
|
|
290912
|
+
// }
|
|
290913
|
+
// }
|
|
290914
|
+
//
|
|
290915
|
+
}
|
|
290916
|
+
const rows = this.safeValue(response, 'rows', []);
|
|
290917
|
+
return this.parseOHLCVs(rows, market, timeframe, since, limit);
|
|
290664
290918
|
}
|
|
290665
290919
|
parseOHLCV(ohlcv, market = undefined) {
|
|
290666
290920
|
// example response in fetchOHLCV
|
|
@@ -301401,7 +301655,7 @@ SOFTWARE.
|
|
|
301401
301655
|
|
|
301402
301656
|
//-----------------------------------------------------------------------------
|
|
301403
301657
|
// this is updated by vss.js when building
|
|
301404
|
-
const version = '4.2.
|
|
301658
|
+
const version = '4.2.36';
|
|
301405
301659
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
301406
301660
|
//-----------------------------------------------------------------------------
|
|
301407
301661
|
|