ccxt 4.3.94 → 4.3.95

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.
@@ -324,6 +324,7 @@ class okx extends okx$1 {
324
324
  'account/account-position-risk': 2,
325
325
  'account/bills': 5 / 3,
326
326
  'account/bills-archive': 5 / 3,
327
+ 'account/bills-history-archive': 2,
327
328
  'account/config': 4,
328
329
  'account/max-size': 1,
329
330
  'account/max-avail-size': 1,
@@ -478,6 +479,7 @@ class okx extends okx$1 {
478
479
  'account/fixed-loan/amend-borrowing-order': 5,
479
480
  'account/fixed-loan/manual-reborrow': 5,
480
481
  'account/fixed-loan/repay-borrowing-order': 5,
482
+ 'account/bills-history-archive': 72000,
481
483
  // subaccount
482
484
  'users/subaccount/modify-apikey': 10,
483
485
  'asset/subaccount/transfer': 10,
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.3.93";
7
+ declare const version = "4.3.94";
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.94';
41
+ const version = '4.3.95';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -126,6 +126,7 @@ interface Exchange {
126
126
  privateGetAccountAccountPositionRisk(params?: {}): Promise<implicitReturnType>;
127
127
  privateGetAccountBills(params?: {}): Promise<implicitReturnType>;
128
128
  privateGetAccountBillsArchive(params?: {}): Promise<implicitReturnType>;
129
+ privateGetAccountBillsHistoryArchive(params?: {}): Promise<implicitReturnType>;
129
130
  privateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
130
131
  privateGetAccountMaxSize(params?: {}): Promise<implicitReturnType>;
131
132
  privateGetAccountMaxAvailSize(params?: {}): Promise<implicitReturnType>;
@@ -266,6 +267,7 @@ interface Exchange {
266
267
  privatePostAccountFixedLoanAmendBorrowingOrder(params?: {}): Promise<implicitReturnType>;
267
268
  privatePostAccountFixedLoanManualReborrow(params?: {}): Promise<implicitReturnType>;
268
269
  privatePostAccountFixedLoanRepayBorrowingOrder(params?: {}): Promise<implicitReturnType>;
270
+ privatePostAccountBillsHistoryArchive(params?: {}): Promise<implicitReturnType>;
269
271
  privatePostUsersSubaccountModifyApikey(params?: {}): Promise<implicitReturnType>;
270
272
  privatePostAssetSubaccountTransfer(params?: {}): Promise<implicitReturnType>;
271
273
  privatePostUsersSubaccountSetTransferOut(params?: {}): Promise<implicitReturnType>;
@@ -388,7 +388,7 @@ export default class ascendex extends Exchange {
388
388
  * @param {object} [params] extra parameters specific to the exchange API endpoint
389
389
  * @returns {object} an associative dictionary of currencies
390
390
  */
391
- const assets = await this.v1PublicGetAssets(params);
391
+ const assetsPromise = this.v1PublicGetAssets(params);
392
392
  //
393
393
  // {
394
394
  // "code":0,
@@ -405,7 +405,7 @@ export default class ascendex extends Exchange {
405
405
  // ]
406
406
  // }
407
407
  //
408
- const margin = await this.v1PublicGetMarginAssets(params);
408
+ const marginPromise = this.v1PublicGetMarginAssets(params);
409
409
  //
410
410
  // {
411
411
  // "code":0,
@@ -425,7 +425,7 @@ export default class ascendex extends Exchange {
425
425
  // ]
426
426
  // }
427
427
  //
428
- const cash = await this.v1PublicGetCashAssets(params);
428
+ const cashPromise = this.v1PublicGetCashAssets(params);
429
429
  //
430
430
  // {
431
431
  // "code":0,
@@ -442,6 +442,7 @@ export default class ascendex extends Exchange {
442
442
  // ]
443
443
  // }
444
444
  //
445
+ const [assets, margin, cash] = await Promise.all([assetsPromise, marginPromise, cashPromise]);
445
446
  const assetsData = this.safeList(assets, 'data', []);
446
447
  const marginData = this.safeList(margin, 'data', []);
447
448
  const cashData = this.safeList(cash, 'data', []);
@@ -496,7 +497,7 @@ export default class ascendex extends Exchange {
496
497
  * @param {object} [params] extra parameters specific to the exchange API endpoint
497
498
  * @returns {object[]} an array of objects representing market data
498
499
  */
499
- const products = await this.v1PublicGetProducts(params);
500
+ const productsPromise = this.v1PublicGetProducts(params);
500
501
  //
501
502
  // {
502
503
  // "code": 0,
@@ -517,7 +518,7 @@ export default class ascendex extends Exchange {
517
518
  // ]
518
519
  // }
519
520
  //
520
- const cash = await this.v1PublicGetCashProducts(params);
521
+ const cashPromise = this.v1PublicGetCashProducts(params);
521
522
  //
522
523
  // {
523
524
  // "code": 0,
@@ -547,7 +548,7 @@ export default class ascendex extends Exchange {
547
548
  // ]
548
549
  // }
549
550
  //
550
- const perpetuals = await this.v2PublicGetFuturesContract(params);
551
+ const perpetualsPromise = this.v2PublicGetFuturesContract(params);
551
552
  //
552
553
  // {
553
554
  // "code": 0,
@@ -585,6 +586,7 @@ export default class ascendex extends Exchange {
585
586
  // ]
586
587
  // }
587
588
  //
589
+ const [products, cash, perpetuals] = await Promise.all([productsPromise, cashPromise, perpetualsPromise]);
588
590
  const productsData = this.safeList(products, 'data', []);
589
591
  const productsById = this.indexBy(productsData, 'symbol');
590
592
  const cashData = this.safeList(cash, 'data', []);
@@ -880,7 +880,7 @@ export default class Exchange {
880
880
  selectNetworkKeyFromNetworks(currencyCode: any, networkCode: any, indexedNetworkEntries: any, isIndexedByUnifiedNetworkCode?: boolean): any;
881
881
  safeNumber2(dictionary: object, key1: IndexType, key2: IndexType, d?: any): number;
882
882
  parseOrderBook(orderbook: object, symbol: string, timestamp?: Int, bidsKey?: string, asksKey?: string, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): OrderBook;
883
- parseOHLCVs(ohlcvs: object[], market?: any, timeframe?: string, since?: Int, limit?: Int): OHLCV[];
883
+ parseOHLCVs(ohlcvs: object[], market?: any, timeframe?: string, since?: Int, limit?: Int, tail?: Bool): OHLCV[];
884
884
  parseLeverageTiers(response: any, symbols?: string[], marketIdKey?: any): LeverageTiers;
885
885
  loadTradingLimits(symbols?: Strings, reload?: boolean, params?: {}): Promise<Dictionary<any>>;
886
886
  safePosition(position: Dict): Position;
@@ -3453,7 +3453,7 @@ export default class Exchange {
3453
3453
  if (currencyCode === undefined) {
3454
3454
  const currencies = Object.values(this.currencies);
3455
3455
  for (let i = 0; i < currencies.length; i++) {
3456
- const currency = [i];
3456
+ const currency = currencies[i];
3457
3457
  const networks = this.safeDict(currency, 'networks');
3458
3458
  const network = this.safeDict(networks, networkCode);
3459
3459
  networkId = this.safeString(network, 'id');
@@ -3598,13 +3598,13 @@ export default class Exchange {
3598
3598
  'nonce': undefined,
3599
3599
  };
3600
3600
  }
3601
- parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined) {
3601
+ parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined, tail = false) {
3602
3602
  const results = [];
3603
3603
  for (let i = 0; i < ohlcvs.length; i++) {
3604
3604
  results.push(this.parseOHLCV(ohlcvs[i], market));
3605
3605
  }
3606
3606
  const sorted = this.sortBy(results, 0);
3607
- return this.filterBySinceLimit(sorted, since, limit, 0);
3607
+ return this.filterBySinceLimit(sorted, since, limit, 0, tail);
3608
3608
  }
3609
3609
  parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
3610
3610
  // marketIdKey should only be undefined when response is a dictionary
@@ -566,11 +566,11 @@ export default class bitfinex extends Exchange {
566
566
  * @param {object} [params] extra parameters specific to the exchange API endpoint
567
567
  * @returns {object[]} an array of objects representing market data
568
568
  */
569
- const ids = await this.publicGetSymbols();
569
+ const idsPromise = this.publicGetSymbols();
570
570
  //
571
571
  // [ "btcusd", "ltcusd", "ltcbtc" ]
572
572
  //
573
- const details = await this.publicGetSymbolsDetails();
573
+ const detailsPromise = this.publicGetSymbolsDetails();
574
574
  //
575
575
  // [
576
576
  // {
@@ -585,6 +585,7 @@ export default class bitfinex extends Exchange {
585
585
  // },
586
586
  // ]
587
587
  //
588
+ const [ids, details] = await Promise.all([idsPromise, detailsPromise]);
588
589
  const result = [];
589
590
  for (let i = 0; i < details.length; i++) {
590
591
  const market = details[i];
@@ -523,12 +523,13 @@ export default class bitfinex2 extends Exchange {
523
523
  * @param {object} [params] extra parameters specific to the exchange API endpoint
524
524
  * @returns {object[]} an array of objects representing market data
525
525
  */
526
- let spotMarketsInfo = await this.publicGetConfPubInfoPair(params);
527
- let futuresMarketsInfo = await this.publicGetConfPubInfoPairFutures(params);
528
- spotMarketsInfo = this.safeValue(spotMarketsInfo, 0, []);
529
- futuresMarketsInfo = this.safeValue(futuresMarketsInfo, 0, []);
526
+ const spotMarketsInfoPromise = this.publicGetConfPubInfoPair(params);
527
+ const futuresMarketsInfoPromise = this.publicGetConfPubInfoPairFutures(params);
528
+ const marginIdsPromise = this.publicGetConfPubListPairMargin(params);
529
+ let [spotMarketsInfo, futuresMarketsInfo, marginIds] = await Promise.all([spotMarketsInfoPromise, futuresMarketsInfoPromise, marginIdsPromise]);
530
+ spotMarketsInfo = this.safeList(spotMarketsInfo, 0, []);
531
+ futuresMarketsInfo = this.safeList(futuresMarketsInfo, 0, []);
530
532
  const markets = this.arrayConcat(spotMarketsInfo, futuresMarketsInfo);
531
- let marginIds = await this.publicGetConfPubListPairMargin(params);
532
533
  marginIds = this.safeValue(marginIds, 0, []);
533
534
  //
534
535
  // [
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/btcturk.js';
2
- import type { Balances, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
2
+ import type { Balances, Bool, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
3
3
  /**
4
4
  * @class btcturk
5
5
  * @augments Exchange
@@ -18,7 +18,7 @@ export default class btcturk extends Exchange {
18
18
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
19
19
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
20
20
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
21
- parseOHLCVs(ohlcvs: any, market?: any, timeframe?: string, since?: Int, limit?: Int): OHLCV[];
21
+ parseOHLCVs(ohlcvs: any, market?: any, timeframe?: string, since?: Int, limit?: Int, tail?: Bool): OHLCV[];
22
22
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
23
23
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
24
24
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
package/js/src/btcturk.js CHANGED
@@ -643,7 +643,7 @@ export default class btcturk extends Exchange {
643
643
  //
644
644
  return this.parseOHLCVs(response, market, timeframe, since, limit);
645
645
  }
646
- parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined) {
646
+ parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined, tail = false) {
647
647
  const results = [];
648
648
  const timestamp = this.safeValue(ohlcvs, 't');
649
649
  const high = this.safeValue(ohlcvs, 'h');
@@ -663,7 +663,7 @@ export default class btcturk extends Exchange {
663
663
  results.push(this.parseOHLCV(ohlcv, market));
664
664
  }
665
665
  const sorted = this.sortBy(results, 0);
666
- return this.filterBySinceLimit(sorted, since, limit, 0);
666
+ return this.filterBySinceLimit(sorted, since, limit, 0, tail);
667
667
  }
668
668
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
669
669
  /**
package/js/src/gate.js CHANGED
@@ -984,8 +984,9 @@ export default class gate extends Exchange {
984
984
  return this.arrayConcat(markets, optionMarkets);
985
985
  }
986
986
  async fetchSpotMarkets(params = {}) {
987
- const marginResponse = await this.publicMarginGetCurrencyPairs(params);
988
- const spotMarketsResponse = await this.publicSpotGetCurrencyPairs(params);
987
+ const marginPromise = this.publicMarginGetCurrencyPairs(params);
988
+ const spotMarketsPromise = this.publicSpotGetCurrencyPairs(params);
989
+ const [marginResponse, spotMarketsResponse] = await Promise.all([marginPromise, spotMarketsPromise]);
989
990
  const marginMarkets = this.indexBy(marginResponse, 'id');
990
991
  //
991
992
  // Spot
package/js/src/gemini.js CHANGED
@@ -845,8 +845,9 @@ export default class gemini extends Exchange {
845
845
  return this.parseTicker(response, market);
846
846
  }
847
847
  async fetchTickerV1AndV2(symbol, params = {}) {
848
- const tickerA = await this.fetchTickerV1(symbol, params);
849
- const tickerB = await this.fetchTickerV2(symbol, params);
848
+ const tickerPromiseA = this.fetchTickerV1(symbol, params);
849
+ const tickerPromiseB = this.fetchTickerV2(symbol, params);
850
+ const [tickerA, tickerB] = await Promise.all([tickerPromiseA, tickerPromiseB]);
850
851
  return this.deepExtend(tickerA, {
851
852
  'open': tickerB['open'],
852
853
  'high': tickerB['high'],
@@ -65,6 +65,9 @@ export default class hyperliquid extends Exchange {
65
65
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
66
66
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
67
67
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
68
+ fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
69
+ fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
70
+ fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
68
71
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
69
72
  parseOrder(order: Dict, market?: Market): Order;
70
73
  parseOrderStatus(status: Str): string;
@@ -57,8 +57,9 @@ export default class hyperliquid extends Exchange {
57
57
  'fetchBorrowInterest': false,
58
58
  'fetchBorrowRateHistories': false,
59
59
  'fetchBorrowRateHistory': false,
60
- 'fetchCanceledOrders': false,
60
+ 'fetchCanceledOrders': true,
61
61
  'fetchClosedOrders': true,
62
+ 'fetchCanceledAndClosedOrders': true,
62
63
  'fetchCrossBorrowRate': false,
63
64
  'fetchCrossBorrowRates': false,
64
65
  'fetchCurrencies': true,
@@ -90,7 +91,7 @@ export default class hyperliquid extends Exchange {
90
91
  'fetchOpenOrders': true,
91
92
  'fetchOrder': true,
92
93
  'fetchOrderBook': true,
93
- 'fetchOrders': false,
94
+ 'fetchOrders': true,
94
95
  'fetchOrderTrades': false,
95
96
  'fetchPosition': true,
96
97
  'fetchPositionMode': false,
@@ -829,6 +830,7 @@ export default class hyperliquid extends Exchange {
829
830
  await this.loadMarkets();
830
831
  const market = this.market(symbol);
831
832
  const until = this.safeInteger(params, 'until', this.milliseconds());
833
+ const useTail = (since === undefined);
832
834
  if (since === undefined) {
833
835
  since = 0;
834
836
  }
@@ -859,7 +861,7 @@ export default class hyperliquid extends Exchange {
859
861
  // }
860
862
  // ]
861
863
  //
862
- return this.parseOHLCVs(response, market, timeframe, since, limit);
864
+ return this.parseOHLCVs(response, market, timeframe, since, limit, useTail);
863
865
  }
864
866
  parseOHLCV(ohlcv, market = undefined) {
865
867
  //
@@ -1734,7 +1736,16 @@ export default class hyperliquid extends Exchange {
1734
1736
  // }
1735
1737
  // ]
1736
1738
  //
1737
- return this.parseOrders(response, market, since, limit);
1739
+ const orderWithStatus = [];
1740
+ for (let i = 0; i < response.length; i++) {
1741
+ const order = response[i];
1742
+ const extendOrder = {};
1743
+ if (this.safeString(order, 'status') === undefined) {
1744
+ extendOrder['ccxtStatus'] = 'open';
1745
+ }
1746
+ orderWithStatus.push(this.extend(order, extendOrder));
1747
+ }
1748
+ return this.parseOrders(orderWithStatus, market, since, limit);
1738
1749
  }
1739
1750
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1740
1751
  /**
@@ -1748,8 +1759,59 @@ export default class hyperliquid extends Exchange {
1748
1759
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1749
1760
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1750
1761
  */
1762
+ await this.loadMarkets();
1763
+ const orders = await this.fetchOrders(symbol, undefined, undefined, params); // don't filter here because we don't want to catch open orders
1764
+ const closedOrders = this.filterByArray(orders, 'status', ['closed'], false);
1765
+ return this.filterBySymbolSinceLimit(closedOrders, symbol, since, limit);
1766
+ }
1767
+ async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1768
+ /**
1769
+ * @method
1770
+ * @name hyperliquid#fetchCanceledOrders
1771
+ * @description fetch all canceled orders
1772
+ * @param {string} symbol unified market symbol
1773
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1774
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1775
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1776
+ * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1777
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1778
+ */
1779
+ await this.loadMarkets();
1780
+ const orders = await this.fetchOrders(symbol, undefined, undefined, params); // don't filter here because we don't want to catch open orders
1781
+ const closedOrders = this.filterByArray(orders, 'status', ['canceled'], false);
1782
+ return this.filterBySymbolSinceLimit(closedOrders, symbol, since, limit);
1783
+ }
1784
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1785
+ /**
1786
+ * @method
1787
+ * @name hyperliquid#fetchCanceledAndClosedOrders
1788
+ * @description fetch all closed and canceled orders
1789
+ * @param {string} symbol unified market symbol
1790
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1791
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1792
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1793
+ * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1794
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1795
+ */
1796
+ await this.loadMarkets();
1797
+ const orders = await this.fetchOrders(symbol, undefined, undefined, params); // don't filter here because we don't want to catch open orders
1798
+ const closedOrders = this.filterByArray(orders, 'status', ['canceled', 'closed', 'rejected'], false);
1799
+ return this.filterBySymbolSinceLimit(closedOrders, symbol, since, limit);
1800
+ }
1801
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1802
+ /**
1803
+ * @method
1804
+ * @name hyperliquid#fetchOrders
1805
+ * @description fetch all orders
1806
+ * @param {string} symbol unified market symbol
1807
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1808
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1809
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1810
+ * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1811
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1812
+ */
1751
1813
  let userAddress = undefined;
1752
- [userAddress, params] = this.handlePublicAddress('fetchClosedOrders', params);
1814
+ [userAddress, params] = this.handlePublicAddress('fetchOrders', params);
1753
1815
  await this.loadMarkets();
1754
1816
  const market = this.safeMarket(symbol);
1755
1817
  const request = {
@@ -1938,11 +2000,14 @@ export default class hyperliquid extends Exchange {
1938
2000
  }
1939
2001
  const symbol = market['symbol'];
1940
2002
  const timestamp = this.safeInteger2(order, 'timestamp', 'statusTimestamp');
1941
- const status = this.safeString(order, 'status');
2003
+ const status = this.safeString2(order, 'status', 'ccxtStatus');
2004
+ order = this.omit(order, ['ccxtStatus']);
1942
2005
  let side = this.safeString(entry, 'side');
1943
2006
  if (side !== undefined) {
1944
2007
  side = (side === 'A') ? 'sell' : 'buy';
1945
2008
  }
2009
+ const totalAmount = this.safeString2(entry, 'origSz', 'totalSz');
2010
+ const remaining = this.safeString(entry, 'sz');
1946
2011
  return this.safeOrder({
1947
2012
  'info': order,
1948
2013
  'id': this.safeString(entry, 'oid'),
@@ -1957,13 +2022,13 @@ export default class hyperliquid extends Exchange {
1957
2022
  'postOnly': undefined,
1958
2023
  'reduceOnly': this.safeBool(entry, 'reduceOnly'),
1959
2024
  'side': side,
1960
- 'price': this.safeNumber(entry, 'limitPx'),
2025
+ 'price': this.safeString(entry, 'limitPx'),
1961
2026
  'triggerPrice': this.safeBool(entry, 'isTrigger') ? this.safeNumber(entry, 'triggerPx') : undefined,
1962
- 'amount': this.safeNumber2(entry, 'sz', 'totalSz'),
2027
+ 'amount': totalAmount,
1963
2028
  'cost': undefined,
1964
- 'average': this.safeNumber(entry, 'avgPx'),
1965
- 'filled': undefined,
1966
- 'remaining': undefined,
2029
+ 'average': this.safeString(entry, 'avgPx'),
2030
+ 'filled': Precise.stringSub(totalAmount, remaining),
2031
+ 'remaining': remaining,
1967
2032
  'status': this.parseOrderStatus(status),
1968
2033
  'fee': undefined,
1969
2034
  'trades': undefined,
@@ -157,11 +157,12 @@ export default class independentreserve extends Exchange {
157
157
  * @param {object} [params] extra parameters specific to the exchange API endpoint
158
158
  * @returns {object[]} an array of objects representing market data
159
159
  */
160
- const baseCurrencies = await this.publicGetGetValidPrimaryCurrencyCodes(params);
160
+ const baseCurrenciesPromise = this.publicGetGetValidPrimaryCurrencyCodes(params);
161
161
  // ['Xbt', 'Eth', 'Usdt', ...]
162
- const quoteCurrencies = await this.publicGetGetValidSecondaryCurrencyCodes(params);
162
+ const quoteCurrenciesPromise = this.publicGetGetValidSecondaryCurrencyCodes(params);
163
163
  // ['Aud', 'Usd', 'Nzd', 'Sgd']
164
- const limits = await this.publicGetGetOrderMinimumVolumes(params);
164
+ const limitsPromise = this.publicGetGetOrderMinimumVolumes(params);
165
+ const [baseCurrencies, quoteCurrencies, limits] = await Promise.all([baseCurrenciesPromise, quoteCurrenciesPromise, limitsPromise]);
165
166
  //
166
167
  // {
167
168
  // "Xbt": 0.0001,
package/js/src/indodax.js CHANGED
@@ -871,6 +871,9 @@ export default class indodax extends Exchange {
871
871
  else if (type === 'limit') {
872
872
  priceIsRequired = true;
873
873
  quantityIsRequired = true;
874
+ if (side === 'buy') {
875
+ request[market['quoteId']] = this.parseToNumeric(Precise.stringMul(this.numberToString(amount), this.numberToString(price)));
876
+ }
874
877
  }
875
878
  if (priceIsRequired) {
876
879
  if (price === undefined) {