ccxt 4.4.68 → 4.4.69

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.
@@ -1304,10 +1304,9 @@ export default class bitstamp extends Exchange {
1304
1304
  }
1305
1305
  parseTradingFees(fees) {
1306
1306
  const result = { 'info': fees };
1307
- const symbols = this.symbols;
1308
- for (let i = 0; i < symbols.length; i++) {
1309
- const symbol = symbols[i];
1307
+ for (let i = 0; i < fees.length; i++) {
1310
1308
  const fee = this.parseTradingFee(fees[i]);
1309
+ const symbol = fee['symbol'];
1311
1310
  result[symbol] = fee;
1312
1311
  }
1313
1312
  return result;
@@ -615,11 +615,6 @@ export default class coinbase extends Exchange {
615
615
  * @returns {any[]} An account structure <https://docs.ccxt.com/#/?id=account-structure>
616
616
  */
617
617
  fetchPortfolioDetails(portfolioUuid: string, params?: {}): Promise<any[]>;
618
- /**
619
- * Parse a Coinbase portfolio JSON object and extract relevant trading information.
620
- * @param {Dict} portfolioData The JSON response containing portfolio details
621
- * @returns {any[]} List of dictionaries with parsed portfolio position data
622
- */
623
618
  parsePortfolioDetails(portfolioData: Dict): any[];
624
619
  createAuthToken(seconds: Int, method?: Str, url?: Str): string;
625
620
  nonce(): number;
@@ -4264,6 +4264,7 @@ export default class coinbase extends Exchange {
4264
4264
  'amount': this.numberToString(amount),
4265
4265
  'currency': code.toUpperCase(),
4266
4266
  'payment_method': id,
4267
+ 'commit': true, // otheriwse the deposit does not go through
4267
4268
  };
4268
4269
  const response = await this.v2PrivatePostAccountsAccountIdDeposits(this.extend(request, params));
4269
4270
  //
@@ -4884,11 +4885,6 @@ export default class coinbase extends Exchange {
4884
4885
  const result = this.parsePortfolioDetails(response);
4885
4886
  return result;
4886
4887
  }
4887
- /**
4888
- * Parse a Coinbase portfolio JSON object and extract relevant trading information.
4889
- * @param {Dict} portfolioData The JSON response containing portfolio details
4890
- * @returns {any[]} List of dictionaries with parsed portfolio position data
4891
- */
4892
4888
  parsePortfolioDetails(portfolioData) {
4893
4889
  const breakdown = portfolioData['breakdown'];
4894
4890
  const portfolioInfo = this.safeDict(breakdown, 'portfolio', {});
@@ -1,27 +1,153 @@
1
1
  import Exchange from './abstract/cryptomus.js';
2
- import type { Balances, Currencies, Dict, int, Int, Market, Num, Order, OrderBook, OrderType, OrderSide, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
2
+ import type { Balances, Currencies, Dict, int, Int, Market, Num, Order, OrderBook, OrderType, OrderSide, Str, Strings, Ticker, Tickers, Trade, TradingFees } from './base/types.js';
3
3
  /**
4
4
  * @class cryptomus
5
5
  * @augments Exchange
6
6
  */
7
7
  export default class cryptomus extends Exchange {
8
8
  describe(): any;
9
+ /**
10
+ * @method
11
+ * @name cryptomus#fetchMarkets
12
+ * @description retrieves data on all markets for the exchange
13
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
14
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
15
+ * @returns {object[]} an array of objects representing market data
16
+ */
9
17
  fetchMarkets(params?: {}): Promise<Market[]>;
10
18
  parseMarket(market: Dict): Market;
19
+ /**
20
+ * @method
21
+ * @name cryptomus#fetchCurrencies
22
+ * @description fetches all available currencies on an exchange
23
+ * @see https://doc.cryptomus.com/personal/market-cap/assets
24
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
25
+ * @returns {object} an associative dictionary of currencies
26
+ */
11
27
  fetchCurrencies(params?: {}): Promise<Currencies>;
28
+ /**
29
+ * @method
30
+ * @name cryptomus#fetchTickers
31
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
32
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
33
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
34
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
35
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
36
+ */
12
37
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
38
  parseTicker(ticker: any, market?: Market): Ticker;
39
+ /**
40
+ * @method
41
+ * @name cryptomus#fetchOrderBook
42
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
43
+ * @see https://doc.cryptomus.com/personal/market-cap/orderbook
44
+ * @param {string} symbol unified symbol of the market to fetch the order book for
45
+ * @param {int} [limit] the maximum amount of order book entries to return
46
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
47
+ * @param {int} [params.level] 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
48
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
49
+ */
14
50
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
51
+ /**
52
+ * @method
53
+ * @name cryptomus#fetchTrades
54
+ * @description get the list of most recent trades for a particular symbol
55
+ * @see https://doc.cryptomus.com/personal/market-cap/trades
56
+ * @param {string} symbol unified symbol of the market to fetch trades for
57
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
58
+ * @param {int} [limit] the maximum amount of trades to fetch (maximum value is 100)
59
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
60
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
61
+ */
15
62
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
16
63
  parseTrade(trade: Dict, market?: Market): Trade;
64
+ /**
65
+ * @method
66
+ * @name cryptomus#fetchBalance
67
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
68
+ * @see https://doc.cryptomus.com/personal/converts/balance
69
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
70
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
71
+ */
17
72
  fetchBalance(params?: {}): Promise<Balances>;
18
73
  parseBalance(balance: any): Balances;
74
+ /**
75
+ * @method
76
+ * @name cryptomus#createOrder
77
+ * @description create a trade order
78
+ * @see https://doc.cryptomus.com/personal/exchange/market-order-creation
79
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-creation
80
+ * @param {string} symbol unified symbol of the market to create an order in
81
+ * @param {string} type 'market' or 'limit' or for spot
82
+ * @param {string} side 'buy' or 'sell'
83
+ * @param {float} amount how much of you want to trade in units of the base currency
84
+ * @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders)
85
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
86
+ * @param {float} [params.cost] *market buy only* the quote quantity that can be used as an alternative for the amount
87
+ * @param {string} [params.clientOrderId] a unique identifier for the order (optional)
88
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
89
+ */
19
90
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
91
+ /**
92
+ * @method
93
+ * @name cryptomus#cancelOrder
94
+ * @description cancels an open limit order
95
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
96
+ * @param {string} id order id
97
+ * @param {string} symbol unified symbol of the market the order was made in (not used in cryptomus)
98
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
99
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
100
+ */
20
101
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
102
+ /**
103
+ * @method
104
+ * @name cryptomus#fetchOrders
105
+ * @description fetches information on multiple orders made by the user
106
+ * @see https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
107
+ * @param {string} symbol unified market symbol of the market orders were made in (not used in cryptomus)
108
+ * @param {int} [since] the earliest time in ms to fetch orders for (not used in cryptomus)
109
+ * @param {int} [limit] the maximum number of order structures to retrieve (not used in cryptomus)
110
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
111
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
112
+ * @param {string} [params.order_id] order id
113
+ * @param {string} [params.client_order_id] client order id
114
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
115
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
116
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
117
+ */
21
118
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
119
+ /**
120
+ * @method
121
+ * @name cryptomus#fetchOpenOrders
122
+ * @description fetch all unfilled currently open orders
123
+ * @see https://doc.cryptomus.com/personal/exchange/list-of-active-orders
124
+ * @param {string} symbol unified market symbol
125
+ * @param {int} [since] the earliest time in ms to fetch open orders for (not used in cryptomus)
126
+ * @param {int} [limit] the maximum number of open orders structures to retrieve (not used in cryptomus)
127
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
128
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
129
+ * @param {string} [params.order_id] order id
130
+ * @param {string} [params.client_order_id] client order id
131
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
132
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
133
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
134
+ */
22
135
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
23
136
  parseOrder(order: Dict, market?: Market): Order;
24
137
  parseOrderStatus(status?: Str): Str;
138
+ /**
139
+ * @method
140
+ * @name cryptomus#fetchTradingFees
141
+ * @description fetch the trading fees for multiple markets
142
+ * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fees
143
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
144
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
145
+ */
146
+ fetchTradingFees(params?: {}): Promise<TradingFees>;
147
+ parseFeeTiers(feeTiers: any, market?: Market): {
148
+ maker: any[];
149
+ taker: any[];
150
+ };
25
151
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
26
152
  url: string;
27
153
  method: string;
@@ -16,7 +16,7 @@ export default class cryptomus extends Exchange {
16
16
  'name': 'Cryptomus',
17
17
  'countries': ['CA'],
18
18
  'rateLimit': 100,
19
- 'version': 'v1',
19
+ 'version': 'v2',
20
20
  'certified': false,
21
21
  'pro': false,
22
22
  'has': {
@@ -98,7 +98,7 @@ export default class cryptomus extends Exchange {
98
98
  'fetchTime': false,
99
99
  'fetchTrades': true,
100
100
  'fetchTradingFee': false,
101
- 'fetchTradingFees': false,
101
+ 'fetchTradingFees': true,
102
102
  'fetchTransactions': false,
103
103
  'fetchTransfers': false,
104
104
  'fetchWithdrawals': false,
@@ -221,15 +221,15 @@ export default class cryptomus extends Exchange {
221
221
  'features': {},
222
222
  });
223
223
  }
224
+ /**
225
+ * @method
226
+ * @name cryptomus#fetchMarkets
227
+ * @description retrieves data on all markets for the exchange
228
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
229
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
230
+ * @returns {object[]} an array of objects representing market data
231
+ */
224
232
  async fetchMarkets(params = {}) {
225
- /**
226
- * @method
227
- * @name cryptomus#fetchMarkets
228
- * @description retrieves data on all markets for the exchange
229
- * @see https://doc.cryptomus.com/personal/market-cap/tickers
230
- * @param {object} [params] extra parameters specific to the exchange API endpoint
231
- * @returns {object[]} an array of objects representing market data
232
- */
233
233
  const response = await this.publicGetV2UserApiExchangeMarkets(params);
234
234
  //
235
235
  // {
@@ -331,15 +331,15 @@ export default class cryptomus extends Exchange {
331
331
  'info': market,
332
332
  });
333
333
  }
334
+ /**
335
+ * @method
336
+ * @name cryptomus#fetchCurrencies
337
+ * @description fetches all available currencies on an exchange
338
+ * @see https://doc.cryptomus.com/personal/market-cap/assets
339
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
340
+ * @returns {object} an associative dictionary of currencies
341
+ */
334
342
  async fetchCurrencies(params = {}) {
335
- /**
336
- * @method
337
- * @name cryptomus#fetchCurrencies
338
- * @description fetches all available currencies on an exchange
339
- * @see https://doc.cryptomus.com/personal/market-cap/assets
340
- * @param {object} [params] extra parameters specific to the exchange API endpoint
341
- * @returns {object} an associative dictionary of currencies
342
- */
343
343
  const response = await this.publicGetV1ExchangeMarketAssets(params);
344
344
  //
345
345
  // {
@@ -471,16 +471,16 @@ export default class cryptomus extends Exchange {
471
471
  }
472
472
  return result;
473
473
  }
474
+ /**
475
+ * @method
476
+ * @name cryptomus#fetchTickers
477
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
478
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
479
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
480
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
481
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
482
+ */
474
483
  async fetchTickers(symbols = undefined, params = {}) {
475
- /**
476
- * @method
477
- * @name cryptomus#fetchTickers
478
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
479
- * @see https://doc.cryptomus.com/personal/market-cap/tickers
480
- * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
481
- * @param {object} [params] extra parameters specific to the exchange API endpoint
482
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
483
- */
484
484
  await this.loadMarkets();
485
485
  symbols = this.marketSymbols(symbols);
486
486
  const response = await this.publicGetV1ExchangeMarketTickers(params);
@@ -535,18 +535,18 @@ export default class cryptomus extends Exchange {
535
535
  'info': ticker,
536
536
  }, market);
537
537
  }
538
+ /**
539
+ * @method
540
+ * @name cryptomus#fetchOrderBook
541
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
542
+ * @see https://doc.cryptomus.com/personal/market-cap/orderbook
543
+ * @param {string} symbol unified symbol of the market to fetch the order book for
544
+ * @param {int} [limit] the maximum amount of order book entries to return
545
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
546
+ * @param {int} [params.level] 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
547
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
548
+ */
538
549
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
539
- /**
540
- * @method
541
- * @name cryptomus#fetchOrderBook
542
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
543
- * @see https://doc.cryptomus.com/personal/market-cap/orderbook
544
- * @param {string} symbol unified symbol of the market to fetch the order book for
545
- * @param {int} [limit] the maximum amount of order book entries to return
546
- * @param {object} [params] extra parameters specific to the exchange API endpoint
547
- * @param {int} [params.level] 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
548
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
549
- */
550
550
  await this.loadMarkets();
551
551
  const market = this.market(symbol);
552
552
  const request = {
@@ -579,18 +579,18 @@ export default class cryptomus extends Exchange {
579
579
  const timestamp = this.safeTimestamp(data, 'timestamp');
580
580
  return this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks', 'price', 'quantity');
581
581
  }
582
+ /**
583
+ * @method
584
+ * @name cryptomus#fetchTrades
585
+ * @description get the list of most recent trades for a particular symbol
586
+ * @see https://doc.cryptomus.com/personal/market-cap/trades
587
+ * @param {string} symbol unified symbol of the market to fetch trades for
588
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
589
+ * @param {int} [limit] the maximum amount of trades to fetch (maximum value is 100)
590
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
591
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
592
+ */
582
593
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
583
- /**
584
- * @method
585
- * @name cryptomus#fetchTrades
586
- * @description get the list of most recent trades for a particular symbol
587
- * @see https://doc.cryptomus.com/personal/market-cap/trades
588
- * @param {string} symbol unified symbol of the market to fetch trades for
589
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
590
- * @param {int} [limit] the maximum amount of trades to fetch (maximum value is 100)
591
- * @param {object} [params] extra parameters specific to the exchange API endpoint
592
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
593
- */
594
594
  await this.loadMarkets();
595
595
  const market = this.market(symbol);
596
596
  const request = {
@@ -645,15 +645,15 @@ export default class cryptomus extends Exchange {
645
645
  'info': trade,
646
646
  }, market);
647
647
  }
648
+ /**
649
+ * @method
650
+ * @name cryptomus#fetchBalance
651
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
652
+ * @see https://doc.cryptomus.com/personal/converts/balance
653
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
654
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
655
+ */
648
656
  async fetchBalance(params = {}) {
649
- /**
650
- * @method
651
- * @name cryptomus#fetchBalance
652
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
653
- * @see https://doc.cryptomus.com/personal/converts/balance
654
- * @param {object} [params] extra parameters specific to the exchange API endpoint
655
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
656
- */
657
657
  await this.loadMarkets();
658
658
  const request = {};
659
659
  const response = await this.privateGetV2UserApiExchangeAccountBalance(this.extend(request, params));
@@ -693,24 +693,23 @@ export default class cryptomus extends Exchange {
693
693
  }
694
694
  return this.safeBalance(result);
695
695
  }
696
+ /**
697
+ * @method
698
+ * @name cryptomus#createOrder
699
+ * @description create a trade order
700
+ * @see https://doc.cryptomus.com/personal/exchange/market-order-creation
701
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-creation
702
+ * @param {string} symbol unified symbol of the market to create an order in
703
+ * @param {string} type 'market' or 'limit' or for spot
704
+ * @param {string} side 'buy' or 'sell'
705
+ * @param {float} amount how much of you want to trade in units of the base currency
706
+ * @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders)
707
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
708
+ * @param {float} [params.cost] *market buy only* the quote quantity that can be used as an alternative for the amount
709
+ * @param {string} [params.clientOrderId] a unique identifier for the order (optional)
710
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
711
+ */
696
712
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
697
- /**
698
- * @method
699
- * @name cryptomus#createOrder
700
- * @description create a trade order
701
- * @see https://doc.cryptomus.com/personal/exchange/market-order-creation
702
- * @see https://doc.cryptomus.com/personal/exchange/limit-order-creation
703
- * @param {string} symbol unified symbol of the market to create an order in
704
- * @param {string} type 'market' or 'limit' or for spot
705
- * @param {string} side 'buy' or 'sell'
706
- * @param {float} amount how much of you want to trade in units of the base currency
707
- * @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders)
708
- * @param {object} [params] extra parameters specific to the exchange API endpoint
709
- * @param {float} [params.cost] *market buy only* the quote quantity that can be used as an alternative for the amount
710
- * @param {object} [params] extra parameters specific to the exchange API endpoint
711
- * @param {string} [params.clientOrderId] a unique identifier for the order (optional)
712
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
713
- */
714
713
  await this.loadMarkets();
715
714
  const market = this.market(symbol);
716
715
  const request = {
@@ -769,17 +768,17 @@ export default class cryptomus extends Exchange {
769
768
  //
770
769
  return this.parseOrder(response, market);
771
770
  }
771
+ /**
772
+ * @method
773
+ * @name cryptomus#cancelOrder
774
+ * @description cancels an open limit order
775
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
776
+ * @param {string} id order id
777
+ * @param {string} symbol unified symbol of the market the order was made in (not used in cryptomus)
778
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
779
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
780
+ */
772
781
  async cancelOrder(id, symbol = undefined, params = {}) {
773
- /**
774
- * @method
775
- * @name cryptomus#cancelOrder
776
- * @description cancels an open limit order
777
- * @see https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
778
- * @param {string} id order id
779
- * @param {string} symbol unified symbol of the market the order was made in (not used in cryptomus)
780
- * @param {object} [params] extra parameters specific to the exchange API endpoint
781
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
782
- */
783
782
  await this.loadMarkets();
784
783
  const request = {};
785
784
  request['orderId'] = id;
@@ -791,23 +790,23 @@ export default class cryptomus extends Exchange {
791
790
  //
792
791
  return response;
793
792
  }
793
+ /**
794
+ * @method
795
+ * @name cryptomus#fetchOrders
796
+ * @description fetches information on multiple orders made by the user
797
+ * @see https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
798
+ * @param {string} symbol unified market symbol of the market orders were made in (not used in cryptomus)
799
+ * @param {int} [since] the earliest time in ms to fetch orders for (not used in cryptomus)
800
+ * @param {int} [limit] the maximum number of order structures to retrieve (not used in cryptomus)
801
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
802
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
803
+ * @param {string} [params.order_id] order id
804
+ * @param {string} [params.client_order_id] client order id
805
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
806
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
807
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
808
+ */
794
809
  async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
795
- /**
796
- * @method
797
- * @name cryptomus#fetchOrders
798
- * @description fetches information on multiple orders made by the user
799
- * @see https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
800
- * @param {string} symbol unified market symbol of the market orders were made in (not used in cryptomus)
801
- * @param {int} [since] the earliest time in ms to fetch orders for (not used in cryptomus)
802
- * @param {int} [limit] the maximum number of order structures to retrieve (not used in cryptomus)
803
- * @param {object} [params] extra parameters specific to the exchange API endpoint
804
- * @param {string} [params.direction] order direction 'buy' or 'sell'
805
- * @param {string} [params.order_id] order id
806
- * @param {string} [params.client_order_id] client order id
807
- * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
808
- * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
809
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
810
- */
811
810
  await this.loadMarkets();
812
811
  const request = {};
813
812
  let market = undefined;
@@ -866,23 +865,23 @@ export default class cryptomus extends Exchange {
866
865
  }
867
866
  return orders;
868
867
  }
868
+ /**
869
+ * @method
870
+ * @name cryptomus#fetchOpenOrders
871
+ * @description fetch all unfilled currently open orders
872
+ * @see https://doc.cryptomus.com/personal/exchange/list-of-active-orders
873
+ * @param {string} symbol unified market symbol
874
+ * @param {int} [since] the earliest time in ms to fetch open orders for (not used in cryptomus)
875
+ * @param {int} [limit] the maximum number of open orders structures to retrieve (not used in cryptomus)
876
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
877
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
878
+ * @param {string} [params.order_id] order id
879
+ * @param {string} [params.client_order_id] client order id
880
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
881
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
882
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
883
+ */
869
884
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
870
- /**
871
- * @method
872
- * @name cryptomus#fetchOpenOrders
873
- * @description fetch all unfilled currently open orders
874
- * @see https://doc.cryptomus.com/personal/exchange/list-of-active-orders
875
- * @param {string} symbol unified market symbol
876
- * @param {int} [since] the earliest time in ms to fetch open orders for (not used in cryptomus)
877
- * @param {int} [limit] the maximum number of open orders structures to retrieve (not used in cryptomus)
878
- * @param {object} [params] extra parameters specific to the exchange API endpoint
879
- * @param {string} [params.direction] order direction 'buy' or 'sell'
880
- * @param {string} [params.order_id] order id
881
- * @param {string} [params.client_order_id] client order id
882
- * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
883
- * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
884
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
885
- */
886
885
  await this.loadMarkets();
887
886
  let market = undefined;
888
887
  if (symbol !== undefined) {
@@ -1035,6 +1034,105 @@ export default class cryptomus extends Exchange {
1035
1034
  };
1036
1035
  return this.safeString(statuses, status, status);
1037
1036
  }
1037
+ /**
1038
+ * @method
1039
+ * @name cryptomus#fetchTradingFees
1040
+ * @description fetch the trading fees for multiple markets
1041
+ * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fees
1042
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1043
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
1044
+ */
1045
+ async fetchTradingFees(params = {}) {
1046
+ const response = await this.privateGetV2UserApiExchangeAccountTariffs(params);
1047
+ //
1048
+ // {
1049
+ // result: {
1050
+ // equivalent_currency_code: 'USD',
1051
+ // current_tariff_step: {
1052
+ // step: '0',
1053
+ // from_turnover: '0.00000000',
1054
+ // maker_percent: '0.08',
1055
+ // taker_percent: '0.1'
1056
+ // },
1057
+ // tariff_steps: [
1058
+ // {
1059
+ // step: '0',
1060
+ // from_turnover: '0.00000000',
1061
+ // maker_percent: '0.08',
1062
+ // taker_percent: '0.1'
1063
+ // },
1064
+ // {
1065
+ // step: '1',
1066
+ // from_turnover: '100001.00000000',
1067
+ // maker_percent: '0.06',
1068
+ // taker_percent: '0.095'
1069
+ // },
1070
+ // {
1071
+ // step: '2',
1072
+ // from_turnover: '250001.00000000',
1073
+ // maker_percent: '0.055',
1074
+ // taker_percent: '0.085'
1075
+ // },
1076
+ // {
1077
+ // step: '3',
1078
+ // from_turnover: '500001.00000000',
1079
+ // maker_percent: '0.05',
1080
+ // taker_percent: '0.075'
1081
+ // },
1082
+ // {
1083
+ // step: '4',
1084
+ // from_turnover: '2500001.00000000',
1085
+ // maker_percent: '0.04',
1086
+ // taker_percent: '0.07'
1087
+ // }
1088
+ // ],
1089
+ // daily_turnover: '0.00000000',
1090
+ // monthly_turnover: '77.52062617',
1091
+ // circulation_funds: '25.48900443'
1092
+ // }
1093
+ // }
1094
+ //
1095
+ const data = this.safeDict(response, 'result', {});
1096
+ const currentFeeTier = this.safeDict(data, 'current_tariff_step', {});
1097
+ let makerFee = this.safeString(currentFeeTier, 'maker_percent');
1098
+ let takerFee = this.safeString(currentFeeTier, 'taker_percent');
1099
+ makerFee = Precise.stringDiv(makerFee, '100');
1100
+ takerFee = Precise.stringDiv(takerFee, '100');
1101
+ const feeTiers = this.safeList(data, 'tariff_steps', []);
1102
+ const result = {};
1103
+ const tiers = this.parseFeeTiers(feeTiers);
1104
+ for (let i = 0; i < this.symbols.length; i++) {
1105
+ const symbol = this.symbols[i];
1106
+ result[symbol] = {
1107
+ 'info': response,
1108
+ 'symbol': symbol,
1109
+ 'maker': this.parseNumber(makerFee),
1110
+ 'taker': this.parseNumber(takerFee),
1111
+ 'percentage': true,
1112
+ 'tierBased': true,
1113
+ 'tiers': tiers,
1114
+ };
1115
+ }
1116
+ return result;
1117
+ }
1118
+ parseFeeTiers(feeTiers, market = undefined) {
1119
+ const takerFees = [];
1120
+ const makerFees = [];
1121
+ for (let i = 0; i < feeTiers.length; i++) {
1122
+ const tier = feeTiers[i];
1123
+ const turnover = this.safeNumber(tier, 'from_turnover');
1124
+ let taker = this.safeString(tier, 'taker_percent');
1125
+ let maker = this.safeString(tier, 'maker_percent');
1126
+ maker = Precise.stringDiv(maker, '100');
1127
+ taker = Precise.stringDiv(taker, '100');
1128
+ makerFees.push([turnover, this.parseNumber(maker)]);
1129
+ takerFees.push([turnover, this.parseNumber(taker)]);
1130
+ }
1131
+ return {
1132
+ 'maker': makerFees,
1133
+ 'taker': takerFees,
1134
+ };
1135
+ }
1038
1136
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1039
1137
  const endpoint = this.implodeParams(path, params);
1040
1138
  params = this.omit(params, this.extractParams(path));
@@ -837,7 +837,7 @@ export default class hyperliquid extends Exchange {
837
837
  'info': response,
838
838
  'USDC': {
839
839
  'total': this.safeNumber(data, 'accountValue'),
840
- 'free': this.safeNumber(response, 'withdrawable'),
840
+ 'used': this.safeNumber(data, 'totalMarginUsed'),
841
841
  },
842
842
  };
843
843
  const timestamp = this.safeInteger(response, 'time');