ccxt 4.2.46 → 4.2.48

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.
@@ -43,6 +43,7 @@ class upbit extends upbit$1 {
43
43
  'fetchClosedOrders': true,
44
44
  'fetchDepositAddress': true,
45
45
  'fetchDepositAddresses': true,
46
+ 'fetchDeposit': true,
46
47
  'fetchDeposits': true,
47
48
  'fetchFundingHistory': false,
48
49
  'fetchFundingRate': false,
@@ -68,6 +69,7 @@ class upbit extends upbit$1 {
68
69
  'fetchTradingFee': true,
69
70
  'fetchTradingFees': false,
70
71
  'fetchTransactions': false,
72
+ 'fetchWithdrawal': true,
71
73
  'fetchWithdrawals': true,
72
74
  'transfer': false,
73
75
  'withdraw': true,
@@ -1193,6 +1195,45 @@ class upbit extends upbit$1 {
1193
1195
  //
1194
1196
  return this.parseTransactions(response, currency, since, limit);
1195
1197
  }
1198
+ async fetchDeposit(id, code = undefined, params = {}) {
1199
+ /**
1200
+ * @method
1201
+ * @name upbit#fetchDeposit
1202
+ * @description fetch information on a deposit
1203
+ * @see https://global-docs.upbit.com/reference/individual-deposit-inquiry
1204
+ * @param {string} id the unique id for the deposit
1205
+ * @param {string} [code] unified currency code of the currency deposited
1206
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1207
+ * @param {string} [params.txid] withdrawal transaction id, the id argument is reserved for uuid
1208
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1209
+ */
1210
+ await this.loadMarkets();
1211
+ const request = {
1212
+ 'uuid': id,
1213
+ };
1214
+ let currency = undefined;
1215
+ if (code !== undefined) {
1216
+ currency = this.currency(code);
1217
+ request['currency'] = currency['id'];
1218
+ }
1219
+ const response = await this.privateGetDeposit(this.extend(request, params));
1220
+ //
1221
+ // {
1222
+ // "type": "deposit",
1223
+ // "uuid": "7f54527e-2eee-4268-860e-fd8b9d7fe3c7",
1224
+ // "currency": "ADA",
1225
+ // "net_type": "ADA",
1226
+ // "txid": "99795bbfeca91eaa071068bb659b33eeb65d8aaff2551fdf7c78f345d188952b",
1227
+ // "state": "ACCEPTED",
1228
+ // "created_at": "2023-12-12T04:58:41Z",
1229
+ // "done_at": "2023-12-12T05:31:50Z",
1230
+ // "amount": "35.72344",
1231
+ // "fee": "0.0",
1232
+ // "transaction_type": "default"
1233
+ // }
1234
+ //
1235
+ return this.parseTransaction(response, currency);
1236
+ }
1196
1237
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1197
1238
  /**
1198
1239
  * @method
@@ -1237,13 +1278,52 @@ class upbit extends upbit$1 {
1237
1278
  //
1238
1279
  return this.parseTransactions(response, currency, since, limit);
1239
1280
  }
1281
+ async fetchWithdrawal(id, code = undefined, params = {}) {
1282
+ /**
1283
+ * @method
1284
+ * @name upbit#fetchWithdrawal
1285
+ * @description fetch data on a currency withdrawal via the withdrawal id
1286
+ * @see https://global-docs.upbit.com/reference/individual-withdrawal-inquiry
1287
+ * @param {string} id the unique id for the withdrawal
1288
+ * @param {string} [code] unified currency code of the currency withdrawn
1289
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1290
+ * @param {string} [params.txid] withdrawal transaction id, the id argument is reserved for uuid
1291
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1292
+ */
1293
+ await this.loadMarkets();
1294
+ const request = {
1295
+ 'uuid': id,
1296
+ };
1297
+ let currency = undefined;
1298
+ if (code !== undefined) {
1299
+ currency = this.currency(code);
1300
+ request['currency'] = currency['id'];
1301
+ }
1302
+ const response = await this.privateGetWithdraw(this.extend(request, params));
1303
+ //
1304
+ // {
1305
+ // "type": "withdraw",
1306
+ // "uuid": "95ef274b-23a6-4de4-95b0-5cbef4ca658f",
1307
+ // "currency": "ADA",
1308
+ // "net_type": "ADA",
1309
+ // "txid": "b1528f149297a71671b86636f731f8fdb0ff53da0f1d8c19093d59df96f34583",
1310
+ // "state": "DONE",
1311
+ // "created_at": "2023-12-14T02:46:52Z",
1312
+ // "done_at": "2023-12-14T03:10:11Z",
1313
+ // "amount": "35.22344",
1314
+ // "fee": "0.5",
1315
+ // "transaction_type": "default"
1316
+ // }
1317
+ //
1318
+ return this.parseTransaction(response, currency);
1319
+ }
1240
1320
  parseTransactionStatus(status) {
1241
1321
  const statuses = {
1242
1322
  'submitting': 'pending',
1243
1323
  'submitted': 'pending',
1244
1324
  'almost_accepted': 'pending',
1245
1325
  'rejected': 'failed',
1246
- 'accepted': 'pending',
1326
+ 'accepted': 'ok',
1247
1327
  'processing': 'pending',
1248
1328
  'done': 'ok',
1249
1329
  'canceled': 'canceled', // 취소됨
@@ -1252,7 +1332,7 @@ class upbit extends upbit$1 {
1252
1332
  }
1253
1333
  parseTransaction(transaction, currency = undefined) {
1254
1334
  //
1255
- // fetchDeposits
1335
+ // fetchDeposits, fetchDeposit
1256
1336
  //
1257
1337
  // {
1258
1338
  // "type": "deposit",
@@ -1266,7 +1346,7 @@ class upbit extends upbit$1 {
1266
1346
  // "fee": "0.0"
1267
1347
  // }
1268
1348
  //
1269
- // fetchWithdrawals
1349
+ // fetchWithdrawals, fetchWithdrawal
1270
1350
  //
1271
1351
  // {
1272
1352
  // "type": "withdraw",
@@ -1281,27 +1361,21 @@ class upbit extends upbit$1 {
1281
1361
  // "krw_amount": "80420.0"
1282
1362
  // }
1283
1363
  //
1284
- const id = this.safeString(transaction, 'uuid');
1285
- const amount = this.safeNumber(transaction, 'amount');
1286
1364
  const address = undefined; // not present in the data structure received from the exchange
1287
1365
  const tag = undefined; // not present in the data structure received from the exchange
1288
- const txid = this.safeString(transaction, 'txid');
1289
1366
  const updatedRaw = this.safeString(transaction, 'done_at');
1290
- const updated = this.parse8601(updatedRaw);
1291
1367
  const timestamp = this.parse8601(this.safeString(transaction, 'created_at', updatedRaw));
1292
1368
  let type = this.safeString(transaction, 'type');
1293
1369
  if (type === 'withdraw') {
1294
1370
  type = 'withdrawal';
1295
1371
  }
1296
1372
  const currencyId = this.safeString(transaction, 'currency');
1297
- const code = this.safeCurrencyCode(currencyId);
1298
- const status = this.parseTransactionStatus(this.safeStringLower(transaction, 'state'));
1299
- const feeCost = this.safeNumber(transaction, 'fee');
1373
+ const code = this.safeCurrencyCode(currencyId, currency);
1300
1374
  return {
1301
1375
  'info': transaction,
1302
- 'id': id,
1376
+ 'id': this.safeString(transaction, 'uuid'),
1303
1377
  'currency': code,
1304
- 'amount': amount,
1378
+ 'amount': this.safeNumber(transaction, 'amount'),
1305
1379
  'network': undefined,
1306
1380
  'address': address,
1307
1381
  'addressTo': undefined,
@@ -1309,17 +1383,17 @@ class upbit extends upbit$1 {
1309
1383
  'tag': tag,
1310
1384
  'tagTo': undefined,
1311
1385
  'tagFrom': undefined,
1312
- 'status': status,
1386
+ 'status': this.parseTransactionStatus(this.safeStringLower(transaction, 'state')),
1313
1387
  'type': type,
1314
- 'updated': updated,
1315
- 'txid': txid,
1388
+ 'updated': this.parse8601(updatedRaw),
1389
+ 'txid': this.safeString(transaction, 'txid'),
1316
1390
  'timestamp': timestamp,
1317
1391
  'datetime': this.iso8601(timestamp),
1318
1392
  'internal': undefined,
1319
1393
  'comment': undefined,
1320
1394
  'fee': {
1321
1395
  'currency': code,
1322
- 'cost': feeCost,
1396
+ 'cost': this.safeNumber(transaction, 'fee'),
1323
1397
  },
1324
1398
  };
1325
1399
  }
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 } 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.45";
7
+ declare const version = "4.2.47";
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.46';
41
+ const version = '4.2.48';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -12,6 +12,9 @@ interface Exchange {
12
12
  publicGetTrades(params?: {}): Promise<implicitReturnType>;
13
13
  publicGetChart(params?: {}): Promise<implicitReturnType>;
14
14
  publicGetCharts(params?: {}): Promise<implicitReturnType>;
15
+ publicGetMinicharts(params?: {}): Promise<implicitReturnType>;
16
+ publicGetOraclePrices(params?: {}): Promise<implicitReturnType>;
17
+ publicGetQuickTrade(params?: {}): Promise<implicitReturnType>;
15
18
  publicGetUdfConfig(params?: {}): Promise<implicitReturnType>;
16
19
  publicGetUdfHistory(params?: {}): Promise<implicitReturnType>;
17
20
  publicGetUdfSymbols(params?: {}): Promise<implicitReturnType>;
@@ -1,14 +1,15 @@
1
1
  import { implicitReturnType } from '../base/types.js';
2
2
  import { Exchange as _Exchange } from '../base/Exchange.js';
3
3
  interface Exchange {
4
- publicGetServerTime(params?: {}): Promise<implicitReturnType>;
5
- publicGetPairs(params?: {}): Promise<implicitReturnType>;
6
- publicGetPriceIncrements(params?: {}): Promise<implicitReturnType>;
7
- publicGetSummaries(params?: {}): Promise<implicitReturnType>;
8
- publicGetTickerAll(params?: {}): Promise<implicitReturnType>;
9
- publicGetPairTicker(params?: {}): Promise<implicitReturnType>;
10
- publicGetPairTrades(params?: {}): Promise<implicitReturnType>;
11
- publicGetPairDepth(params?: {}): Promise<implicitReturnType>;
4
+ publicGetApiServerTime(params?: {}): Promise<implicitReturnType>;
5
+ publicGetApiPairs(params?: {}): Promise<implicitReturnType>;
6
+ publicGetApiPriceIncrements(params?: {}): Promise<implicitReturnType>;
7
+ publicGetApiSummaries(params?: {}): Promise<implicitReturnType>;
8
+ publicGetApiTickerPair(params?: {}): Promise<implicitReturnType>;
9
+ publicGetApiTickerAll(params?: {}): Promise<implicitReturnType>;
10
+ publicGetApiTradesPair(params?: {}): Promise<implicitReturnType>;
11
+ publicGetApiDepthPair(params?: {}): Promise<implicitReturnType>;
12
+ publicGetTradingviewHistoryV2(params?: {}): Promise<implicitReturnType>;
12
13
  privatePostGetInfo(params?: {}): Promise<implicitReturnType>;
13
14
  privatePostTransHistory(params?: {}): Promise<implicitReturnType>;
14
15
  privatePostTrade(params?: {}): Promise<implicitReturnType>;
package/js/src/binance.js CHANGED
@@ -5774,12 +5774,14 @@ export default class binance extends Exchange {
5774
5774
  const trailingDelta = this.safeString(params, 'trailingDelta');
5775
5775
  const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
5776
5776
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
5777
+ const priceMatch = this.safeString(params, 'priceMatch');
5777
5778
  const isTrailingPercentOrder = trailingPercent !== undefined;
5778
5779
  const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
5779
5780
  const isTakeProfit = takeProfitPrice !== undefined;
5780
5781
  const isTriggerOrder = triggerPrice !== undefined;
5781
5782
  const isConditional = isTriggerOrder || isTrailingPercentOrder || isStopLoss || isTakeProfit;
5782
5783
  const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
5784
+ const isPriceMatch = priceMatch !== undefined;
5783
5785
  let uppercaseType = type.toUpperCase();
5784
5786
  let stopPrice = undefined;
5785
5787
  if (isTrailingPercentOrder) {
@@ -5960,7 +5962,7 @@ export default class binance extends Exchange {
5960
5962
  request['quantity'] = this.amountToPrecision(symbol, amount);
5961
5963
  }
5962
5964
  }
5963
- if (priceIsRequired) {
5965
+ if (priceIsRequired && !isPriceMatch) {
5964
5966
  if (price === undefined) {
5965
5967
  throw new InvalidOrder(this.id + ' createOrder() requires a price argument for a ' + type + ' order');
5966
5968
  }
package/js/src/bybit.d.ts CHANGED
@@ -69,8 +69,10 @@ export default class bybit extends Exchange {
69
69
  cancelAllUsdcOrders(symbol?: Str, params?: {}): Promise<any>;
70
70
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
71
71
  fetchUsdcOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
72
+ fetchOrderClassic(id: string, symbol?: Str, params?: {}): Promise<Order>;
72
73
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
73
74
  fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
75
+ fetchOrdersClassic(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
74
76
  fetchClosedOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
75
77
  fetchOpenOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
76
78
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
package/js/src/bybit.js CHANGED
@@ -4482,11 +4482,194 @@ export default class bybit extends Exchange {
4482
4482
  const data = this.safeValue(result, 'dataList', []);
4483
4483
  return this.parseOrders(data, market, since, limit);
4484
4484
  }
4485
+ async fetchOrderClassic(id, symbol = undefined, params = {}) {
4486
+ /**
4487
+ * @method
4488
+ * @name bybit#fetchOrderClassic
4489
+ * @description fetches information on an order made by the user *classic accounts only*
4490
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4491
+ * @param {string} symbol unified symbol of the market the order was made in
4492
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4493
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4494
+ */
4495
+ if (symbol === undefined) {
4496
+ throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
4497
+ }
4498
+ await this.loadMarkets();
4499
+ const market = this.market(symbol);
4500
+ if (market['spot']) {
4501
+ throw new NotSupported(this.id + ' fetchOrder() is not supported for spot markets');
4502
+ }
4503
+ const request = {
4504
+ 'orderId': id,
4505
+ };
4506
+ const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
4507
+ const length = result.length;
4508
+ if (length === 0) {
4509
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
4510
+ const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
4511
+ throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
4512
+ }
4513
+ if (length > 1) {
4514
+ throw new InvalidOrder(this.id + ' returned more than one order');
4515
+ }
4516
+ return this.safeValue(result, 0);
4517
+ }
4485
4518
  async fetchOrder(id, symbol = undefined, params = {}) {
4486
- throw new NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update, please use fetchOpenOrder or fetchClosedOrder');
4519
+ /**
4520
+ * @method
4521
+ * @name bybit#fetchOrderClassic
4522
+ * @description *classic accounts only/ spot not supported* fetches information on an order made by the user *classic accounts only*
4523
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4524
+ * @param {string} symbol unified symbol of the market the order was made in
4525
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4526
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4527
+ */
4528
+ const res = await this.isUnifiedEnabled();
4529
+ const enableUnifiedAccount = this.safeBool(res, 1);
4530
+ if (enableUnifiedAccount) {
4531
+ throw new NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrder or fetchClosedOrder');
4532
+ }
4533
+ return await this.fetchOrderClassic(id, symbol, params);
4487
4534
  }
4488
4535
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4489
- throw new NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
4536
+ const res = await this.isUnifiedEnabled();
4537
+ /**
4538
+ * @method
4539
+ * @name bybit#fetchOrders
4540
+ * @description *classic accounts only/ spot not supported* fetches information on multiple orders made by the user *classic accounts only/ spot not supported*
4541
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4542
+ * @param {string} symbol unified market symbol of the market orders were made in
4543
+ * @param {int} [since] the earliest time in ms to fetch orders for
4544
+ * @param {int} [limit] the maximum number of order structures to retrieve
4545
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4546
+ * @param {boolean} [params.stop] true if stop order
4547
+ * @param {string} [params.type] market type, ['swap', 'option']
4548
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4549
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4550
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4551
+ * @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)
4552
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4553
+ */
4554
+ const enableUnifiedAccount = this.safeBool(res, 1);
4555
+ if (enableUnifiedAccount) {
4556
+ throw new NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
4557
+ }
4558
+ return await this.fetchOrdersClassic(symbol, since, limit, params);
4559
+ }
4560
+ async fetchOrdersClassic(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4561
+ /**
4562
+ * @method
4563
+ * @name bybit#fetchOrders
4564
+ * @description fetches information on multiple orders made by the user *classic accounts only*
4565
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4566
+ * @param {string} symbol unified market symbol of the market orders were made in
4567
+ * @param {int} [since] the earliest time in ms to fetch orders for
4568
+ * @param {int} [limit] the maximum number of order structures to retrieve
4569
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4570
+ * @param {boolean} [params.stop] true if stop order
4571
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4572
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4573
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4574
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4575
+ * @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)
4576
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4577
+ */
4578
+ await this.loadMarkets();
4579
+ let paginate = false;
4580
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
4581
+ if (paginate) {
4582
+ return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
4583
+ }
4584
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4585
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4586
+ const request = {};
4587
+ let market = undefined;
4588
+ let isUsdcSettled = false;
4589
+ if (symbol !== undefined) {
4590
+ market = this.market(symbol);
4591
+ isUsdcSettled = market['settle'] === 'USDC';
4592
+ request['symbol'] = market['id'];
4593
+ }
4594
+ let type = undefined;
4595
+ [type, params] = this.getBybitType('fetchOrders', market, params);
4596
+ if (((type === 'option') || isUsdcSettled) && !isUnifiedAccount) {
4597
+ return await this.fetchUsdcOrders(symbol, since, limit, params);
4598
+ }
4599
+ if (type === 'spot') {
4600
+ throw new NotSupported(this.id + ' fetchOrders() is not supported for spot markets');
4601
+ }
4602
+ request['category'] = type;
4603
+ const isStop = this.safeBoolN(params, ['trigger', 'stop'], false);
4604
+ params = this.omit(params, ['trigger', 'stop']);
4605
+ if (isStop) {
4606
+ request['orderFilter'] = 'StopOrder';
4607
+ }
4608
+ if (limit !== undefined) {
4609
+ request['limit'] = limit;
4610
+ }
4611
+ if (since !== undefined) {
4612
+ request['startTime'] = since;
4613
+ }
4614
+ const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
4615
+ const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
4616
+ params = this.omit(params, ['endTime', 'till', 'until']);
4617
+ if (endTime !== undefined) {
4618
+ request['endTime'] = endTime;
4619
+ }
4620
+ const response = await this.privateGetV5OrderHistory(this.extend(request, params));
4621
+ //
4622
+ // {
4623
+ // "retCode": 0,
4624
+ // "retMsg": "OK",
4625
+ // "result": {
4626
+ // "nextPageCursor": "03234de9-1332-41eb-b805-4a9f42c136a3%3A1672220109387%2C03234de9-1332-41eb-b805-4a9f42c136a3%3A1672220109387",
4627
+ // "category": "linear",
4628
+ // "list": [
4629
+ // {
4630
+ // "symbol": "BTCUSDT",
4631
+ // "orderType": "Limit",
4632
+ // "orderLinkId": "test-001",
4633
+ // "orderId": "03234de9-1332-41eb-b805-4a9f42c136a3",
4634
+ // "cancelType": "CancelByUser",
4635
+ // "avgPrice": "0",
4636
+ // "stopOrderType": "UNKNOWN",
4637
+ // "lastPriceOnCreated": "16656.5",
4638
+ // "orderStatus": "Cancelled",
4639
+ // "takeProfit": "",
4640
+ // "cumExecValue": "0",
4641
+ // "triggerDirection": 0,
4642
+ // "blockTradeId": "",
4643
+ // "rejectReason": "EC_PerCancelRequest",
4644
+ // "isLeverage": "",
4645
+ // "price": "18000",
4646
+ // "orderIv": "",
4647
+ // "createdTime": "1672220109387",
4648
+ // "tpTriggerBy": "UNKNOWN",
4649
+ // "positionIdx": 0,
4650
+ // "timeInForce": "GoodTillCancel",
4651
+ // "leavesValue": "0",
4652
+ // "updatedTime": "1672220114123",
4653
+ // "side": "Sell",
4654
+ // "triggerPrice": "",
4655
+ // "cumExecFee": "0",
4656
+ // "slTriggerBy": "UNKNOWN",
4657
+ // "leavesQty": "0",
4658
+ // "closeOnTrigger": false,
4659
+ // "cumExecQty": "0",
4660
+ // "reduceOnly": false,
4661
+ // "qty": "0.1",
4662
+ // "stopLoss": "",
4663
+ // "triggerBy": "UNKNOWN"
4664
+ // }
4665
+ // ]
4666
+ // },
4667
+ // "retExtInfo": {},
4668
+ // "time": 1672221263862
4669
+ // }
4670
+ //
4671
+ const data = this.addPaginationCursorToResult(response);
4672
+ return this.parseOrders(data, market, since, limit);
4490
4673
  }
4491
4674
  async fetchClosedOrder(id, symbol = undefined, params = {}) {
4492
4675
  /**