ccxt 4.2.12 → 4.2.13
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 +718 -240
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/js/ccxt.js +1 -1
- package/dist/cjs/js/src/bigone.js +89 -22
- package/dist/cjs/js/src/binance.js +34 -27
- package/dist/cjs/js/src/bingx.js +106 -36
- package/dist/cjs/js/src/bitget.js +13 -6
- package/dist/cjs/js/src/bitmart.js +3 -3
- package/dist/cjs/js/src/bybit.js +1 -1
- package/dist/cjs/js/src/coinbase.js +176 -26
- package/dist/cjs/js/src/coinlist.js +1 -1
- package/dist/cjs/js/src/coinone.js +1 -1
- package/dist/cjs/js/src/deribit.js +1 -1
- package/dist/cjs/js/src/gate.js +74 -56
- package/dist/cjs/js/src/gemini.js +1 -1
- package/dist/cjs/js/src/htx.js +26 -1
- package/dist/cjs/js/src/independentreserve.js +7 -5
- package/dist/cjs/js/src/kraken.js +3 -7
- package/dist/cjs/js/src/lbank.js +59 -33
- package/dist/cjs/js/src/oceanex.js +1 -1
- package/dist/cjs/js/src/okx.js +2 -1
- package/dist/cjs/js/src/phemex.js +9 -2
- package/dist/cjs/js/src/pro/kraken.js +1 -1
- package/dist/cjs/js/src/pro/okx.js +52 -2
- package/dist/cjs/js/src/probit.js +4 -2
- package/dist/cjs/js/src/wavesexchange.js +1 -1
- package/dist/cjs/js/src/woo.js +52 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/bigone.d.ts +2 -0
- package/js/src/bigone.js +89 -22
- package/js/src/binance.js +34 -27
- package/js/src/bingx.js +106 -36
- package/js/src/bitget.js +13 -6
- package/js/src/bitmart.js +3 -3
- package/js/src/bybit.js +1 -1
- package/js/src/coinbase.d.ts +26 -3
- package/js/src/coinbase.js +176 -26
- package/js/src/coinlist.js +1 -1
- package/js/src/coinone.js +1 -1
- package/js/src/deribit.js +1 -1
- package/js/src/gate.js +74 -56
- package/js/src/gemini.js +1 -1
- package/js/src/htx.d.ts +1 -0
- package/js/src/htx.js +26 -1
- package/js/src/independentreserve.js +7 -5
- package/js/src/kraken.js +3 -7
- package/js/src/lbank.js +59 -33
- package/js/src/oceanex.js +1 -1
- package/js/src/okx.js +2 -1
- package/js/src/phemex.js +9 -2
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/okx.d.ts +1 -0
- package/js/src/pro/okx.js +52 -2
- package/js/src/probit.js +4 -2
- package/js/src/wavesexchange.js +1 -1
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +52 -2
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.13';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
package/dist/cjs/js/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.12';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
|
@@ -931,29 +931,90 @@ class bigone extends bigone$1 {
|
|
|
931
931
|
*/
|
|
932
932
|
await this.loadMarkets();
|
|
933
933
|
const market = this.market(symbol);
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
934
|
+
let response = undefined;
|
|
935
|
+
if (market['contract']) {
|
|
936
|
+
const request = {
|
|
937
|
+
'symbol': market['id'],
|
|
938
|
+
};
|
|
939
|
+
response = await this.contractPublicGetDepthSymbolSnapshot(this.extend(request, params));
|
|
940
|
+
//
|
|
941
|
+
// {
|
|
942
|
+
// bids: {
|
|
943
|
+
// '20000': '20',
|
|
944
|
+
// ...
|
|
945
|
+
// '34552': '64851',
|
|
946
|
+
// '34526.5': '59594',
|
|
947
|
+
// ...
|
|
948
|
+
// '34551.5': '29711'
|
|
949
|
+
// },
|
|
950
|
+
// asks: {
|
|
951
|
+
// '34557': '34395',
|
|
952
|
+
// ...
|
|
953
|
+
// '40000': '20',
|
|
954
|
+
// '34611.5': '56024',
|
|
955
|
+
// ...
|
|
956
|
+
// '34578.5': '66367'
|
|
957
|
+
// },
|
|
958
|
+
// to: '59737174',
|
|
959
|
+
// lastPrice: '34554.5',
|
|
960
|
+
// bestPrices: {
|
|
961
|
+
// ask: '34557.0',
|
|
962
|
+
// bid: '34552.0'
|
|
963
|
+
// },
|
|
964
|
+
// from: '0'
|
|
965
|
+
// }
|
|
966
|
+
//
|
|
967
|
+
return this.parseContractOrderBook(response, market['symbol'], limit);
|
|
968
|
+
}
|
|
969
|
+
else {
|
|
970
|
+
const request = {
|
|
971
|
+
'asset_pair_name': market['id'],
|
|
972
|
+
};
|
|
973
|
+
if (limit !== undefined) {
|
|
974
|
+
request['limit'] = limit; // default 50, max 200
|
|
975
|
+
}
|
|
976
|
+
response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
|
|
977
|
+
//
|
|
978
|
+
// {
|
|
979
|
+
// "code":0,
|
|
980
|
+
// "data": {
|
|
981
|
+
// "asset_pair_name": "EOS-BTC",
|
|
982
|
+
// "bids": [
|
|
983
|
+
// { "price": "42", "order_count": 4, "quantity": "23.33363711" }
|
|
984
|
+
// ],
|
|
985
|
+
// "asks": [
|
|
986
|
+
// { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
|
|
987
|
+
// ]
|
|
988
|
+
// }
|
|
989
|
+
// }
|
|
990
|
+
//
|
|
991
|
+
const orderbook = this.safeValue(response, 'data', {});
|
|
992
|
+
return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
|
|
939
993
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const
|
|
956
|
-
return
|
|
994
|
+
}
|
|
995
|
+
parseContractBidsAsks(bidsAsks) {
|
|
996
|
+
const bidsAsksKeys = Object.keys(bidsAsks);
|
|
997
|
+
const result = [];
|
|
998
|
+
for (let i = 0; i < bidsAsksKeys.length; i++) {
|
|
999
|
+
const price = bidsAsksKeys[i];
|
|
1000
|
+
const amount = bidsAsks[price];
|
|
1001
|
+
result.push([this.parseNumber(price), this.parseNumber(amount)]);
|
|
1002
|
+
}
|
|
1003
|
+
return result;
|
|
1004
|
+
}
|
|
1005
|
+
parseContractOrderBook(orderbook, symbol, limit = undefined) {
|
|
1006
|
+
const responseBids = this.safeValue(orderbook, 'bids');
|
|
1007
|
+
const responseAsks = this.safeValue(orderbook, 'asks');
|
|
1008
|
+
const bids = this.parseContractBidsAsks(responseBids);
|
|
1009
|
+
const asks = this.parseContractBidsAsks(responseAsks);
|
|
1010
|
+
return {
|
|
1011
|
+
'symbol': symbol,
|
|
1012
|
+
'bids': this.filterByLimit(this.sortBy(bids, 0, true), limit),
|
|
1013
|
+
'asks': this.filterByLimit(this.sortBy(asks, 0), limit),
|
|
1014
|
+
'timestamp': undefined,
|
|
1015
|
+
'datetime': undefined,
|
|
1016
|
+
'nonce': undefined,
|
|
1017
|
+
};
|
|
957
1018
|
}
|
|
958
1019
|
parseTrade(trade, market = undefined) {
|
|
959
1020
|
//
|
|
@@ -1113,6 +1174,9 @@ class bigone extends bigone$1 {
|
|
|
1113
1174
|
*/
|
|
1114
1175
|
await this.loadMarkets();
|
|
1115
1176
|
const market = this.market(symbol);
|
|
1177
|
+
if (market['contract']) {
|
|
1178
|
+
throw new errors.BadRequest(this.id + ' fetchTrades () can only fetch trades for spot markets');
|
|
1179
|
+
}
|
|
1116
1180
|
const request = {
|
|
1117
1181
|
'asset_pair_name': market['id'],
|
|
1118
1182
|
};
|
|
@@ -1175,6 +1239,9 @@ class bigone extends bigone$1 {
|
|
|
1175
1239
|
*/
|
|
1176
1240
|
await this.loadMarkets();
|
|
1177
1241
|
const market = this.market(symbol);
|
|
1242
|
+
if (market['contract']) {
|
|
1243
|
+
throw new errors.BadRequest(this.id + ' fetchOHLCV () can only fetch ohlcvs for spot markets');
|
|
1244
|
+
}
|
|
1178
1245
|
if (limit === undefined) {
|
|
1179
1246
|
limit = 100; // default 100, max 500
|
|
1180
1247
|
}
|
|
@@ -44,7 +44,6 @@ class binance extends binance$1 {
|
|
|
44
44
|
'createMarketBuyOrderWithCost': true,
|
|
45
45
|
'createMarketOrderWithCost': true,
|
|
46
46
|
'createMarketSellOrderWithCost': true,
|
|
47
|
-
'createTrailingPercentOrder': true,
|
|
48
47
|
'createOrder': true,
|
|
49
48
|
'createOrders': true,
|
|
50
49
|
'createPostOnlyOrder': true,
|
|
@@ -52,6 +51,7 @@ class binance extends binance$1 {
|
|
|
52
51
|
'createStopLimitOrder': true,
|
|
53
52
|
'createStopMarketOrder': false,
|
|
54
53
|
'createStopOrder': true,
|
|
54
|
+
'createTrailingPercentOrder': true,
|
|
55
55
|
'editOrder': true,
|
|
56
56
|
'fetchAccounts': undefined,
|
|
57
57
|
'fetchBalance': true,
|
|
@@ -6105,12 +6105,13 @@ class binance extends binance$1 {
|
|
|
6105
6105
|
* @name binance#transfer
|
|
6106
6106
|
* @description transfer currency internally between wallets on the same account
|
|
6107
6107
|
* @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
|
|
6108
|
-
* @see https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
|
|
6109
6108
|
* @param {string} code unified currency code
|
|
6110
6109
|
* @param {float} amount amount to transfer
|
|
6111
6110
|
* @param {string} fromAccount account to transfer from
|
|
6112
6111
|
* @param {string} toAccount account to transfer to
|
|
6113
6112
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6113
|
+
* @param {string} [params.type] exchange specific transfer type
|
|
6114
|
+
* @param {string} [params.symbol] the unified symbol, required for isolated margin transfers
|
|
6114
6115
|
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6115
6116
|
*/
|
|
6116
6117
|
await this.loadMarkets();
|
|
@@ -6121,76 +6122,82 @@ class binance extends binance$1 {
|
|
|
6121
6122
|
};
|
|
6122
6123
|
request['type'] = this.safeString(params, 'type');
|
|
6123
6124
|
params = this.omit(params, 'type');
|
|
6124
|
-
let response = undefined;
|
|
6125
6125
|
if (request['type'] === undefined) {
|
|
6126
6126
|
const symbol = this.safeString(params, 'symbol');
|
|
6127
|
+
let market = undefined;
|
|
6127
6128
|
if (symbol !== undefined) {
|
|
6129
|
+
market = this.market(symbol);
|
|
6128
6130
|
params = this.omit(params, 'symbol');
|
|
6129
6131
|
}
|
|
6130
6132
|
let fromId = this.convertTypeToAccount(fromAccount).toUpperCase();
|
|
6131
6133
|
let toId = this.convertTypeToAccount(toAccount).toUpperCase();
|
|
6134
|
+
let isolatedSymbol = undefined;
|
|
6135
|
+
if (market !== undefined) {
|
|
6136
|
+
isolatedSymbol = market['id'];
|
|
6137
|
+
}
|
|
6132
6138
|
if (fromId === 'ISOLATED') {
|
|
6133
6139
|
if (symbol === undefined) {
|
|
6134
6140
|
throw new errors.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when fromAccount is ' + fromAccount);
|
|
6135
6141
|
}
|
|
6136
|
-
else {
|
|
6137
|
-
fromId = this.marketId(symbol);
|
|
6138
|
-
}
|
|
6139
6142
|
}
|
|
6140
6143
|
if (toId === 'ISOLATED') {
|
|
6141
6144
|
if (symbol === undefined) {
|
|
6142
6145
|
throw new errors.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when toAccount is ' + toAccount);
|
|
6143
6146
|
}
|
|
6144
|
-
else {
|
|
6145
|
-
toId = this.marketId(symbol);
|
|
6146
|
-
}
|
|
6147
6147
|
}
|
|
6148
6148
|
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
6149
6149
|
const fromIsolated = !(fromId in accountsById);
|
|
6150
6150
|
const toIsolated = !(toId in accountsById);
|
|
6151
|
+
if (fromIsolated && (market === undefined)) {
|
|
6152
|
+
isolatedSymbol = fromId; // allow user provide symbol as the from/to account
|
|
6153
|
+
}
|
|
6154
|
+
if (toIsolated && (market === undefined)) {
|
|
6155
|
+
isolatedSymbol = toId;
|
|
6156
|
+
}
|
|
6151
6157
|
if (fromIsolated || toIsolated) { // Isolated margin transfer
|
|
6152
6158
|
const fromFuture = fromId === 'UMFUTURE' || fromId === 'CMFUTURE';
|
|
6153
6159
|
const toFuture = toId === 'UMFUTURE' || toId === 'CMFUTURE';
|
|
6154
6160
|
const fromSpot = fromId === 'MAIN';
|
|
6155
6161
|
const toSpot = toId === 'MAIN';
|
|
6156
6162
|
const funding = fromId === 'FUNDING' || toId === 'FUNDING';
|
|
6157
|
-
const mining = fromId === 'MINING' || toId === 'MINING';
|
|
6158
6163
|
const option = fromId === 'OPTION' || toId === 'OPTION';
|
|
6159
|
-
const prohibitedWithIsolated = fromFuture || toFuture ||
|
|
6164
|
+
const prohibitedWithIsolated = fromFuture || toFuture || funding || option;
|
|
6160
6165
|
if ((fromIsolated || toIsolated) && prohibitedWithIsolated) {
|
|
6161
6166
|
throw new errors.BadRequest(this.id + ' transfer () does not allow transfers between ' + fromAccount + ' and ' + toAccount);
|
|
6162
6167
|
}
|
|
6163
6168
|
else if (toSpot && fromIsolated) {
|
|
6164
|
-
|
|
6165
|
-
request['
|
|
6166
|
-
request['symbol'] = fromId;
|
|
6167
|
-
response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
|
|
6169
|
+
fromId = 'ISOLATED_MARGIN';
|
|
6170
|
+
request['fromSymbol'] = isolatedSymbol;
|
|
6168
6171
|
}
|
|
6169
6172
|
else if (fromSpot && toIsolated) {
|
|
6170
|
-
|
|
6171
|
-
request['
|
|
6172
|
-
request['symbol'] = toId;
|
|
6173
|
-
response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
|
|
6173
|
+
toId = 'ISOLATED_MARGIN';
|
|
6174
|
+
request['toSymbol'] = isolatedSymbol;
|
|
6174
6175
|
}
|
|
6175
6176
|
else {
|
|
6176
|
-
if (fromIsolated) {
|
|
6177
|
+
if (fromIsolated && toIsolated) {
|
|
6177
6178
|
request['fromSymbol'] = fromId;
|
|
6178
|
-
fromId = 'ISOLATEDMARGIN';
|
|
6179
|
-
}
|
|
6180
|
-
if (toIsolated) {
|
|
6181
6179
|
request['toSymbol'] = toId;
|
|
6180
|
+
fromId = 'ISOLATEDMARGIN';
|
|
6182
6181
|
toId = 'ISOLATEDMARGIN';
|
|
6183
6182
|
}
|
|
6184
|
-
|
|
6183
|
+
else {
|
|
6184
|
+
if (fromIsolated) {
|
|
6185
|
+
request['fromSymbol'] = isolatedSymbol;
|
|
6186
|
+
fromId = 'ISOLATEDMARGIN';
|
|
6187
|
+
}
|
|
6188
|
+
if (toIsolated) {
|
|
6189
|
+
request['toSymbol'] = isolatedSymbol;
|
|
6190
|
+
toId = 'ISOLATEDMARGIN';
|
|
6191
|
+
}
|
|
6192
|
+
}
|
|
6185
6193
|
}
|
|
6194
|
+
request['type'] = fromId + '_' + toId;
|
|
6186
6195
|
}
|
|
6187
6196
|
else {
|
|
6188
6197
|
request['type'] = fromId + '_' + toId;
|
|
6189
6198
|
}
|
|
6190
6199
|
}
|
|
6191
|
-
|
|
6192
|
-
response = await this.sapiPostAssetTransfer(this.extend(request, params));
|
|
6193
|
-
}
|
|
6200
|
+
const response = await this.sapiPostAssetTransfer(this.extend(request, params));
|
|
6194
6201
|
//
|
|
6195
6202
|
// {
|
|
6196
6203
|
// "tranId":13526853623
|
package/dist/cjs/js/src/bingx.js
CHANGED
|
@@ -119,6 +119,7 @@ class bingx extends bingx$1 {
|
|
|
119
119
|
'trade/query': 3,
|
|
120
120
|
'trade/openOrders': 3,
|
|
121
121
|
'trade/historyOrders': 3,
|
|
122
|
+
'trade/myTrades': 3,
|
|
122
123
|
'user/commissionRate': 3,
|
|
123
124
|
'account/balance': 3,
|
|
124
125
|
},
|
|
@@ -178,6 +179,7 @@ class bingx extends bingx$1 {
|
|
|
178
179
|
'user/positions': 3,
|
|
179
180
|
'user/income': 3,
|
|
180
181
|
'trade/openOrders': 3,
|
|
182
|
+
'trade/openOrder': 3,
|
|
181
183
|
'trade/order': 3,
|
|
182
184
|
'trade/marginType': 3,
|
|
183
185
|
'trade/leverage': 3,
|
|
@@ -845,6 +847,22 @@ class bingx extends bingx$1 {
|
|
|
845
847
|
// "buyerMaker": false
|
|
846
848
|
// }
|
|
847
849
|
//
|
|
850
|
+
// spot
|
|
851
|
+
// fetchMyTrades
|
|
852
|
+
// {
|
|
853
|
+
// "symbol": "LTC-USDT",
|
|
854
|
+
// "id": 36237072,
|
|
855
|
+
// "orderId": 1674069326895775744,
|
|
856
|
+
// "price": "85.891",
|
|
857
|
+
// "qty": "0.0582",
|
|
858
|
+
// "quoteQty": "4.9988562000000005",
|
|
859
|
+
// "commission": -0.00005820000000000001,
|
|
860
|
+
// "commissionAsset": "LTC",
|
|
861
|
+
// "time": 1687964205000,
|
|
862
|
+
// "isBuyer": true,
|
|
863
|
+
// "isMaker": false
|
|
864
|
+
// }
|
|
865
|
+
//
|
|
848
866
|
// swap
|
|
849
867
|
// fetchTrades
|
|
850
868
|
//
|
|
@@ -907,7 +925,7 @@ class bingx extends bingx$1 {
|
|
|
907
925
|
}
|
|
908
926
|
const cost = this.safeString(trade, 'quoteQty');
|
|
909
927
|
const type = (cost === undefined) ? 'spot' : 'swap';
|
|
910
|
-
const currencyId = this.
|
|
928
|
+
const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
|
|
911
929
|
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
912
930
|
const m = this.safeValue(trade, 'm');
|
|
913
931
|
const marketId = this.safeString(trade, 's');
|
|
@@ -923,6 +941,14 @@ class bingx extends bingx$1 {
|
|
|
923
941
|
takeOrMaker = 'taker';
|
|
924
942
|
}
|
|
925
943
|
}
|
|
944
|
+
const isBuyer = this.safeValue(trade, 'isBuyer');
|
|
945
|
+
if (isBuyer !== undefined) {
|
|
946
|
+
side = isBuyer ? 'buy' : 'sell';
|
|
947
|
+
}
|
|
948
|
+
const isMaker = this.safeValue(trade, 'isMaker');
|
|
949
|
+
if (isMaker !== undefined) {
|
|
950
|
+
takeOrMaker = isMaker ? 'maker' : 'taker';
|
|
951
|
+
}
|
|
926
952
|
return this.safeTrade({
|
|
927
953
|
'id': this.safeStringN(trade, ['id', 't']),
|
|
928
954
|
'info': trade,
|
|
@@ -3257,57 +3283,101 @@ class bingx extends bingx$1 {
|
|
|
3257
3283
|
* @method
|
|
3258
3284
|
* @name bingx#fetchMyTrades
|
|
3259
3285
|
* @description fetch all trades made by the user
|
|
3286
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
|
|
3260
3287
|
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
|
|
3261
3288
|
* @param {string} [symbol] unified market symbol
|
|
3262
3289
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
3263
3290
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
3264
3291
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3292
|
+
* @param {int} [params.until] timestamp in ms for the ending date filter, default is undefined
|
|
3265
3293
|
* @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
|
|
3266
3294
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
3267
3295
|
*/
|
|
3268
3296
|
if (symbol === undefined) {
|
|
3269
3297
|
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
3270
3298
|
}
|
|
3271
|
-
if (since === undefined) {
|
|
3272
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a since argument');
|
|
3273
|
-
}
|
|
3274
|
-
const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
|
|
3275
3299
|
await this.loadMarkets();
|
|
3276
3300
|
const market = this.market(symbol);
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
}
|
|
3301
|
+
const now = this.milliseconds();
|
|
3302
|
+
let response = undefined;
|
|
3280
3303
|
const request = {
|
|
3281
3304
|
'symbol': market['id'],
|
|
3282
|
-
'tradingUnit': tradingUnit,
|
|
3283
|
-
'startTs': since,
|
|
3284
|
-
'endTs': this.nonce(),
|
|
3285
3305
|
};
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3306
|
+
if (since !== undefined) {
|
|
3307
|
+
const startTimeReq = market['spot'] ? 'startTime' : 'startTs';
|
|
3308
|
+
request[startTimeReq] = since;
|
|
3309
|
+
}
|
|
3310
|
+
else if (market['swap']) {
|
|
3311
|
+
request['startTs'] = now - 7776000000; // 90 days
|
|
3312
|
+
}
|
|
3313
|
+
const until = this.safeInteger(params, 'until');
|
|
3314
|
+
params = this.omit(params, 'until');
|
|
3315
|
+
if (until !== undefined) {
|
|
3316
|
+
const endTimeReq = market['spot'] ? 'endTime' : 'endTs';
|
|
3317
|
+
request[endTimeReq] = until;
|
|
3318
|
+
}
|
|
3319
|
+
else if (market['swap']) {
|
|
3320
|
+
request['endTs'] = now;
|
|
3321
|
+
}
|
|
3322
|
+
let fills = undefined;
|
|
3323
|
+
if (market['spot']) {
|
|
3324
|
+
response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
|
|
3325
|
+
const data = this.safeValue(response, 'data', []);
|
|
3326
|
+
fills = this.safeValue(data, 'fills', []);
|
|
3327
|
+
//
|
|
3328
|
+
// {
|
|
3329
|
+
// "code": 0,
|
|
3330
|
+
// "msg": "",
|
|
3331
|
+
// "debugMsg": "",
|
|
3332
|
+
// "data": {
|
|
3333
|
+
// "fills": [
|
|
3334
|
+
// {
|
|
3335
|
+
// "symbol": "LTC-USDT",
|
|
3336
|
+
// "id": 36237072,
|
|
3337
|
+
// "orderId": 1674069326895775744,
|
|
3338
|
+
// "price": "85.891",
|
|
3339
|
+
// "qty": "0.0582",
|
|
3340
|
+
// "quoteQty": "4.9988562000000005",
|
|
3341
|
+
// "commission": -0.00005820000000000001,
|
|
3342
|
+
// "commissionAsset": "LTC",
|
|
3343
|
+
// "time": 1687964205000,
|
|
3344
|
+
// "isBuyer": true,
|
|
3345
|
+
// "isMaker": false
|
|
3346
|
+
// }
|
|
3347
|
+
// ]
|
|
3348
|
+
// }
|
|
3349
|
+
// }
|
|
3350
|
+
//
|
|
3351
|
+
}
|
|
3352
|
+
else {
|
|
3353
|
+
const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
|
|
3354
|
+
params = this.omit(params, 'tradingUnit');
|
|
3355
|
+
request['tradingUnit'] = tradingUnit;
|
|
3356
|
+
response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
|
|
3357
|
+
const data = this.safeValue(response, 'data', []);
|
|
3358
|
+
fills = this.safeValue(data, 'fill_orders', []);
|
|
3359
|
+
//
|
|
3360
|
+
// {
|
|
3361
|
+
// "code": "0",
|
|
3362
|
+
// "msg": '',
|
|
3363
|
+
// "data": { fill_orders: [
|
|
3364
|
+
// {
|
|
3365
|
+
// "volume": "0.1",
|
|
3366
|
+
// "price": "106.75",
|
|
3367
|
+
// "amount": "10.6750",
|
|
3368
|
+
// "commission": "-0.0053",
|
|
3369
|
+
// "currency": "USDT",
|
|
3370
|
+
// "orderId": "1676213270274379776",
|
|
3371
|
+
// "liquidatedPrice": "0.00",
|
|
3372
|
+
// "liquidatedMarginRatio": "0.00",
|
|
3373
|
+
// "filledTime": "2023-07-04T20:56:01.000+0800"
|
|
3374
|
+
// }
|
|
3375
|
+
// ]
|
|
3376
|
+
// }
|
|
3377
|
+
// }
|
|
3378
|
+
//
|
|
3379
|
+
}
|
|
3380
|
+
return this.parseTrades(fills, market, since, limit, params);
|
|
3311
3381
|
}
|
|
3312
3382
|
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
3313
3383
|
//
|
|
@@ -40,10 +40,10 @@ class bitget extends bitget$1 {
|
|
|
40
40
|
'createMarketBuyOrderWithCost': true,
|
|
41
41
|
'createMarketOrderWithCost': false,
|
|
42
42
|
'createMarketSellOrderWithCost': false,
|
|
43
|
-
'createTrailingPercentOrder': true,
|
|
44
43
|
'createOrder': true,
|
|
45
44
|
'createOrders': true,
|
|
46
45
|
'createReduceOnlyOrder': false,
|
|
46
|
+
'createTrailingPercentOrder': true,
|
|
47
47
|
'editOrder': true,
|
|
48
48
|
'fetchAccounts': false,
|
|
49
49
|
'fetchBalance': true,
|
|
@@ -2957,7 +2957,12 @@ class bitget extends bitget$1 {
|
|
|
2957
2957
|
'symbol': market['id'],
|
|
2958
2958
|
};
|
|
2959
2959
|
if (limit !== undefined) {
|
|
2960
|
-
|
|
2960
|
+
if (market['contract']) {
|
|
2961
|
+
request['limit'] = Math.min(limit, 1000);
|
|
2962
|
+
}
|
|
2963
|
+
else {
|
|
2964
|
+
request['limit'] = limit;
|
|
2965
|
+
}
|
|
2961
2966
|
}
|
|
2962
2967
|
const options = this.safeValue(this.options, 'fetchTrades', {});
|
|
2963
2968
|
let response = undefined;
|
|
@@ -3269,11 +3274,12 @@ class bitget extends bitget$1 {
|
|
|
3269
3274
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3270
3275
|
const timeframes = this.options['timeframes'][marketType];
|
|
3271
3276
|
const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
3272
|
-
|
|
3277
|
+
const request = {
|
|
3273
3278
|
'symbol': market['id'],
|
|
3274
3279
|
'granularity': selectedTimeframe,
|
|
3275
3280
|
};
|
|
3276
|
-
|
|
3281
|
+
const until = this.safeInteger2(params, 'until', 'till');
|
|
3282
|
+
params = this.omit(params, ['until', 'till']);
|
|
3277
3283
|
if (limit !== undefined) {
|
|
3278
3284
|
request['limit'] = limit;
|
|
3279
3285
|
}
|
|
@@ -3286,6 +3292,9 @@ class bitget extends bitget$1 {
|
|
|
3286
3292
|
if (since !== undefined) {
|
|
3287
3293
|
request['startTime'] = since;
|
|
3288
3294
|
}
|
|
3295
|
+
if (until !== undefined) {
|
|
3296
|
+
request['endTime'] = until;
|
|
3297
|
+
}
|
|
3289
3298
|
}
|
|
3290
3299
|
let response = undefined;
|
|
3291
3300
|
if (market['spot']) {
|
|
@@ -3293,8 +3302,6 @@ class bitget extends bitget$1 {
|
|
|
3293
3302
|
response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
|
|
3294
3303
|
}
|
|
3295
3304
|
else if (method === 'publicSpotGetV2SpotMarketHistoryCandles') {
|
|
3296
|
-
const until = this.safeInteger2(params, 'until', 'till');
|
|
3297
|
-
params = this.omit(params, ['until', 'till']);
|
|
3298
3305
|
if (since !== undefined) {
|
|
3299
3306
|
if (limit === undefined) {
|
|
3300
3307
|
limit = 100; // exchange default
|
|
@@ -39,12 +39,12 @@ class bitmart extends bitmart$1 {
|
|
|
39
39
|
'createMarketBuyOrderWithCost': true,
|
|
40
40
|
'createMarketOrderWithCost': false,
|
|
41
41
|
'createMarketSellOrderWithCost': false,
|
|
42
|
-
'createTrailingPercentOrder': true,
|
|
43
42
|
'createOrder': true,
|
|
44
43
|
'createPostOnlyOrder': true,
|
|
45
44
|
'createStopLimitOrder': false,
|
|
46
45
|
'createStopMarketOrder': false,
|
|
47
46
|
'createStopOrder': false,
|
|
47
|
+
'createTrailingPercentOrder': true,
|
|
48
48
|
'fetchBalance': true,
|
|
49
49
|
'fetchBorrowInterest': true,
|
|
50
50
|
'fetchBorrowRateHistories': false,
|
|
@@ -263,8 +263,8 @@ class bitmart extends bitmart$1 {
|
|
|
263
263
|
'trading': {
|
|
264
264
|
'tierBased': true,
|
|
265
265
|
'percentage': true,
|
|
266
|
-
'taker': this.parseNumber('0.
|
|
267
|
-
'maker': this.parseNumber('0.
|
|
266
|
+
'taker': this.parseNumber('0.0040'),
|
|
267
|
+
'maker': this.parseNumber('0.0035'),
|
|
268
268
|
'tiers': {
|
|
269
269
|
'taker': [
|
|
270
270
|
[this.parseNumber('0'), this.parseNumber('0.0020')],
|
package/dist/cjs/js/src/bybit.js
CHANGED
|
@@ -39,7 +39,6 @@ class bybit extends bybit$1 {
|
|
|
39
39
|
'closePosition': false,
|
|
40
40
|
'createMarketBuyOrderWithCost': true,
|
|
41
41
|
'createMarketSellOrderWithCost': false,
|
|
42
|
-
'createTrailingAmountOrder': true,
|
|
43
42
|
'createOrder': true,
|
|
44
43
|
'createOrders': true,
|
|
45
44
|
'createPostOnlyOrder': true,
|
|
@@ -47,6 +46,7 @@ class bybit extends bybit$1 {
|
|
|
47
46
|
'createStopLimitOrder': true,
|
|
48
47
|
'createStopMarketOrder': true,
|
|
49
48
|
'createStopOrder': true,
|
|
49
|
+
'createTrailingAmountOrder': true,
|
|
50
50
|
'editOrder': true,
|
|
51
51
|
'fetchBalance': true,
|
|
52
52
|
'fetchBorrowInterest': false,
|