ccxt 4.2.78 → 4.2.79
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 +5 -5
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +241 -52
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +39 -5
- package/dist/cjs/src/bitstamp.js +21 -26
- package/dist/cjs/src/bybit.js +101 -0
- package/dist/cjs/src/coinbaseinternational.js +2 -2
- package/dist/cjs/src/gate.js +3 -1
- package/dist/cjs/src/pro/alpaca.js +1 -1
- package/dist/cjs/src/pro/bitfinex2.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bitmex.js +1 -1
- package/dist/cjs/src/pro/blockchaincom.js +1 -1
- package/dist/cjs/src/pro/bybit.js +16 -1
- package/dist/cjs/src/pro/cex.js +9 -5
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +1 -1
- package/dist/cjs/src/pro/htx.js +1 -1
- package/dist/cjs/src/pro/okcoin.js +1 -1
- package/dist/cjs/src/pro/onetrading.js +1 -1
- package/dist/cjs/src/pro/woo.js +38 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/bingx.js +39 -5
- package/js/src/bitstamp.js +21 -26
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +101 -0
- package/js/src/coinbaseinternational.js +2 -2
- package/js/src/gate.js +3 -1
- package/js/src/pro/alpaca.js +1 -1
- package/js/src/pro/bitfinex2.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bitmex.js +1 -1
- package/js/src/pro/blockchaincom.js +1 -1
- package/js/src/pro/bybit.js +16 -1
- package/js/src/pro/cex.js +9 -5
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/hitbtc.js +1 -1
- package/js/src/pro/htx.js +1 -1
- package/js/src/pro/okcoin.js +1 -1
- package/js/src/pro/onetrading.js +1 -1
- package/js/src/pro/woo.js +38 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -181,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
181
181
|
|
|
182
182
|
//-----------------------------------------------------------------------------
|
|
183
183
|
// this is updated by vss.js when building
|
|
184
|
-
const version = '4.2.
|
|
184
|
+
const version = '4.2.79';
|
|
185
185
|
Exchange["default"].ccxtVersion = version;
|
|
186
186
|
const exchanges = {
|
|
187
187
|
'ace': ace,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -182,6 +182,7 @@ class bingx extends bingx$1 {
|
|
|
182
182
|
'post': {
|
|
183
183
|
'trade/cancelReplace': 1,
|
|
184
184
|
'positionSide/dual': 1,
|
|
185
|
+
'trade/closePosition': 1,
|
|
185
186
|
},
|
|
186
187
|
},
|
|
187
188
|
},
|
|
@@ -2163,6 +2164,8 @@ class bingx extends bingx$1 {
|
|
|
2163
2164
|
'SELL': 'sell',
|
|
2164
2165
|
'SHORT': 'sell',
|
|
2165
2166
|
'LONG': 'buy',
|
|
2167
|
+
'ask': 'sell',
|
|
2168
|
+
'bid': 'buy',
|
|
2166
2169
|
};
|
|
2167
2170
|
return this.safeString(sides, side, side);
|
|
2168
2171
|
}
|
|
@@ -3910,14 +3913,45 @@ class bingx extends bingx$1 {
|
|
|
3910
3913
|
* @param {string} symbol Unified CCXT market symbol
|
|
3911
3914
|
* @param {string} [side] not used by bingx
|
|
3912
3915
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
3916
|
+
* @param {string|undefined} [params.positionId] it is recommended to fill in this parameter when closing a position
|
|
3913
3917
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3914
3918
|
*/
|
|
3915
3919
|
await this.loadMarkets();
|
|
3916
|
-
const
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3920
|
+
const positionId = this.safeString(params, 'positionId');
|
|
3921
|
+
params = this.omit(params, 'positionId');
|
|
3922
|
+
let response = undefined;
|
|
3923
|
+
if (positionId !== undefined) {
|
|
3924
|
+
const request = {
|
|
3925
|
+
'positionId': positionId,
|
|
3926
|
+
};
|
|
3927
|
+
response = await this.swapV1PrivatePostTradeClosePosition(this.extend(request, params));
|
|
3928
|
+
}
|
|
3929
|
+
else {
|
|
3930
|
+
const market = this.market(symbol);
|
|
3931
|
+
const request = {
|
|
3932
|
+
'symbol': market['id'],
|
|
3933
|
+
};
|
|
3934
|
+
response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
|
|
3935
|
+
}
|
|
3936
|
+
//
|
|
3937
|
+
// swapV1PrivatePostTradeClosePosition
|
|
3938
|
+
//
|
|
3939
|
+
// {
|
|
3940
|
+
// "code": 0,
|
|
3941
|
+
// "msg": "",
|
|
3942
|
+
// "timestamp": 1710992264190,
|
|
3943
|
+
// "data": {
|
|
3944
|
+
// "orderId": 1770656007907930112,
|
|
3945
|
+
// "positionId": "1751667128353910784",
|
|
3946
|
+
// "symbol": "LTC-USDT",
|
|
3947
|
+
// "side": "Ask",
|
|
3948
|
+
// "type": "MARKET",
|
|
3949
|
+
// "positionSide": "Long",
|
|
3950
|
+
// "origQty": "0.2"
|
|
3951
|
+
// }
|
|
3952
|
+
// }
|
|
3953
|
+
//
|
|
3954
|
+
// swapV2PrivatePostTradeCloseAllPositions
|
|
3921
3955
|
//
|
|
3922
3956
|
// {
|
|
3923
3957
|
// "code": 0,
|
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -1119,16 +1119,18 @@ class bitstamp extends bitstamp$1 {
|
|
|
1119
1119
|
'timestamp': undefined,
|
|
1120
1120
|
'datetime': undefined,
|
|
1121
1121
|
};
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
const
|
|
1122
|
+
if (response === undefined) {
|
|
1123
|
+
response = [];
|
|
1124
|
+
}
|
|
1125
|
+
for (let i = 0; i < response.length; i++) {
|
|
1126
|
+
const currencyBalance = response[i];
|
|
1127
|
+
const currencyId = this.safeString(currencyBalance, 'currency');
|
|
1128
|
+
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
1127
1129
|
const account = this.account();
|
|
1128
|
-
account['free'] = this.safeString(
|
|
1129
|
-
account['used'] = this.safeString(
|
|
1130
|
-
account['total'] = this.safeString(
|
|
1131
|
-
result[
|
|
1130
|
+
account['free'] = this.safeString(currencyBalance, 'available');
|
|
1131
|
+
account['used'] = this.safeString(currencyBalance, 'reserved');
|
|
1132
|
+
account['total'] = this.safeString(currencyBalance, 'total');
|
|
1133
|
+
result[currencyCode] = account;
|
|
1132
1134
|
}
|
|
1133
1135
|
return this.safeBalance(result);
|
|
1134
1136
|
}
|
|
@@ -1142,24 +1144,17 @@ class bitstamp extends bitstamp$1 {
|
|
|
1142
1144
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1143
1145
|
*/
|
|
1144
1146
|
await this.loadMarkets();
|
|
1145
|
-
const response = await this.
|
|
1147
|
+
const response = await this.privatePostAccountBalances(params);
|
|
1146
1148
|
//
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
//
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
// "bat_balance": "0.00000000",
|
|
1157
|
-
// "bat_reserved": "0.00000000",
|
|
1158
|
-
// "bat_withdrawal_fee": "5.00000000",
|
|
1159
|
-
// "batbtc_fee": "0.000",
|
|
1160
|
-
// "bateur_fee": "0.000",
|
|
1161
|
-
// "batusd_fee": "0.000",
|
|
1162
|
-
// }
|
|
1149
|
+
// [
|
|
1150
|
+
// {
|
|
1151
|
+
// "currency": "usdt",
|
|
1152
|
+
// "total": "7.00000",
|
|
1153
|
+
// "available": "7.00000",
|
|
1154
|
+
// "reserved": "0.00000"
|
|
1155
|
+
// },
|
|
1156
|
+
// ...
|
|
1157
|
+
// ]
|
|
1163
1158
|
//
|
|
1164
1159
|
return this.parseBalance(response);
|
|
1165
1160
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -110,6 +110,7 @@ class bybit extends bybit$1 {
|
|
|
110
110
|
'fetchUnderlyingAssets': false,
|
|
111
111
|
'fetchVolatilityHistory': true,
|
|
112
112
|
'fetchWithdrawals': true,
|
|
113
|
+
'fetchFundingHistory': true,
|
|
113
114
|
'repayCrossMargin': true,
|
|
114
115
|
'setLeverage': true,
|
|
115
116
|
'setMarginMode': true,
|
|
@@ -8106,6 +8107,106 @@ class bybit extends bybit$1 {
|
|
|
8106
8107
|
}
|
|
8107
8108
|
return tiers;
|
|
8108
8109
|
}
|
|
8110
|
+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8111
|
+
/**
|
|
8112
|
+
* @method
|
|
8113
|
+
* @name bybit#fetchFundingHistory
|
|
8114
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
8115
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
|
8116
|
+
* @param {string} [symbol] unified market symbol
|
|
8117
|
+
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
8118
|
+
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
8119
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8120
|
+
* @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)
|
|
8121
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
8122
|
+
*/
|
|
8123
|
+
await this.loadMarkets();
|
|
8124
|
+
let paginate = false;
|
|
8125
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
|
|
8126
|
+
if (paginate) {
|
|
8127
|
+
return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
|
|
8128
|
+
}
|
|
8129
|
+
let request = {
|
|
8130
|
+
'execType': 'Funding',
|
|
8131
|
+
};
|
|
8132
|
+
let market = undefined;
|
|
8133
|
+
if (symbol !== undefined) {
|
|
8134
|
+
market = this.market(symbol);
|
|
8135
|
+
request['symbol'] = market['id'];
|
|
8136
|
+
}
|
|
8137
|
+
let type = undefined;
|
|
8138
|
+
[type, params] = this.getBybitType('fetchFundingHistory', market, params);
|
|
8139
|
+
request['category'] = type;
|
|
8140
|
+
if (symbol !== undefined) {
|
|
8141
|
+
request['symbol'] = market['id'];
|
|
8142
|
+
}
|
|
8143
|
+
if (since !== undefined) {
|
|
8144
|
+
request['startTime'] = since;
|
|
8145
|
+
}
|
|
8146
|
+
if (limit !== undefined) {
|
|
8147
|
+
request['size'] = limit;
|
|
8148
|
+
}
|
|
8149
|
+
else {
|
|
8150
|
+
request['size'] = 100;
|
|
8151
|
+
}
|
|
8152
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
8153
|
+
const response = await this.privateGetV5ExecutionList(this.extend(request, params));
|
|
8154
|
+
const fundings = this.addPaginationCursorToResult(response);
|
|
8155
|
+
return this.parseIncomes(fundings, market, since, limit);
|
|
8156
|
+
}
|
|
8157
|
+
parseIncome(income, market = undefined) {
|
|
8158
|
+
//
|
|
8159
|
+
// {
|
|
8160
|
+
// "symbol": "XMRUSDT",
|
|
8161
|
+
// "orderType": "UNKNOWN",
|
|
8162
|
+
// "underlyingPrice": "",
|
|
8163
|
+
// "orderLinkId": "",
|
|
8164
|
+
// "orderId": "a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d",
|
|
8165
|
+
// "stopOrderType": "UNKNOWN",
|
|
8166
|
+
// "execTime": "1710950400000",
|
|
8167
|
+
// "feeCurrency": "",
|
|
8168
|
+
// "createType": "",
|
|
8169
|
+
// "feeRate": "-0.000761",
|
|
8170
|
+
// "tradeIv": "",
|
|
8171
|
+
// "blockTradeId": "",
|
|
8172
|
+
// "markPrice": "136.79",
|
|
8173
|
+
// "execPrice": "137.11",
|
|
8174
|
+
// "markIv": "",
|
|
8175
|
+
// "orderQty": "0",
|
|
8176
|
+
// "orderPrice": "0",
|
|
8177
|
+
// "execValue": "134.3678",
|
|
8178
|
+
// "closedSize": "0",
|
|
8179
|
+
// "execType": "Funding",
|
|
8180
|
+
// "seq": "28097658790",
|
|
8181
|
+
// "side": "Sell",
|
|
8182
|
+
// "indexPrice": "",
|
|
8183
|
+
// "leavesQty": "0",
|
|
8184
|
+
// "isMaker": false,
|
|
8185
|
+
// "execFee": "-0.10232512",
|
|
8186
|
+
// "execId": "8d1ef156-4ec6-4445-9a6c-1c0c24dbd046",
|
|
8187
|
+
// "marketUnit": "",
|
|
8188
|
+
// "execQty": "0.98",
|
|
8189
|
+
// "nextPageCursor": "5774437%3A0%2C5771289%3A0"
|
|
8190
|
+
// }
|
|
8191
|
+
//
|
|
8192
|
+
const marketId = this.safeString(income, 'symbol');
|
|
8193
|
+
market = this.safeMarket(marketId, market, undefined, 'contract');
|
|
8194
|
+
let code = 'USDT';
|
|
8195
|
+
if (market['inverse']) {
|
|
8196
|
+
code = market['quote'];
|
|
8197
|
+
}
|
|
8198
|
+
const timestamp = this.safeInteger(income, 'execTime');
|
|
8199
|
+
return {
|
|
8200
|
+
'info': income,
|
|
8201
|
+
'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
|
|
8202
|
+
'code': code,
|
|
8203
|
+
'timestamp': timestamp,
|
|
8204
|
+
'datetime': this.iso8601(timestamp),
|
|
8205
|
+
'id': this.safeString(income, 'execId'),
|
|
8206
|
+
'amount': this.safeNumber(income, 'execQty'),
|
|
8207
|
+
'rate': this.safeNumber(income, 'feeRate'),
|
|
8208
|
+
};
|
|
8209
|
+
}
|
|
8109
8210
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8110
8211
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8111
8212
|
if (api === 'public') {
|
|
@@ -117,10 +117,10 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
117
117
|
},
|
|
118
118
|
'www': 'https://international.coinbase.com',
|
|
119
119
|
'doc': [
|
|
120
|
-
'https://docs.cloud.
|
|
120
|
+
'https://docs.cloud.coinbase.com/intx/docs',
|
|
121
121
|
],
|
|
122
122
|
'fees': [
|
|
123
|
-
'https://help.
|
|
123
|
+
'https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
|
|
124
124
|
],
|
|
125
125
|
'referral': '',
|
|
126
126
|
},
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -310,6 +310,7 @@ class gate extends gate$1 {
|
|
|
310
310
|
'loan_records': 20 / 15,
|
|
311
311
|
'interest_records': 20 / 15,
|
|
312
312
|
'estimate_rate': 20 / 15,
|
|
313
|
+
'currency_discount_tiers': 20 / 15,
|
|
313
314
|
},
|
|
314
315
|
'post': {
|
|
315
316
|
'account_mode': 20 / 15,
|
|
@@ -4230,7 +4231,8 @@ class gate extends gate$1 {
|
|
|
4230
4231
|
'account': account,
|
|
4231
4232
|
};
|
|
4232
4233
|
if (amount !== undefined) {
|
|
4233
|
-
|
|
4234
|
+
const amountKey = (market['spot']) ? 'amount' : 'size';
|
|
4235
|
+
request[amountKey] = this.amountToPrecision(symbol, amount);
|
|
4234
4236
|
}
|
|
4235
4237
|
if (price !== undefined) {
|
|
4236
4238
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -861,7 +861,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
861
861
|
const message = this.extend(request, params);
|
|
862
862
|
this.watch(url, messageHash, message, messageHash);
|
|
863
863
|
}
|
|
864
|
-
return future;
|
|
864
|
+
return await future;
|
|
865
865
|
}
|
|
866
866
|
handleAuthenticationMessage(client, message) {
|
|
867
867
|
const messageHash = 'authenticated';
|
|
@@ -1607,7 +1607,7 @@ class bitget extends bitget$1 {
|
|
|
1607
1607
|
const message = this.extend(request, params);
|
|
1608
1608
|
this.watch(url, messageHash, message, messageHash);
|
|
1609
1609
|
}
|
|
1610
|
-
return future;
|
|
1610
|
+
return await future;
|
|
1611
1611
|
}
|
|
1612
1612
|
async watchPrivate(messageHash, subscriptionHash, args, params = {}) {
|
|
1613
1613
|
await this.authenticate();
|
|
@@ -1406,7 +1406,7 @@ class bitmart extends bitmart$1 {
|
|
|
1406
1406
|
const message = this.extend(request, params);
|
|
1407
1407
|
this.watch(url, messageHash, message, messageHash);
|
|
1408
1408
|
}
|
|
1409
|
-
return future;
|
|
1409
|
+
return await future;
|
|
1410
1410
|
}
|
|
1411
1411
|
handleSubscriptionStatus(client, message) {
|
|
1412
1412
|
//
|
|
@@ -607,7 +607,7 @@ class bitmex extends bitmex$1 {
|
|
|
607
607
|
const message = this.extend(request, params);
|
|
608
608
|
this.watch(url, messageHash, message, messageHash);
|
|
609
609
|
}
|
|
610
|
-
return future;
|
|
610
|
+
return await future;
|
|
611
611
|
}
|
|
612
612
|
handleAuthenticationMessage(client, message) {
|
|
613
613
|
const authenticated = this.safeBool(message, 'success', false);
|
|
@@ -1037,8 +1037,23 @@ class bybit extends bybit$1 {
|
|
|
1037
1037
|
for (let i = 0; i < rawPositions.length; i++) {
|
|
1038
1038
|
const rawPosition = rawPositions[i];
|
|
1039
1039
|
const position = this.parsePosition(rawPosition);
|
|
1040
|
+
const side = this.safeString(position, 'side');
|
|
1041
|
+
// hacky solution to handle closing positions
|
|
1042
|
+
// without crashing, we should handle this properly later
|
|
1040
1043
|
newPositions.push(position);
|
|
1041
|
-
|
|
1044
|
+
if (side === undefined || side === '') {
|
|
1045
|
+
// closing update, adding both sides to "reset" both sides
|
|
1046
|
+
// since we don't know which side is being closed
|
|
1047
|
+
position['side'] = 'long';
|
|
1048
|
+
cache.append(position);
|
|
1049
|
+
position['side'] = 'short';
|
|
1050
|
+
cache.append(position);
|
|
1051
|
+
position['side'] = undefined;
|
|
1052
|
+
}
|
|
1053
|
+
else {
|
|
1054
|
+
// regular update
|
|
1055
|
+
cache.append(position);
|
|
1056
|
+
}
|
|
1042
1057
|
}
|
|
1043
1058
|
const messageHashes = this.findMessageHashes(client, 'positions::');
|
|
1044
1059
|
for (let i = 0; i < messageHashes.length; i++) {
|
package/dist/cjs/src/pro/cex.js
CHANGED
|
@@ -157,16 +157,20 @@ class cex extends cex$1 {
|
|
|
157
157
|
// {
|
|
158
158
|
// "e": "history",
|
|
159
159
|
// "data": [
|
|
160
|
-
//
|
|
161
|
-
//
|
|
160
|
+
// 'buy:1710255706095:444444:71222.2:14892622'
|
|
161
|
+
// 'sell:1710255658251:42530:71300:14892621'
|
|
162
|
+
// 'buy:1710252424241:87913:72800:14892620'
|
|
163
|
+
// ... timestamp descending
|
|
162
164
|
// ]
|
|
163
165
|
// }
|
|
164
166
|
//
|
|
165
|
-
const data = this.
|
|
167
|
+
const data = this.safeList(message, 'data', []);
|
|
166
168
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
167
169
|
const stored = new Cache.ArrayCache(limit);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
const dataLength = data.length;
|
|
171
|
+
for (let i = 0; i < dataLength; i++) {
|
|
172
|
+
const index = dataLength - 1 - i;
|
|
173
|
+
const rawTrade = data[index];
|
|
170
174
|
const parsed = this.parseWsOldTrade(rawTrade);
|
|
171
175
|
stored.append(parsed);
|
|
172
176
|
}
|
|
@@ -1003,7 +1003,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1003
1003
|
const message = this.extend(request, params);
|
|
1004
1004
|
this.watch(url, messageHash, message, messageHash);
|
|
1005
1005
|
}
|
|
1006
|
-
return future;
|
|
1006
|
+
return await future;
|
|
1007
1007
|
}
|
|
1008
1008
|
handlePing(client, message) {
|
|
1009
1009
|
this.spawn(this.pong, client, message);
|
package/dist/cjs/src/pro/htx.js
CHANGED
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -82,6 +82,15 @@ class woo extends woo$1 {
|
|
|
82
82
|
return await this.watch(url, messageHash, request, messageHash, subscribe);
|
|
83
83
|
}
|
|
84
84
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
85
|
+
/**
|
|
86
|
+
* @method
|
|
87
|
+
* @name woo#watchOrderBook
|
|
88
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
89
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
90
|
+
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
91
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
93
|
+
*/
|
|
85
94
|
await this.loadMarkets();
|
|
86
95
|
const name = 'orderbook';
|
|
87
96
|
const market = this.market(symbol);
|
|
@@ -131,9 +140,18 @@ class woo extends woo$1 {
|
|
|
131
140
|
client.resolve(orderbook, topic);
|
|
132
141
|
}
|
|
133
142
|
async watchTicker(symbol, params = {}) {
|
|
143
|
+
/**
|
|
144
|
+
* @method
|
|
145
|
+
* @name woo#watchTicker
|
|
146
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
147
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
148
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
149
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
150
|
+
*/
|
|
134
151
|
await this.loadMarkets();
|
|
135
152
|
const name = 'ticker';
|
|
136
153
|
const market = this.market(symbol);
|
|
154
|
+
symbol = market['symbol'];
|
|
137
155
|
const topic = market['id'] + '@' + name;
|
|
138
156
|
const request = {
|
|
139
157
|
'event': 'subscribe',
|
|
@@ -208,7 +226,16 @@ class woo extends woo$1 {
|
|
|
208
226
|
return message;
|
|
209
227
|
}
|
|
210
228
|
async watchTickers(symbols = undefined, params = {}) {
|
|
229
|
+
/**
|
|
230
|
+
* @method
|
|
231
|
+
* @name woo#watchTickers
|
|
232
|
+
* @description n watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
233
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
234
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
235
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
236
|
+
*/
|
|
211
237
|
await this.loadMarkets();
|
|
238
|
+
symbols = this.marketSymbols(symbols);
|
|
212
239
|
const name = 'tickers';
|
|
213
240
|
const topic = name;
|
|
214
241
|
const request = {
|
|
@@ -327,8 +354,19 @@ class woo extends woo$1 {
|
|
|
327
354
|
client.resolve(stored, topic);
|
|
328
355
|
}
|
|
329
356
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
357
|
+
/**
|
|
358
|
+
* @method
|
|
359
|
+
* @name woo#watchTrades
|
|
360
|
+
* @description watches information on multiple trades made in a market
|
|
361
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
362
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
363
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
364
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
365
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
|
|
366
|
+
*/
|
|
330
367
|
await this.loadMarkets();
|
|
331
368
|
const market = this.market(symbol);
|
|
369
|
+
symbol = market['symbol'];
|
|
332
370
|
const topic = market['id'] + '@trade';
|
|
333
371
|
const request = {
|
|
334
372
|
'event': 'subscribe',
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.78";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.79';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -31,6 +31,7 @@ interface Exchange {
|
|
|
31
31
|
swapV1PrivateGetTradeBatchCancelReplace(params?: {}): Promise<implicitReturnType>;
|
|
32
32
|
swapV1PrivatePostTradeCancelReplace(params?: {}): Promise<implicitReturnType>;
|
|
33
33
|
swapV1PrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
34
|
+
swapV1PrivatePostTradeClosePosition(params?: {}): Promise<implicitReturnType>;
|
|
34
35
|
swapV2PublicGetServerTime(params?: {}): Promise<implicitReturnType>;
|
|
35
36
|
swapV2PublicGetQuoteContracts(params?: {}): Promise<implicitReturnType>;
|
|
36
37
|
swapV2PublicGetQuotePrice(params?: {}): Promise<implicitReturnType>;
|
|
@@ -90,6 +90,7 @@ interface Exchange {
|
|
|
90
90
|
privateUnifiedGetLoanRecords(params?: {}): Promise<implicitReturnType>;
|
|
91
91
|
privateUnifiedGetInterestRecords(params?: {}): Promise<implicitReturnType>;
|
|
92
92
|
privateUnifiedGetEstimateRate(params?: {}): Promise<implicitReturnType>;
|
|
93
|
+
privateUnifiedGetCurrencyDiscountTiers(params?: {}): Promise<implicitReturnType>;
|
|
93
94
|
privateUnifiedPostAccountMode(params?: {}): Promise<implicitReturnType>;
|
|
94
95
|
privateUnifiedPostLoans(params?: {}): Promise<implicitReturnType>;
|
|
95
96
|
privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
|
|
@@ -90,6 +90,7 @@ interface gate {
|
|
|
90
90
|
privateUnifiedGetLoanRecords(params?: {}): Promise<implicitReturnType>;
|
|
91
91
|
privateUnifiedGetInterestRecords(params?: {}): Promise<implicitReturnType>;
|
|
92
92
|
privateUnifiedGetEstimateRate(params?: {}): Promise<implicitReturnType>;
|
|
93
|
+
privateUnifiedGetCurrencyDiscountTiers(params?: {}): Promise<implicitReturnType>;
|
|
93
94
|
privateUnifiedPostAccountMode(params?: {}): Promise<implicitReturnType>;
|
|
94
95
|
privateUnifiedPostLoans(params?: {}): Promise<implicitReturnType>;
|
|
95
96
|
privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
|
package/js/src/bingx.js
CHANGED
|
@@ -185,6 +185,7 @@ export default class bingx extends Exchange {
|
|
|
185
185
|
'post': {
|
|
186
186
|
'trade/cancelReplace': 1,
|
|
187
187
|
'positionSide/dual': 1,
|
|
188
|
+
'trade/closePosition': 1,
|
|
188
189
|
},
|
|
189
190
|
},
|
|
190
191
|
},
|
|
@@ -2166,6 +2167,8 @@ export default class bingx extends Exchange {
|
|
|
2166
2167
|
'SELL': 'sell',
|
|
2167
2168
|
'SHORT': 'sell',
|
|
2168
2169
|
'LONG': 'buy',
|
|
2170
|
+
'ask': 'sell',
|
|
2171
|
+
'bid': 'buy',
|
|
2169
2172
|
};
|
|
2170
2173
|
return this.safeString(sides, side, side);
|
|
2171
2174
|
}
|
|
@@ -3913,14 +3916,45 @@ export default class bingx extends Exchange {
|
|
|
3913
3916
|
* @param {string} symbol Unified CCXT market symbol
|
|
3914
3917
|
* @param {string} [side] not used by bingx
|
|
3915
3918
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
3919
|
+
* @param {string|undefined} [params.positionId] it is recommended to fill in this parameter when closing a position
|
|
3916
3920
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3917
3921
|
*/
|
|
3918
3922
|
await this.loadMarkets();
|
|
3919
|
-
const
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3923
|
+
const positionId = this.safeString(params, 'positionId');
|
|
3924
|
+
params = this.omit(params, 'positionId');
|
|
3925
|
+
let response = undefined;
|
|
3926
|
+
if (positionId !== undefined) {
|
|
3927
|
+
const request = {
|
|
3928
|
+
'positionId': positionId,
|
|
3929
|
+
};
|
|
3930
|
+
response = await this.swapV1PrivatePostTradeClosePosition(this.extend(request, params));
|
|
3931
|
+
}
|
|
3932
|
+
else {
|
|
3933
|
+
const market = this.market(symbol);
|
|
3934
|
+
const request = {
|
|
3935
|
+
'symbol': market['id'],
|
|
3936
|
+
};
|
|
3937
|
+
response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
|
|
3938
|
+
}
|
|
3939
|
+
//
|
|
3940
|
+
// swapV1PrivatePostTradeClosePosition
|
|
3941
|
+
//
|
|
3942
|
+
// {
|
|
3943
|
+
// "code": 0,
|
|
3944
|
+
// "msg": "",
|
|
3945
|
+
// "timestamp": 1710992264190,
|
|
3946
|
+
// "data": {
|
|
3947
|
+
// "orderId": 1770656007907930112,
|
|
3948
|
+
// "positionId": "1751667128353910784",
|
|
3949
|
+
// "symbol": "LTC-USDT",
|
|
3950
|
+
// "side": "Ask",
|
|
3951
|
+
// "type": "MARKET",
|
|
3952
|
+
// "positionSide": "Long",
|
|
3953
|
+
// "origQty": "0.2"
|
|
3954
|
+
// }
|
|
3955
|
+
// }
|
|
3956
|
+
//
|
|
3957
|
+
// swapV2PrivatePostTradeCloseAllPositions
|
|
3924
3958
|
//
|
|
3925
3959
|
// {
|
|
3926
3960
|
// "code": 0,
|