ccxt 4.5.45 → 4.5.47
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 -6
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -6
- package/dist/cjs/src/aftermath.js +1 -1
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +27 -0
- package/dist/cjs/src/binance.js +23 -17
- package/dist/cjs/src/bitfinex.js +6 -11
- package/dist/cjs/src/bitget.js +9 -4
- package/dist/cjs/src/bitmart.js +144 -21
- package/dist/cjs/src/bitmex.js +46 -0
- package/dist/cjs/src/bitstamp.js +14 -1
- package/dist/cjs/src/bittrade.js +1 -1
- package/dist/cjs/src/blofin.js +137 -29
- package/dist/cjs/src/bybit.js +58 -56
- package/dist/cjs/src/bydfi.js +102 -100
- package/dist/cjs/src/gate.js +37 -2
- package/dist/cjs/src/hollaex.js +1 -1
- package/dist/cjs/src/kraken.js +39 -29
- package/dist/cjs/src/kucoin.js +2161 -462
- package/dist/cjs/src/lighter.js +2 -2
- package/dist/cjs/src/okx.js +75 -58
- package/dist/cjs/src/paradex.js +2 -6
- package/dist/cjs/src/pro/bittrade.js +4 -0
- package/dist/cjs/src/pro/bydfi.js +19 -19
- package/dist/cjs/src/pro/gate.js +79 -54
- package/dist/cjs/src/pro/grvt.js +6 -4
- package/dist/cjs/src/pro/htx.js +4 -4
- package/dist/cjs/src/pro/lighter.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/whitebit.js +21 -2
- package/index.d.cts +2 -0
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/abstract/bitmart.d.ts +7 -0
- package/js/src/abstract/blofin.d.ts +28 -12
- package/js/src/abstract/bydfi.d.ts +29 -29
- package/js/src/abstract/kraken.d.ts +36 -29
- package/js/src/abstract/kucoin.d.ts +2 -0
- package/js/src/abstract/kucoinfutures.d.ts +2 -0
- package/js/src/aftermath.js +1 -1
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +27 -0
- package/js/src/binance.js +23 -17
- package/js/src/bitfinex.js +6 -11
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +9 -4
- package/js/src/bitmart.d.ts +18 -4
- package/js/src/bitmart.js +144 -21
- package/js/src/bitmex.d.ts +12 -0
- package/js/src/bitmex.js +46 -0
- package/js/src/bitstamp.js +14 -1
- package/js/src/bittrade.js +1 -1
- package/js/src/blofin.d.ts +2 -0
- package/js/src/blofin.js +137 -29
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +58 -56
- package/js/src/bydfi.d.ts +31 -31
- package/js/src/bydfi.js +102 -100
- package/js/src/gate.js +37 -2
- package/js/src/hollaex.js +1 -1
- package/js/src/kraken.js +39 -29
- package/js/src/kucoin.d.ts +249 -8
- package/js/src/kucoin.js +2161 -462
- package/js/src/lighter.js +2 -2
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +75 -58
- package/js/src/paradex.d.ts +0 -1
- package/js/src/paradex.js +2 -6
- package/js/src/pro/bittrade.js +4 -0
- package/js/src/pro/bydfi.d.ts +18 -18
- package/js/src/pro/bydfi.js +19 -19
- package/js/src/pro/gate.d.ts +2 -2
- package/js/src/pro/gate.js +79 -54
- package/js/src/pro/grvt.js +6 -4
- package/js/src/pro/htx.js +4 -4
- package/js/src/pro/lighter.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/whitebit.d.ts +1 -1
- package/js/src/whitebit.js +21 -2
- package/package.json +2 -2
- package/dist/cjs/src/abstract/coincatch.js +0 -11
- package/dist/cjs/src/coincatch.js +0 -5495
- package/dist/cjs/src/pro/coincatch.js +0 -1563
- package/js/src/abstract/coincatch.d.ts +0 -97
- package/js/src/abstract/coincatch.js +0 -5
- package/js/src/coincatch.d.ts +0 -788
- package/js/src/coincatch.js +0 -5488
- package/js/src/pro/coincatch.d.ts +0 -207
- package/js/src/pro/coincatch.js +0 -1556
package/js/src/bitmex.d.ts
CHANGED
|
@@ -433,6 +433,18 @@ export default class bitmex extends Exchange {
|
|
|
433
433
|
timestamp: number;
|
|
434
434
|
datetime: string;
|
|
435
435
|
};
|
|
436
|
+
/**
|
|
437
|
+
* @method
|
|
438
|
+
* @name bitmex#closePosition
|
|
439
|
+
* @description closes open positions for a market
|
|
440
|
+
* @see https://docs.bitmex.com/api-explorer/order-new
|
|
441
|
+
* @see https://docs.bitmex.com/api-explorer/order-close-position
|
|
442
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
443
|
+
* @param {string} side the buy or sell side of the closing order, if the position is long set the side to sell, reduceOnly is implied
|
|
444
|
+
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
445
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
446
|
+
*/
|
|
447
|
+
closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
|
|
436
448
|
handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
|
|
437
449
|
nonce(): number;
|
|
438
450
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/bitmex.js
CHANGED
|
@@ -3474,6 +3474,52 @@ export default class bitmex extends Exchange {
|
|
|
3474
3474
|
'datetime': datetime,
|
|
3475
3475
|
};
|
|
3476
3476
|
}
|
|
3477
|
+
/**
|
|
3478
|
+
* @method
|
|
3479
|
+
* @name bitmex#closePosition
|
|
3480
|
+
* @description closes open positions for a market
|
|
3481
|
+
* @see https://docs.bitmex.com/api-explorer/order-new
|
|
3482
|
+
* @see https://docs.bitmex.com/api-explorer/order-close-position
|
|
3483
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
3484
|
+
* @param {string} side the buy or sell side of the closing order, if the position is long set the side to sell, reduceOnly is implied
|
|
3485
|
+
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
3486
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3487
|
+
*/
|
|
3488
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
3489
|
+
await this.loadMarkets();
|
|
3490
|
+
const market = this.market(symbol);
|
|
3491
|
+
const request = {
|
|
3492
|
+
'symbol': market['id'],
|
|
3493
|
+
'side': this.capitalize(side),
|
|
3494
|
+
'execInst': 'Close',
|
|
3495
|
+
};
|
|
3496
|
+
const response = await this.privatePostOrder(this.extend(request, params));
|
|
3497
|
+
//
|
|
3498
|
+
// {
|
|
3499
|
+
// "account": 395724,
|
|
3500
|
+
// "avgPx": 66358.8,
|
|
3501
|
+
// "cumQty": 200,
|
|
3502
|
+
// "currency": "USDT",
|
|
3503
|
+
// "execInst": "Close",
|
|
3504
|
+
// "leavesQty": 0,
|
|
3505
|
+
// "ordStatus": "Filled",
|
|
3506
|
+
// "ordType": "Market",
|
|
3507
|
+
// "orderID": "4e1ef998-33c1-4736-b58b-9d8b4d085c49",
|
|
3508
|
+
// "orderQty": 200,
|
|
3509
|
+
// "pool": "Primary",
|
|
3510
|
+
// "settlCurrency": "USDt",
|
|
3511
|
+
// "side": "Sell",
|
|
3512
|
+
// "strategy": "OneWay",
|
|
3513
|
+
// "symbol": "XBTUSDT",
|
|
3514
|
+
// "text": "Submitted via API.",
|
|
3515
|
+
// "timeInForce": "ImmediateOrCancel",
|
|
3516
|
+
// "timestamp": "2026-04-02T05:20:26.607Z",
|
|
3517
|
+
// "transactTime": "2026-04-02T05:20:26.606Z",
|
|
3518
|
+
// "workingIndicator": false
|
|
3519
|
+
// }
|
|
3520
|
+
//
|
|
3521
|
+
return this.parseOrder(response, market);
|
|
3522
|
+
}
|
|
3477
3523
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
3478
3524
|
if (response === undefined) {
|
|
3479
3525
|
return undefined;
|
package/js/src/bitstamp.js
CHANGED
|
@@ -519,7 +519,6 @@ export default class bitstamp extends Exchange {
|
|
|
519
519
|
'Your account is frozen': PermissionDenied,
|
|
520
520
|
'Please update your profile with your FATCA information, before using API.': PermissionDenied,
|
|
521
521
|
'Order not found.': OrderNotFound,
|
|
522
|
-
'Price is more than 20% below market price.': InvalidOrder,
|
|
523
522
|
"Bitstamp.net is under scheduled maintenance. We'll be back soon.": OnMaintenance,
|
|
524
523
|
'Order could not be placed.': ExchangeNotAvailable,
|
|
525
524
|
'Invalid offset.': BadRequest,
|
|
@@ -527,6 +526,7 @@ export default class bitstamp extends Exchange {
|
|
|
527
526
|
},
|
|
528
527
|
'broad': {
|
|
529
528
|
'Minimum order size is': InvalidOrder,
|
|
529
|
+
'Price is more than': InvalidOrder,
|
|
530
530
|
'Check your account balance for details.': InsufficientFunds,
|
|
531
531
|
'Ensure this value has at least': InvalidAddress,
|
|
532
532
|
'Ensure that there are no more than': InvalidOrder, // {"status": "error", "reason": {"amount": ["Ensure that there are no more than 0 decimal places."], "__all__": [""]}}
|
|
@@ -1132,6 +1132,19 @@ export default class bitstamp extends Exchange {
|
|
|
1132
1132
|
priceString = this.safeString(trade, priceId, priceString);
|
|
1133
1133
|
amountString = this.safeString(trade, market['baseId'], amountString);
|
|
1134
1134
|
costString = this.safeString(trade, market['quoteId'], costString);
|
|
1135
|
+
// this endpoint is not aligned with "markets" endpoint
|
|
1136
|
+
const baseIdLower = market['baseId'].toLowerCase();
|
|
1137
|
+
const quoteIdLower = market['quoteId'].toLowerCase();
|
|
1138
|
+
const dashedIdLower = baseIdLower + '_' + quoteIdLower;
|
|
1139
|
+
if (priceString === undefined) {
|
|
1140
|
+
priceString = this.safeString(trade, dashedIdLower);
|
|
1141
|
+
}
|
|
1142
|
+
if (amountString === undefined) {
|
|
1143
|
+
amountString = this.safeString(trade, baseIdLower);
|
|
1144
|
+
}
|
|
1145
|
+
if (costString === undefined) {
|
|
1146
|
+
costString = this.safeString(trade, quoteIdLower);
|
|
1147
|
+
}
|
|
1135
1148
|
symbol = market['symbol'];
|
|
1136
1149
|
const datetimeString = this.safeString2(trade, 'date', 'datetime');
|
|
1137
1150
|
let timestamp = undefined;
|
package/js/src/bittrade.js
CHANGED
|
@@ -1212,7 +1212,7 @@ export default class bittrade extends Exchange {
|
|
|
1212
1212
|
const response = await this[method](this.extend(request, params));
|
|
1213
1213
|
//
|
|
1214
1214
|
// { "status": "ok",
|
|
1215
|
-
// "data": [ { id:
|
|
1215
|
+
// "data": [ { id: 13997833015,
|
|
1216
1216
|
// "symbol": "ethbtc",
|
|
1217
1217
|
// "account-id": 3398321,
|
|
1218
1218
|
// "amount": "0.045000000000000000",
|
package/js/src/blofin.d.ts
CHANGED
|
@@ -213,6 +213,8 @@ export default class blofin extends Exchange {
|
|
|
213
213
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
214
214
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
215
215
|
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
216
|
+
* @param {string} [params.type] 'swap' or 'spot' (defaults to 'swap'), required to fetch spot trade history
|
|
217
|
+
* @param {string} [params.instId] *spot markets only* the market id of the spot market to fetch the trade history for (e.g. 'BTC-USDT')
|
|
216
218
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
217
219
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=trade-structure}
|
|
218
220
|
*/
|
package/js/src/blofin.js
CHANGED
|
@@ -175,35 +175,52 @@ export default class blofin extends Exchange {
|
|
|
175
175
|
'market/tickers': 1,
|
|
176
176
|
'market/books': 1,
|
|
177
177
|
'market/trades': 1,
|
|
178
|
-
'market/candles': 1,
|
|
179
178
|
'market/mark-price': 1,
|
|
180
179
|
'market/funding-rate': 1,
|
|
181
180
|
'market/funding-rate-history': 1,
|
|
181
|
+
'market/candles': 1,
|
|
182
|
+
'market/index-candles': 1,
|
|
183
|
+
'market/mark-price-candles': 1,
|
|
184
|
+
'market/position-tiers': 1,
|
|
182
185
|
},
|
|
183
186
|
},
|
|
184
187
|
'private': {
|
|
185
188
|
'get': {
|
|
189
|
+
// account
|
|
186
190
|
'asset/balances': 1,
|
|
187
|
-
'trade/orders-pending': 1,
|
|
188
|
-
'trade/fills-history': 1,
|
|
189
|
-
'asset/deposit-history': 1,
|
|
190
|
-
'asset/withdrawal-history': 1,
|
|
191
191
|
'asset/bills': 1,
|
|
192
|
+
'asset/withdrawal-history': 1,
|
|
193
|
+
'asset/deposit-history': 1,
|
|
194
|
+
'account/config': 1,
|
|
195
|
+
'asset/currencies': 1,
|
|
196
|
+
// trading
|
|
192
197
|
'account/balance': 1,
|
|
193
198
|
'account/positions': 1,
|
|
194
|
-
'account/
|
|
199
|
+
'account/positions-history': 1,
|
|
195
200
|
'account/margin-mode': 1,
|
|
196
201
|
'account/position-mode': 1,
|
|
202
|
+
'account/leverage-info': 1,
|
|
197
203
|
'account/batch-leverage-info': 1,
|
|
204
|
+
'trade/orders-pending': 1,
|
|
205
|
+
'trade/order-detail': 1,
|
|
198
206
|
'trade/orders-tpsl-pending': 1,
|
|
207
|
+
'trade/order-tpsl-detail': 1,
|
|
199
208
|
'trade/orders-algo-pending': 1,
|
|
200
209
|
'trade/orders-history': 1,
|
|
201
210
|
'trade/orders-tpsl-history': 1,
|
|
202
211
|
'trade/orders-algo-history': 1,
|
|
212
|
+
'trade/fills-history': 1,
|
|
203
213
|
'trade/order/price-range': 1,
|
|
204
|
-
|
|
214
|
+
// affiliate
|
|
205
215
|
'affiliate/basic': 1,
|
|
216
|
+
'affiliate/referral-code': 1,
|
|
217
|
+
'affiliate/invitees': 1,
|
|
218
|
+
'affiliate/sub-invitees': 1,
|
|
219
|
+
'affiliate/sub-affiliates': 1,
|
|
220
|
+
'affiliate/invitees/daily/info': 1,
|
|
221
|
+
// copy trading
|
|
206
222
|
'copytrading/instruments': 1,
|
|
223
|
+
'copytrading/config': 1,
|
|
207
224
|
'copytrading/account/balance': 1,
|
|
208
225
|
'copytrading/account/positions-by-order': 1,
|
|
209
226
|
'copytrading/account/positions-details-by-order': 1,
|
|
@@ -215,21 +232,29 @@ export default class blofin extends Exchange {
|
|
|
215
232
|
'copytrading/trade/position-history-by-order': 1,
|
|
216
233
|
'copytrading/trade/orders-history': 1,
|
|
217
234
|
'copytrading/trade/pending-tpsl-by-order': 1,
|
|
235
|
+
// user
|
|
236
|
+
'user/query-apikey': 1,
|
|
237
|
+
// tax
|
|
238
|
+
'spot/trade/fills-history': 1,
|
|
218
239
|
},
|
|
219
240
|
'post': {
|
|
241
|
+
// account
|
|
242
|
+
'asset/transfer': 1,
|
|
243
|
+
'asset/demo-apply-money': 1,
|
|
244
|
+
// trading
|
|
220
245
|
'account/set-margin-mode': 1,
|
|
221
246
|
'account/set-position-mode': 1,
|
|
222
|
-
'trade/order': 1,
|
|
223
|
-
'trade/order-algo': 1,
|
|
224
|
-
'trade/cancel-order': 1,
|
|
225
|
-
'trade/cancel-algo': 1,
|
|
226
247
|
'account/set-leverage': 1,
|
|
248
|
+
'trade/order': 1,
|
|
227
249
|
'trade/batch-orders': 1,
|
|
228
250
|
'trade/order-tpsl': 1,
|
|
251
|
+
'trade/order-algo': 1,
|
|
252
|
+
'trade/cancel-order': 1,
|
|
229
253
|
'trade/cancel-batch-orders': 1,
|
|
230
254
|
'trade/cancel-tpsl': 1,
|
|
255
|
+
'trade/cancel-algo': 1,
|
|
231
256
|
'trade/close-position': 1,
|
|
232
|
-
|
|
257
|
+
// copy trading
|
|
233
258
|
'copytrading/account/set-position-mode': 1,
|
|
234
259
|
'copytrading/account/set-leverage': 1,
|
|
235
260
|
'copytrading/trade/place-order': 1,
|
|
@@ -761,6 +786,21 @@ export default class blofin extends Exchange {
|
|
|
761
786
|
// "brokerId": ""
|
|
762
787
|
// }
|
|
763
788
|
//
|
|
789
|
+
// fetchMyTrades spot
|
|
790
|
+
// {
|
|
791
|
+
// "instId": "DOGE-USDT",
|
|
792
|
+
// "tradeId": "6000001623870",
|
|
793
|
+
// "orderId": "6000011777113",
|
|
794
|
+
// "fillPrice": "0.091480000000000000",
|
|
795
|
+
// "fillSize": "30.000000000000000000",
|
|
796
|
+
// "fillPnl": null,
|
|
797
|
+
// "side": "buy",
|
|
798
|
+
// "fee": "0.030000000000000000",
|
|
799
|
+
// "ts": "1775213753407",
|
|
800
|
+
// "brokerId": null,
|
|
801
|
+
// "feeCurrency": "base_currency"
|
|
802
|
+
// }
|
|
803
|
+
//
|
|
764
804
|
const id = this.safeString(trade, 'tradeId');
|
|
765
805
|
const marketId = this.safeString(trade, 'instId');
|
|
766
806
|
market = this.safeMarket(marketId, market, '-');
|
|
@@ -772,27 +812,63 @@ export default class blofin extends Exchange {
|
|
|
772
812
|
const orderId = this.safeString(trade, 'orderId');
|
|
773
813
|
const feeCost = this.safeString(trade, 'fee');
|
|
774
814
|
let fee = undefined;
|
|
815
|
+
let feeCurrency = this.safeString(trade, 'feeCurrency');
|
|
816
|
+
const isSpot = feeCurrency !== undefined;
|
|
817
|
+
if (feeCurrency === undefined) {
|
|
818
|
+
feeCurrency = market['settle'];
|
|
819
|
+
}
|
|
820
|
+
else if (feeCurrency === 'base_currency') {
|
|
821
|
+
feeCurrency = market['base'];
|
|
822
|
+
}
|
|
823
|
+
else if (feeCurrency === 'quote_currency') {
|
|
824
|
+
feeCurrency = market['quote'];
|
|
825
|
+
}
|
|
775
826
|
if (feeCost !== undefined) {
|
|
776
827
|
fee = {
|
|
777
828
|
'cost': feeCost,
|
|
778
|
-
'currency':
|
|
829
|
+
'currency': feeCurrency,
|
|
779
830
|
};
|
|
780
831
|
}
|
|
781
|
-
|
|
782
|
-
'
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
832
|
+
if (isSpot) {
|
|
833
|
+
const spotSymbol = market['base'] + '/' + market['quote'];
|
|
834
|
+
const cost = this.parseNumber(Precise.stringMul(price, amount));
|
|
835
|
+
const result = {
|
|
836
|
+
'info': trade,
|
|
837
|
+
'timestamp': timestamp,
|
|
838
|
+
'datetime': this.iso8601(timestamp),
|
|
839
|
+
'symbol': spotSymbol,
|
|
840
|
+
'id': id,
|
|
841
|
+
'order': orderId,
|
|
842
|
+
'type': undefined,
|
|
843
|
+
'takerOrMaker': undefined,
|
|
844
|
+
'side': side,
|
|
845
|
+
'price': this.parseNumber(price),
|
|
846
|
+
'amount': this.parseNumber(amount),
|
|
847
|
+
'cost': cost,
|
|
848
|
+
'fee': {
|
|
849
|
+
'cost': this.parseNumber(feeCost),
|
|
850
|
+
'currency': feeCurrency,
|
|
851
|
+
},
|
|
852
|
+
};
|
|
853
|
+
return result;
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
return this.safeTrade({
|
|
857
|
+
'info': trade,
|
|
858
|
+
'timestamp': timestamp,
|
|
859
|
+
'datetime': this.iso8601(timestamp),
|
|
860
|
+
'symbol': symbol,
|
|
861
|
+
'id': id,
|
|
862
|
+
'order': orderId,
|
|
863
|
+
'type': undefined,
|
|
864
|
+
'takerOrMaker': undefined,
|
|
865
|
+
'side': side,
|
|
866
|
+
'price': price,
|
|
867
|
+
'amount': amount,
|
|
868
|
+
'cost': undefined,
|
|
869
|
+
'fee': fee,
|
|
870
|
+
}, market);
|
|
871
|
+
}
|
|
796
872
|
}
|
|
797
873
|
/**
|
|
798
874
|
* @method
|
|
@@ -1603,6 +1679,8 @@ export default class blofin extends Exchange {
|
|
|
1603
1679
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
1604
1680
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1605
1681
|
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
1682
|
+
* @param {string} [params.type] 'swap' or 'spot' (defaults to 'swap'), required to fetch spot trade history
|
|
1683
|
+
* @param {string} [params.instId] *spot markets only* the market id of the spot market to fetch the trade history for (e.g. 'BTC-USDT')
|
|
1606
1684
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
1607
1685
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=trade-structure}
|
|
1608
1686
|
*/
|
|
@@ -1623,7 +1701,37 @@ export default class blofin extends Exchange {
|
|
|
1623
1701
|
if (limit !== undefined) {
|
|
1624
1702
|
request['limit'] = limit; // default 100, max 100
|
|
1625
1703
|
}
|
|
1626
|
-
|
|
1704
|
+
let type = 'swap';
|
|
1705
|
+
[type, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params, type);
|
|
1706
|
+
let response = undefined;
|
|
1707
|
+
if (type === 'spot') {
|
|
1708
|
+
request['instType'] = 'SPOT';
|
|
1709
|
+
//
|
|
1710
|
+
// {
|
|
1711
|
+
// "code": "0",
|
|
1712
|
+
// "msg": "success",
|
|
1713
|
+
// "data": [
|
|
1714
|
+
// {
|
|
1715
|
+
// "instId": "DOGE-USDT",
|
|
1716
|
+
// "tradeId": "6000001623870",
|
|
1717
|
+
// "orderId": "6000011777113",
|
|
1718
|
+
// "fillPrice": "0.091480000000000000",
|
|
1719
|
+
// "fillSize": "30.000000000000000000",
|
|
1720
|
+
// "fillPnl": null,
|
|
1721
|
+
// "side": "buy",
|
|
1722
|
+
// "fee": "0.030000000000000000",
|
|
1723
|
+
// "ts": "1775213753407",
|
|
1724
|
+
// "brokerId": null,
|
|
1725
|
+
// "feeCurrency": "base_currency"
|
|
1726
|
+
// }
|
|
1727
|
+
// ]
|
|
1728
|
+
// }
|
|
1729
|
+
//
|
|
1730
|
+
response = await this.privateGetSpotTradeFillsHistory(this.extend(request, params));
|
|
1731
|
+
}
|
|
1732
|
+
else {
|
|
1733
|
+
response = await this.privateGetTradeFillsHistory(this.extend(request, params));
|
|
1734
|
+
}
|
|
1627
1735
|
const data = this.safeList(response, 'data', []);
|
|
1628
1736
|
return this.parseTrades(data, market, since, limit);
|
|
1629
1737
|
}
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export default class bybit extends Exchange {
|
|
|
59
59
|
* @returns {object} an associative dictionary of currencies
|
|
60
60
|
*/
|
|
61
61
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
62
|
+
parseCurrency(currency: Dict): Currency;
|
|
62
63
|
/**
|
|
63
64
|
* @method
|
|
64
65
|
* @name bybit#fetchMarkets
|
package/js/src/bybit.js
CHANGED
|
@@ -1125,8 +1125,12 @@ export default class bybit extends Exchange {
|
|
|
1125
1125
|
'FUND': 'fund',
|
|
1126
1126
|
},
|
|
1127
1127
|
'networks': {
|
|
1128
|
+
'BTC': 'BTC',
|
|
1129
|
+
'ETH': 'ETH',
|
|
1128
1130
|
'ERC20': 'ETH',
|
|
1131
|
+
'TRX': 'TRX',
|
|
1129
1132
|
'TRC20': 'TRX',
|
|
1133
|
+
'BSC': 'BSC',
|
|
1130
1134
|
'BEP20': 'BSC',
|
|
1131
1135
|
'SOL': 'SOL',
|
|
1132
1136
|
'ACA': 'ACA',
|
|
@@ -1175,6 +1179,7 @@ export default class bybit extends Exchange {
|
|
|
1175
1179
|
'OASIS': 'ROSE',
|
|
1176
1180
|
'OMNI': 'OMNI',
|
|
1177
1181
|
'ONE': 'ONE',
|
|
1182
|
+
'OP': 'OP',
|
|
1178
1183
|
'OPTIMISM': 'OP',
|
|
1179
1184
|
'POKT': 'POKT',
|
|
1180
1185
|
'QTUM': 'QTUM',
|
|
@@ -1205,8 +1210,7 @@ export default class bybit extends Exchange {
|
|
|
1205
1210
|
'ETH': 'ERC20',
|
|
1206
1211
|
'TRX': 'TRC20',
|
|
1207
1212
|
'BSC': 'BEP20',
|
|
1208
|
-
'
|
|
1209
|
-
'SPL': 'SOL',
|
|
1213
|
+
'OP': 'OP',
|
|
1210
1214
|
},
|
|
1211
1215
|
'defaultNetwork': 'ERC20',
|
|
1212
1216
|
'defaultNetworks': {
|
|
@@ -1702,68 +1706,66 @@ export default class bybit extends Exchange {
|
|
|
1702
1706
|
//
|
|
1703
1707
|
const data = this.safeDict(response, 'result', {});
|
|
1704
1708
|
const rows = this.safeList(data, 'rows', []);
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
'active': undefined,
|
|
1722
|
-
'deposit': this.safeInteger(chain, 'chainDeposit') === 1,
|
|
1723
|
-
'withdraw': this.safeInteger(chain, 'chainWithdraw') === 1,
|
|
1724
|
-
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
1725
|
-
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'minAccuracy'))),
|
|
1726
|
-
'limits': {
|
|
1727
|
-
'withdraw': {
|
|
1728
|
-
'min': this.safeNumber(chain, 'withdrawMin'),
|
|
1729
|
-
'max': undefined,
|
|
1730
|
-
},
|
|
1731
|
-
'deposit': {
|
|
1732
|
-
'min': this.safeNumber(chain, 'depositMin'),
|
|
1733
|
-
'max': undefined,
|
|
1734
|
-
},
|
|
1735
|
-
},
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
result[code] = this.safeCurrencyStructure({
|
|
1739
|
-
'info': currency,
|
|
1740
|
-
'code': code,
|
|
1741
|
-
'id': currencyId,
|
|
1742
|
-
'name': name,
|
|
1709
|
+
return this.parseCurrencies(rows);
|
|
1710
|
+
}
|
|
1711
|
+
parseCurrency(currency) {
|
|
1712
|
+
const currencyId = this.safeString(currency, 'coin');
|
|
1713
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
1714
|
+
const name = this.safeString(currency, 'name');
|
|
1715
|
+
const chains = this.safeList(currency, 'chains', []);
|
|
1716
|
+
const networks = {};
|
|
1717
|
+
for (let j = 0; j < chains.length; j++) {
|
|
1718
|
+
const chain = chains[j];
|
|
1719
|
+
const networkId = this.safeString(chain, 'chain');
|
|
1720
|
+
const networkCode = this.networkIdToCode(networkId, code);
|
|
1721
|
+
networks[networkCode] = {
|
|
1722
|
+
'info': chain,
|
|
1723
|
+
'id': networkId,
|
|
1724
|
+
'network': networkCode,
|
|
1743
1725
|
'active': undefined,
|
|
1744
|
-
'deposit':
|
|
1745
|
-
'withdraw':
|
|
1746
|
-
'fee':
|
|
1747
|
-
'precision':
|
|
1726
|
+
'deposit': this.safeInteger(chain, 'chainDeposit') === 1,
|
|
1727
|
+
'withdraw': this.safeInteger(chain, 'chainWithdraw') === 1,
|
|
1728
|
+
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
1729
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'minAccuracy'))),
|
|
1748
1730
|
'limits': {
|
|
1749
|
-
'amount': {
|
|
1750
|
-
'min': undefined,
|
|
1751
|
-
'max': undefined,
|
|
1752
|
-
},
|
|
1753
1731
|
'withdraw': {
|
|
1754
|
-
'min':
|
|
1732
|
+
'min': this.safeNumber(chain, 'withdrawMin'),
|
|
1755
1733
|
'max': undefined,
|
|
1756
1734
|
},
|
|
1757
1735
|
'deposit': {
|
|
1758
|
-
'min':
|
|
1736
|
+
'min': this.safeNumber(chain, 'depositMin'),
|
|
1759
1737
|
'max': undefined,
|
|
1760
1738
|
},
|
|
1761
1739
|
},
|
|
1762
|
-
|
|
1763
|
-
'type': 'crypto', // atm exchange api provides only cryptos
|
|
1764
|
-
});
|
|
1740
|
+
};
|
|
1765
1741
|
}
|
|
1766
|
-
return
|
|
1742
|
+
return this.safeCurrencyStructure({
|
|
1743
|
+
'info': currency,
|
|
1744
|
+
'code': code,
|
|
1745
|
+
'id': currencyId,
|
|
1746
|
+
'name': name,
|
|
1747
|
+
'active': undefined,
|
|
1748
|
+
'deposit': undefined,
|
|
1749
|
+
'withdraw': undefined,
|
|
1750
|
+
'fee': undefined,
|
|
1751
|
+
'precision': undefined,
|
|
1752
|
+
'limits': {
|
|
1753
|
+
'amount': {
|
|
1754
|
+
'min': undefined,
|
|
1755
|
+
'max': undefined,
|
|
1756
|
+
},
|
|
1757
|
+
'withdraw': {
|
|
1758
|
+
'min': undefined,
|
|
1759
|
+
'max': undefined,
|
|
1760
|
+
},
|
|
1761
|
+
'deposit': {
|
|
1762
|
+
'min': undefined,
|
|
1763
|
+
'max': undefined,
|
|
1764
|
+
},
|
|
1765
|
+
},
|
|
1766
|
+
'networks': networks,
|
|
1767
|
+
'type': 'crypto', // atm exchange api provides only cryptos
|
|
1768
|
+
});
|
|
1767
1769
|
}
|
|
1768
1770
|
/**
|
|
1769
1771
|
* @method
|
|
@@ -6072,7 +6074,7 @@ export default class bybit extends Exchange {
|
|
|
6072
6074
|
'txid': this.safeString(transaction, 'txID'),
|
|
6073
6075
|
'timestamp': timestamp,
|
|
6074
6076
|
'datetime': this.iso8601(timestamp),
|
|
6075
|
-
'network': this.networkIdToCode(this.safeString(transaction, 'chain')),
|
|
6077
|
+
'network': this.networkIdToCode(this.safeString(transaction, 'chain'), code),
|
|
6076
6078
|
'address': undefined,
|
|
6077
6079
|
'addressTo': toAddress,
|
|
6078
6080
|
'addressFrom': undefined,
|
|
@@ -6409,7 +6411,7 @@ export default class bybit extends Exchange {
|
|
|
6409
6411
|
request['tag'] = tag;
|
|
6410
6412
|
}
|
|
6411
6413
|
const [networkCode, query] = this.handleNetworkCodeAndParams(params);
|
|
6412
|
-
const networkId = this.networkCodeToId(networkCode);
|
|
6414
|
+
const networkId = this.networkCodeToId(networkCode, code);
|
|
6413
6415
|
if (networkId !== undefined) {
|
|
6414
6416
|
request['chain'] = networkId.toUpperCase();
|
|
6415
6417
|
}
|