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.
package/js/src/idex.js CHANGED
@@ -84,8 +84,10 @@ export default class idex extends Exchange {
84
84
  'fetchPositions': false,
85
85
  'fetchPositionsRisk': false,
86
86
  'fetchPremiumIndexOHLCV': false,
87
+ 'fetchStatus': true,
87
88
  'fetchTicker': true,
88
89
  'fetchTickers': true,
90
+ 'fetchTime': true,
89
91
  'fetchTrades': true,
90
92
  'fetchTradingFee': false,
91
93
  'fetchTradingFees': true,
@@ -199,6 +201,7 @@ export default class idex extends Exchange {
199
201
  * @method
200
202
  * @name idex#fetchMarkets
201
203
  * @description retrieves data on all markets for idex
204
+ * @see https://api-docs-v3.idex.io/#get-markets
202
205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
203
206
  * @returns {object[]} an array of objects representing market data
204
207
  */
@@ -329,6 +332,7 @@ export default class idex extends Exchange {
329
332
  * @method
330
333
  * @name idex#fetchTicker
331
334
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
335
+ * @see https://api-docs-v3.idex.io/#get-tickers
332
336
  * @param {string} symbol unified symbol of the market to fetch the ticker for
333
337
  * @param {object} [params] extra parameters specific to the exchange API endpoint
334
338
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -365,6 +369,7 @@ export default class idex extends Exchange {
365
369
  * @method
366
370
  * @name idex#fetchTickers
367
371
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
372
+ * @see https://api-docs-v3.idex.io/#get-tickers
368
373
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
369
374
  * @param {object} [params] extra parameters specific to the exchange API endpoint
370
375
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -441,6 +446,7 @@ export default class idex extends Exchange {
441
446
  * @method
442
447
  * @name idex#fetchOHLCV
443
448
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
449
+ * @see https://api-docs-v3.idex.io/#get-candles
444
450
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
445
451
  * @param {string} timeframe the length of time each candle represents
446
452
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -503,6 +509,7 @@ export default class idex extends Exchange {
503
509
  * @method
504
510
  * @name idex#fetchTrades
505
511
  * @description get the list of most recent trades for a particular symbol
512
+ * @see https://api-docs-v3.idex.io/#get-trades
506
513
  * @param {string} symbol unified symbol of the market to fetch trades for
507
514
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
508
515
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -616,6 +623,7 @@ export default class idex extends Exchange {
616
623
  * @method
617
624
  * @name idex#fetchTradingFees
618
625
  * @description fetch the trading fees for multiple markets
626
+ * @see https://api-docs-v3.idex.io/#get-api-account
619
627
  * @param {object} [params] extra parameters specific to the exchange API endpoint
620
628
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
621
629
  */
@@ -661,6 +669,7 @@ export default class idex extends Exchange {
661
669
  * @method
662
670
  * @name idex#fetchOrderBook
663
671
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
672
+ * @see https://api-docs-v3.idex.io/#get-order-books
664
673
  * @param {string} symbol unified symbol of the market to fetch the order book for
665
674
  * @param {int} [limit] the maximum amount of order book entries to return
666
675
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -724,6 +733,7 @@ export default class idex extends Exchange {
724
733
  * @method
725
734
  * @name idex#fetchCurrencies
726
735
  * @description fetches all available currencies on an exchange
736
+ * @see https://api-docs-v3.idex.io/#get-assets
727
737
  * @param {object} [params] extra parameters specific to the exchange API endpoint
728
738
  * @returns {object} an associative dictionary of currencies
729
739
  */
@@ -789,6 +799,7 @@ export default class idex extends Exchange {
789
799
  * @method
790
800
  * @name idex#fetchBalance
791
801
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
802
+ * @see https://api-docs-v3.idex.io/#get-balances
792
803
  * @param {object} [params] extra parameters specific to the exchange API endpoint
793
804
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
794
805
  */
@@ -833,6 +844,7 @@ export default class idex extends Exchange {
833
844
  * @method
834
845
  * @name idex#fetchMyTrades
835
846
  * @description fetch all trades made by the user
847
+ * @see https://api-docs-v3.idex.io/#get-fills
836
848
  * @param {string} symbol unified market symbol
837
849
  * @param {int} [since] the earliest time in ms to fetch trades for
838
850
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -901,6 +913,7 @@ export default class idex extends Exchange {
901
913
  * @method
902
914
  * @name idex#fetchOrder
903
915
  * @description fetches information on an order made by the user
916
+ * @see https://api-docs-v3.idex.io/#get-orders
904
917
  * @param {string} symbol unified symbol of the market the order was made in
905
918
  * @param {object} [params] extra parameters specific to the exchange API endpoint
906
919
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -915,6 +928,7 @@ export default class idex extends Exchange {
915
928
  * @method
916
929
  * @name idex#fetchOpenOrders
917
930
  * @description fetch all unfilled currently open orders
931
+ * @see https://api-docs-v3.idex.io/#get-orders
918
932
  * @param {string} symbol unified market symbol
919
933
  * @param {int} [since] the earliest time in ms to fetch open orders for
920
934
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -931,6 +945,7 @@ export default class idex extends Exchange {
931
945
  * @method
932
946
  * @name idex#fetchClosedOrders
933
947
  * @description fetches information on multiple closed orders made by the user
948
+ * @see https://api-docs-v3.idex.io/#get-orders
934
949
  * @param {string} symbol unified market symbol of the market orders were made in
935
950
  * @param {int} [since] the earliest time in ms to fetch orders for
936
951
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1142,16 +1157,20 @@ export default class idex extends Exchange {
1142
1157
  * @method
1143
1158
  * @name idex#createOrder
1144
1159
  * @description create a trade order, https://docs.idex.io/#create-order
1160
+ * @see https://api-docs-v3.idex.io/#create-order
1145
1161
  * @param {string} symbol unified symbol of the market to create an order in
1146
1162
  * @param {string} type 'market' or 'limit'
1147
1163
  * @param {string} side 'buy' or 'sell'
1148
1164
  * @param {float} amount how much of currency you want to trade in units of base currency
1149
1165
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1150
1166
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1167
+ * @param {bool} [params.test] set to true to test an order, no order will be created but the request will be validated
1151
1168
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1152
1169
  */
1153
1170
  this.checkRequiredCredentials();
1154
1171
  await this.loadMarkets();
1172
+ const testOrder = this.safeBool(params, 'test', false);
1173
+ params = this.omit(params, 'test');
1155
1174
  const market = this.market(symbol);
1156
1175
  const nonce = this.uuidv1();
1157
1176
  let typeEnum = undefined;
@@ -1332,7 +1351,13 @@ export default class idex extends Exchange {
1332
1351
  // "avgExecutionPrice": "0.09905990"
1333
1352
  // }
1334
1353
  // we don't use extend here because it is a signed endpoint
1335
- const response = await this.privatePostOrders(request);
1354
+ let response = undefined;
1355
+ if (testOrder) {
1356
+ response = await this.privatePostOrdersTest(request);
1357
+ }
1358
+ else {
1359
+ response = await this.privatePostOrders(request);
1360
+ }
1336
1361
  return this.parseOrder(response, market);
1337
1362
  }
1338
1363
  async withdraw(code, amount, address, tag = undefined, params = {}) {
@@ -1340,6 +1365,7 @@ export default class idex extends Exchange {
1340
1365
  * @method
1341
1366
  * @name idex#withdraw
1342
1367
  * @description make a withdrawal
1368
+ * @see https://api-docs-v3.idex.io/#withdraw-funds
1343
1369
  * @param {string} code unified currency code
1344
1370
  * @param {float} amount the amount to withdraw
1345
1371
  * @param {string} address the address to withdraw to
@@ -1393,6 +1419,7 @@ export default class idex extends Exchange {
1393
1419
  * @method
1394
1420
  * @name idex#cancelAllOrders
1395
1421
  * @description cancel all open orders
1422
+ * @see https://api-docs-v3.idex.io/#cancel-order
1396
1423
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1397
1424
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1398
1425
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1432,6 +1459,7 @@ export default class idex extends Exchange {
1432
1459
  * @method
1433
1460
  * @name idex#cancelOrder
1434
1461
  * @description cancels an open order
1462
+ * @see https://api-docs-v3.idex.io/#cancel-order
1435
1463
  * @param {string} id order id
1436
1464
  * @param {string} symbol unified symbol of the market the order was made in
1437
1465
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1483,6 +1511,7 @@ export default class idex extends Exchange {
1483
1511
  * @method
1484
1512
  * @name idex#fetchDeposit
1485
1513
  * @description fetch information on a deposit
1514
+ * @see https://api-docs-v3.idex.io/#get-deposits
1486
1515
  * @param {string} id deposit id
1487
1516
  * @param {string} code not used by idex fetchDeposit ()
1488
1517
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1503,6 +1532,7 @@ export default class idex extends Exchange {
1503
1532
  * @method
1504
1533
  * @name idex#fetchDeposits
1505
1534
  * @description fetch all deposits made to an account
1535
+ * @see https://api-docs-v3.idex.io/#get-deposits
1506
1536
  * @param {string} code unified currency code
1507
1537
  * @param {int} [since] the earliest time in ms to fetch deposits for
1508
1538
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -1514,11 +1544,30 @@ export default class idex extends Exchange {
1514
1544
  }, params);
1515
1545
  return await this.fetchTransactionsHelper(code, since, limit, params);
1516
1546
  }
1547
+ async fetchStatus(params = {}) {
1548
+ /**
1549
+ * @method
1550
+ * @name idex#fetchStatus
1551
+ * @description the latest known information on the availability of the exchange API
1552
+ * @see https://api-docs-v3.idex.io/#get-ping
1553
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1554
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
1555
+ */
1556
+ const response = await this.publicGetPing(params);
1557
+ return {
1558
+ 'status': 'ok',
1559
+ 'updated': undefined,
1560
+ 'eta': undefined,
1561
+ 'url': undefined,
1562
+ 'info': response,
1563
+ };
1564
+ }
1517
1565
  async fetchTime(params = {}) {
1518
1566
  /**
1519
1567
  * @method
1520
1568
  * @name idex#fetchTime
1521
1569
  * @description fetches the current integer timestamp in milliseconds from the exchange server
1570
+ * @see https://api-docs-v3.idex.io/#get-time
1522
1571
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1523
1572
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
1524
1573
  */
@@ -1533,6 +1582,7 @@ export default class idex extends Exchange {
1533
1582
  * @method
1534
1583
  * @name idex#fetchWithdrawal
1535
1584
  * @description fetch data on a currency withdrawal via the withdrawal id
1585
+ * @see https://api-docs-v3.idex.io/#get-withdrawals
1536
1586
  * @param {string} id withdrawal id
1537
1587
  * @param {string} code not used by idex.fetchWithdrawal
1538
1588
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1553,6 +1603,7 @@ export default class idex extends Exchange {
1553
1603
  * @method
1554
1604
  * @name idex#fetchWithdrawals
1555
1605
  * @description fetch all withdrawals made from an account
1606
+ * @see https://api-docs-v3.idex.io/#get-withdrawals
1556
1607
  * @param {string} code unified currency code
1557
1608
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
1558
1609
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/indodax.js';
2
- import type { Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
3
3
  /**
4
4
  * @class indodax
5
5
  * @augments Exchange
@@ -17,6 +17,8 @@ export default class indodax extends Exchange {
17
17
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
18
18
  parseTrade(trade: any, market?: Market): Trade;
19
19
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
20
+ parseOHLCV(ohlcv: any, market?: Market): OHLCV;
21
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
20
22
  parseOrderStatus(status: any): string;
21
23
  parseOrder(order: any, market?: Market): Order;
22
24
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
@@ -33,6 +35,9 @@ export default class indodax extends Exchange {
33
35
  withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
34
36
  parseTransaction(transaction: any, currency?: Currency): Transaction;
35
37
  parseTransactionStatus(status: any): string;
38
+ fetchDepositAddresses(codes?: string[], params?: {}): Promise<{
39
+ info: import("./base/types.js").Dictionary<any>;
40
+ }>;
36
41
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
37
42
  url: any;
38
43
  method: string;