ccxt 4.2.47 → 4.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build.sh +7 -0
- package/dist/ccxt.browser.js +681 -84
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +10 -4
- package/dist/cjs/src/bitmart.js +30 -4
- package/dist/cjs/src/bitstamp.js +8 -0
- package/dist/cjs/src/btcalpha.js +4 -0
- package/dist/cjs/src/btcmarkets.js +4 -0
- package/dist/cjs/src/btcturk.js +4 -0
- package/dist/cjs/src/bybit.js +138 -6
- package/dist/cjs/src/idex.js +52 -1
- package/dist/cjs/src/independentreserve.js +48 -0
- package/dist/cjs/src/indodax.js +120 -19
- package/dist/cjs/src/latoken.js +16 -0
- package/dist/cjs/src/luno.js +18 -0
- package/dist/cjs/src/lykke.js +19 -0
- package/dist/cjs/src/ndax.js +18 -0
- package/dist/cjs/src/okx.js +32 -5
- package/dist/cjs/src/pro/ascendex.js +22 -7
- package/dist/cjs/src/pro/bitget.js +28 -7
- package/dist/cjs/src/pro/bitstamp.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +6 -11
- package/dist/cjs/src/pro/mexc.js +2 -1
- package/dist/cjs/src/upbit.js +100 -17
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitstamp.d.ts +8 -0
- package/js/src/abstract/indodax.d.ts +9 -8
- package/js/src/binance.js +10 -4
- package/js/src/bitmart.js +30 -4
- package/js/src/bitstamp.js +8 -0
- package/js/src/btcalpha.js +4 -0
- package/js/src/btcmarkets.js +4 -0
- package/js/src/btcturk.js +4 -0
- package/js/src/bybit.d.ts +3 -1
- package/js/src/bybit.js +138 -6
- package/js/src/idex.d.ts +7 -0
- package/js/src/idex.js +52 -1
- package/js/src/independentreserve.d.ts +15 -1
- package/js/src/independentreserve.js +48 -0
- package/js/src/indodax.d.ts +3 -1
- package/js/src/indodax.js +120 -19
- package/js/src/latoken.js +16 -0
- package/js/src/luno.js +18 -0
- package/js/src/lykke.js +19 -0
- package/js/src/ndax.js +18 -0
- package/js/src/okx.js +32 -5
- package/js/src/pro/ascendex.d.ts +1 -0
- package/js/src/pro/ascendex.js +22 -7
- package/js/src/pro/bitget.js +28 -7
- package/js/src/pro/bitstamp.js +1 -1
- package/js/src/pro/hitbtc.js +6 -11
- package/js/src/pro/mexc.js +2 -1
- package/js/src/upbit.d.ts +2 -0
- package/js/src/upbit.js +100 -17
- package/package.json +3 -1
- package/skip-tests.json +4 -2
package/js/src/bybit.js
CHANGED
|
@@ -84,6 +84,7 @@ export default class bybit extends Exchange {
|
|
|
84
84
|
'fetchMarketLeverageTiers': true,
|
|
85
85
|
'fetchMarkets': true,
|
|
86
86
|
'fetchMarkOHLCV': true,
|
|
87
|
+
'fetchMyLiquidations': true,
|
|
87
88
|
'fetchMySettlementHistory': true,
|
|
88
89
|
'fetchMyTrades': true,
|
|
89
90
|
'fetchOHLCV': true,
|
|
@@ -4579,7 +4580,7 @@ export default class bybit extends Exchange {
|
|
|
4579
4580
|
let paginate = false;
|
|
4580
4581
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
4581
4582
|
if (paginate) {
|
|
4582
|
-
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', '
|
|
4583
|
+
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
|
|
4583
4584
|
}
|
|
4584
4585
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
4585
4586
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
@@ -4757,7 +4758,7 @@ export default class bybit extends Exchange {
|
|
|
4757
4758
|
let paginate = false;
|
|
4758
4759
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
|
|
4759
4760
|
if (paginate) {
|
|
4760
|
-
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', '
|
|
4761
|
+
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
|
|
4761
4762
|
}
|
|
4762
4763
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
4763
4764
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
@@ -5129,7 +5130,7 @@ export default class bybit extends Exchange {
|
|
|
5129
5130
|
let paginate = false;
|
|
5130
5131
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
5131
5132
|
if (paginate) {
|
|
5132
|
-
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', '
|
|
5133
|
+
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
|
|
5133
5134
|
}
|
|
5134
5135
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
5135
5136
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
@@ -5331,7 +5332,7 @@ export default class bybit extends Exchange {
|
|
|
5331
5332
|
let paginate = false;
|
|
5332
5333
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
5333
5334
|
if (paginate) {
|
|
5334
|
-
return await this.fetchPaginatedCallCursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', '
|
|
5335
|
+
return await this.fetchPaginatedCallCursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
|
|
5335
5336
|
}
|
|
5336
5337
|
let request = {
|
|
5337
5338
|
// 'coin': currency['id'],
|
|
@@ -5399,7 +5400,7 @@ export default class bybit extends Exchange {
|
|
|
5399
5400
|
let paginate = false;
|
|
5400
5401
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
5401
5402
|
if (paginate) {
|
|
5402
|
-
return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', '
|
|
5403
|
+
return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
|
|
5403
5404
|
}
|
|
5404
5405
|
let request = {
|
|
5405
5406
|
// 'coin': currency['id'],
|
|
@@ -6919,7 +6920,7 @@ export default class bybit extends Exchange {
|
|
|
6919
6920
|
let paginate = false;
|
|
6920
6921
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
|
|
6921
6922
|
if (paginate) {
|
|
6922
|
-
return await this.fetchPaginatedCallCursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', '
|
|
6923
|
+
return await this.fetchPaginatedCallCursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
|
|
6923
6924
|
}
|
|
6924
6925
|
let currency = undefined;
|
|
6925
6926
|
let request = {};
|
|
@@ -7754,6 +7755,137 @@ export default class bybit extends Exchange {
|
|
|
7754
7755
|
'info': greeks,
|
|
7755
7756
|
};
|
|
7756
7757
|
}
|
|
7758
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7759
|
+
/**
|
|
7760
|
+
* @method
|
|
7761
|
+
* @name bybit#fetchMyLiquidations
|
|
7762
|
+
* @description retrieves the users liquidated positions
|
|
7763
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
|
7764
|
+
* @param {string} [symbol] unified CCXT market symbol
|
|
7765
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
7766
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
7767
|
+
* @param {object} [params] exchange specific parameters for the exchange API endpoint
|
|
7768
|
+
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
7769
|
+
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
7770
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
7771
|
+
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
7772
|
+
*/
|
|
7773
|
+
await this.loadMarkets();
|
|
7774
|
+
let paginate = false;
|
|
7775
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyLiquidations', 'paginate');
|
|
7776
|
+
if (paginate) {
|
|
7777
|
+
return await this.fetchPaginatedCallCursor('fetchMyLiquidations', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
|
|
7778
|
+
}
|
|
7779
|
+
let request = {
|
|
7780
|
+
'execType': 'BustTrade',
|
|
7781
|
+
};
|
|
7782
|
+
let market = undefined;
|
|
7783
|
+
if (symbol !== undefined) {
|
|
7784
|
+
market = this.market(symbol);
|
|
7785
|
+
request['symbol'] = market['id'];
|
|
7786
|
+
}
|
|
7787
|
+
let type = undefined;
|
|
7788
|
+
[type, params] = this.getBybitType('fetchMyLiquidations', market, params);
|
|
7789
|
+
request['category'] = type;
|
|
7790
|
+
if (limit !== undefined) {
|
|
7791
|
+
request['limit'] = limit;
|
|
7792
|
+
}
|
|
7793
|
+
if (since !== undefined) {
|
|
7794
|
+
request['startTime'] = since;
|
|
7795
|
+
}
|
|
7796
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
7797
|
+
const response = await this.privateGetV5ExecutionList(this.extend(request, params));
|
|
7798
|
+
//
|
|
7799
|
+
// {
|
|
7800
|
+
// "retCode": 0,
|
|
7801
|
+
// "retMsg": "OK",
|
|
7802
|
+
// "result": {
|
|
7803
|
+
// "nextPageCursor": "132766%3A2%2C132766%3A2",
|
|
7804
|
+
// "category": "linear",
|
|
7805
|
+
// "list": [
|
|
7806
|
+
// {
|
|
7807
|
+
// "symbol": "ETHPERP",
|
|
7808
|
+
// "orderType": "Market",
|
|
7809
|
+
// "underlyingPrice": "",
|
|
7810
|
+
// "orderLinkId": "",
|
|
7811
|
+
// "side": "Buy",
|
|
7812
|
+
// "indexPrice": "",
|
|
7813
|
+
// "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
|
|
7814
|
+
// "stopOrderType": "UNKNOWN",
|
|
7815
|
+
// "leavesQty": "0",
|
|
7816
|
+
// "execTime": "1672282722429",
|
|
7817
|
+
// "isMaker": false,
|
|
7818
|
+
// "execFee": "0.071409",
|
|
7819
|
+
// "feeRate": "0.0006",
|
|
7820
|
+
// "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
|
|
7821
|
+
// "tradeIv": "",
|
|
7822
|
+
// "blockTradeId": "",
|
|
7823
|
+
// "markPrice": "1183.54",
|
|
7824
|
+
// "execPrice": "1190.15",
|
|
7825
|
+
// "markIv": "",
|
|
7826
|
+
// "orderQty": "0.1",
|
|
7827
|
+
// "orderPrice": "1236.9",
|
|
7828
|
+
// "execValue": "119.015",
|
|
7829
|
+
// "execType": "Trade",
|
|
7830
|
+
// "execQty": "0.1"
|
|
7831
|
+
// }
|
|
7832
|
+
// ]
|
|
7833
|
+
// },
|
|
7834
|
+
// "retExtInfo": {},
|
|
7835
|
+
// "time": 1672283754510
|
|
7836
|
+
// }
|
|
7837
|
+
//
|
|
7838
|
+
const liquidations = this.addPaginationCursorToResult(response);
|
|
7839
|
+
return this.parseLiquidations(liquidations, market, since, limit);
|
|
7840
|
+
}
|
|
7841
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
7842
|
+
//
|
|
7843
|
+
// {
|
|
7844
|
+
// "symbol": "ETHPERP",
|
|
7845
|
+
// "orderType": "Market",
|
|
7846
|
+
// "underlyingPrice": "",
|
|
7847
|
+
// "orderLinkId": "",
|
|
7848
|
+
// "side": "Buy",
|
|
7849
|
+
// "indexPrice": "",
|
|
7850
|
+
// "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
|
|
7851
|
+
// "stopOrderType": "UNKNOWN",
|
|
7852
|
+
// "leavesQty": "0",
|
|
7853
|
+
// "execTime": "1672282722429",
|
|
7854
|
+
// "isMaker": false,
|
|
7855
|
+
// "execFee": "0.071409",
|
|
7856
|
+
// "feeRate": "0.0006",
|
|
7857
|
+
// "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
|
|
7858
|
+
// "tradeIv": "",
|
|
7859
|
+
// "blockTradeId": "",
|
|
7860
|
+
// "markPrice": "1183.54",
|
|
7861
|
+
// "execPrice": "1190.15",
|
|
7862
|
+
// "markIv": "",
|
|
7863
|
+
// "orderQty": "0.1",
|
|
7864
|
+
// "orderPrice": "1236.9",
|
|
7865
|
+
// "execValue": "119.015",
|
|
7866
|
+
// "execType": "Trade",
|
|
7867
|
+
// "execQty": "0.1"
|
|
7868
|
+
// }
|
|
7869
|
+
//
|
|
7870
|
+
const marketId = this.safeString(liquidation, 'symbol');
|
|
7871
|
+
const timestamp = this.safeInteger(liquidation, 'execTime');
|
|
7872
|
+
const contractsString = this.safeString(liquidation, 'execQty');
|
|
7873
|
+
const contractSizeString = this.safeString(market, 'contractSize');
|
|
7874
|
+
const priceString = this.safeString(liquidation, 'execPrice');
|
|
7875
|
+
const baseValueString = Precise.stringMul(contractsString, contractSizeString);
|
|
7876
|
+
const quoteValueString = Precise.stringMul(baseValueString, priceString);
|
|
7877
|
+
return this.safeLiquidation({
|
|
7878
|
+
'info': liquidation,
|
|
7879
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
7880
|
+
'contracts': this.parseNumber(contractsString),
|
|
7881
|
+
'contractSize': this.parseNumber(contractSizeString),
|
|
7882
|
+
'price': this.parseNumber(priceString),
|
|
7883
|
+
'baseValue': this.parseNumber(baseValueString),
|
|
7884
|
+
'quoteValue': this.parseNumber(quoteValueString),
|
|
7885
|
+
'timestamp': timestamp,
|
|
7886
|
+
'datetime': this.iso8601(timestamp),
|
|
7887
|
+
});
|
|
7888
|
+
}
|
|
7757
7889
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
7758
7890
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
7759
7891
|
if (api === 'public') {
|
package/js/src/idex.d.ts
CHANGED
|
@@ -36,6 +36,13 @@ export default class idex extends Exchange {
|
|
|
36
36
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
37
37
|
fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
38
38
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
39
|
+
fetchStatus(params?: {}): Promise<{
|
|
40
|
+
status: string;
|
|
41
|
+
updated: any;
|
|
42
|
+
eta: any;
|
|
43
|
+
url: any;
|
|
44
|
+
info: any;
|
|
45
|
+
}>;
|
|
39
46
|
fetchTime(params?: {}): Promise<number>;
|
|
40
47
|
fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
41
48
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
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
|
-
|
|
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/independentreserve.js';
|
|
2
|
-
import type { Balances, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class independentreserve
|
|
5
5
|
* @augments Exchange
|
|
@@ -23,6 +23,20 @@ export default class independentreserve extends Exchange {
|
|
|
23
23
|
fetchTradingFees(params?: {}): Promise<{}>;
|
|
24
24
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
25
25
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
26
|
+
fetchDepositAddress(code: string, params?: {}): Promise<{
|
|
27
|
+
info: any;
|
|
28
|
+
currency: string;
|
|
29
|
+
address: string;
|
|
30
|
+
tag: string;
|
|
31
|
+
network: any;
|
|
32
|
+
}>;
|
|
33
|
+
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
34
|
+
info: any;
|
|
35
|
+
currency: string;
|
|
36
|
+
address: string;
|
|
37
|
+
tag: string;
|
|
38
|
+
network: any;
|
|
39
|
+
};
|
|
26
40
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
27
41
|
url: string;
|
|
28
42
|
method: string;
|
|
@@ -44,6 +44,9 @@ export default class independentreserve extends Exchange {
|
|
|
44
44
|
'fetchClosedOrders': true,
|
|
45
45
|
'fetchCrossBorrowRate': false,
|
|
46
46
|
'fetchCrossBorrowRates': false,
|
|
47
|
+
'fetchDepositAddress': true,
|
|
48
|
+
'fetchDepositAddresses': false,
|
|
49
|
+
'fetchDepositAddressesByNetwork': false,
|
|
47
50
|
'fetchFundingHistory': false,
|
|
48
51
|
'fetchFundingRate': false,
|
|
49
52
|
'fetchFundingRateHistory': false,
|
|
@@ -723,6 +726,51 @@ export default class independentreserve extends Exchange {
|
|
|
723
726
|
};
|
|
724
727
|
return await this.privatePostCancelOrder(this.extend(request, params));
|
|
725
728
|
}
|
|
729
|
+
async fetchDepositAddress(code, params = {}) {
|
|
730
|
+
/**
|
|
731
|
+
* @method
|
|
732
|
+
* @name independentreserve#fetchDepositAddress
|
|
733
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
734
|
+
* @see https://www.independentreserve.com/features/api#GetDigitalCurrencyDepositAddress
|
|
735
|
+
* @param {string} code unified currency code
|
|
736
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
737
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
738
|
+
*/
|
|
739
|
+
await this.loadMarkets();
|
|
740
|
+
const currency = this.currency(code);
|
|
741
|
+
const request = {
|
|
742
|
+
'primaryCurrencyCode': currency['id'],
|
|
743
|
+
};
|
|
744
|
+
const response = await this.privatePostGetDigitalCurrencyDepositAddress(this.extend(request, params));
|
|
745
|
+
//
|
|
746
|
+
// {
|
|
747
|
+
// Tag: '3307446684',
|
|
748
|
+
// DepositAddress: 'GCCQH4HACMRAD56EZZZ4TOIDQQRVNADMJ35QOFWF4B2VQGODMA2WVQ22',
|
|
749
|
+
// LastCheckedTimestampUtc: '2024-02-20T11:13:35.6912985Z',
|
|
750
|
+
// NextUpdateTimestampUtc: '2024-02-20T11:14:56.5112394Z'
|
|
751
|
+
// }
|
|
752
|
+
//
|
|
753
|
+
return this.parseDepositAddress(response);
|
|
754
|
+
}
|
|
755
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
756
|
+
//
|
|
757
|
+
// {
|
|
758
|
+
// Tag: '3307446684',
|
|
759
|
+
// DepositAddress: 'GCCQH4HACMRAD56EZZZ4TOIDQQRVNADMJ35QOFWF4B2VQGODMA2WVQ22',
|
|
760
|
+
// LastCheckedTimestampUtc: '2024-02-20T11:13:35.6912985Z',
|
|
761
|
+
// NextUpdateTimestampUtc: '2024-02-20T11:14:56.5112394Z'
|
|
762
|
+
// }
|
|
763
|
+
//
|
|
764
|
+
const address = this.safeString(depositAddress, 'DepositAddress');
|
|
765
|
+
this.checkAddress(address);
|
|
766
|
+
return {
|
|
767
|
+
'info': depositAddress,
|
|
768
|
+
'currency': this.safeString(currency, 'code'),
|
|
769
|
+
'address': address,
|
|
770
|
+
'tag': this.safeString(depositAddress, 'Tag'),
|
|
771
|
+
'network': undefined,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
726
774
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
727
775
|
let url = this.urls['api'][api] + '/' + path;
|
|
728
776
|
if (api === 'public') {
|
package/js/src/indodax.d.ts
CHANGED
|
@@ -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>;
|