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/CHANGELOG.md +2307 -0
- package/README.md +3 -3
- package/change.sh +1 -1
- package/dist/ccxt.browser.js +747 -60
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +3 -1
- package/dist/cjs/src/bybit.js +185 -2
- package/dist/cjs/src/coinsph.js +32 -1
- package/dist/cjs/src/currencycom.js +22 -0
- package/dist/cjs/src/deribit.js +34 -1
- package/dist/cjs/src/exmo.js +22 -0
- package/dist/cjs/src/gemini.js +15 -0
- package/dist/cjs/src/hollaex.js +27 -1
- package/dist/cjs/src/idex.js +52 -1
- package/dist/cjs/src/indodax.js +226 -20
- package/dist/cjs/src/okx.js +32 -5
- package/dist/cjs/src/pro/hitbtc.js +6 -11
- package/dist/cjs/src/upbit.js +90 -16
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/hollaex.d.ts +3 -0
- package/js/src/abstract/indodax.d.ts +9 -8
- package/js/src/binance.js +3 -1
- package/js/src/bybit.d.ts +2 -0
- package/js/src/bybit.js +185 -2
- package/js/src/coinsph.js +32 -1
- package/js/src/currencycom.js +22 -0
- package/js/src/deribit.js +34 -1
- package/js/src/exmo.js +22 -0
- package/js/src/gemini.js +15 -0
- package/js/src/hollaex.js +27 -1
- package/js/src/idex.d.ts +7 -0
- package/js/src/idex.js +52 -1
- package/js/src/indodax.d.ts +6 -1
- package/js/src/indodax.js +226 -20
- package/js/src/okx.js +32 -5
- package/js/src/pro/hitbtc.js +6 -11
- package/js/src/upbit.d.ts +2 -0
- package/js/src/upbit.js +90 -16
- package/package.json +1 -1
- package/skip-tests.json +1 -1
package/js/src/indodax.js
CHANGED
|
@@ -49,6 +49,9 @@ export default class indodax extends Exchange {
|
|
|
49
49
|
'fetchCrossBorrowRate': false,
|
|
50
50
|
'fetchCrossBorrowRates': false,
|
|
51
51
|
'fetchDeposit': false,
|
|
52
|
+
'fetchDepositAddress': 'emulated',
|
|
53
|
+
'fetchDepositAddresses': true,
|
|
54
|
+
'fetchDepositAddressesByNetwork': false,
|
|
52
55
|
'fetchDeposits': false,
|
|
53
56
|
'fetchDepositsWithdrawals': true,
|
|
54
57
|
'fetchFundingHistory': false,
|
|
@@ -97,7 +100,7 @@ export default class indodax extends Exchange {
|
|
|
97
100
|
'urls': {
|
|
98
101
|
'logo': 'https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg',
|
|
99
102
|
'api': {
|
|
100
|
-
'public': 'https://indodax.com
|
|
103
|
+
'public': 'https://indodax.com',
|
|
101
104
|
'private': 'https://indodax.com/tapi',
|
|
102
105
|
},
|
|
103
106
|
'www': 'https://www.indodax.com',
|
|
@@ -107,14 +110,15 @@ export default class indodax extends Exchange {
|
|
|
107
110
|
'api': {
|
|
108
111
|
'public': {
|
|
109
112
|
'get': {
|
|
110
|
-
'server_time': 5,
|
|
111
|
-
'pairs': 5,
|
|
112
|
-
'price_increments': 5,
|
|
113
|
-
'summaries': 5,
|
|
114
|
-
'
|
|
115
|
-
'
|
|
116
|
-
'{pair}
|
|
117
|
-
'{pair}
|
|
113
|
+
'api/server_time': 5,
|
|
114
|
+
'api/pairs': 5,
|
|
115
|
+
'api/price_increments': 5,
|
|
116
|
+
'api/summaries': 5,
|
|
117
|
+
'api/ticker/{pair}': 5,
|
|
118
|
+
'api/ticker_all': 5,
|
|
119
|
+
'api/trades/{pair}': 5,
|
|
120
|
+
'api/depth/{pair}': 5,
|
|
121
|
+
'tradingview/history_v2': 5,
|
|
118
122
|
},
|
|
119
123
|
},
|
|
120
124
|
'private': {
|
|
@@ -160,7 +164,35 @@ export default class indodax extends Exchange {
|
|
|
160
164
|
'options': {
|
|
161
165
|
'recvWindow': 5 * 1000,
|
|
162
166
|
'timeDifference': 0,
|
|
163
|
-
'adjustForTimeDifference': false,
|
|
167
|
+
'adjustForTimeDifference': false,
|
|
168
|
+
'networks': {
|
|
169
|
+
'XLM': 'Stellar Token',
|
|
170
|
+
'BSC': 'bep20',
|
|
171
|
+
'TRC20': 'trc20',
|
|
172
|
+
'MATIC': 'polygon',
|
|
173
|
+
// 'BEP2': 'bep2',
|
|
174
|
+
// 'ARB': 'arb',
|
|
175
|
+
// 'ERC20': 'erc20',
|
|
176
|
+
// 'KIP7': 'kip7',
|
|
177
|
+
// 'MAINNET': 'mainnet', // TODO: does mainnet just mean the default?
|
|
178
|
+
// 'OEP4': 'oep4',
|
|
179
|
+
// 'OP': 'op',
|
|
180
|
+
// 'SPL': 'spl',
|
|
181
|
+
// 'TRC10': 'trc10',
|
|
182
|
+
// 'ZRC2': 'zrc2'
|
|
183
|
+
// 'ETH': 'eth'
|
|
184
|
+
// 'BASE': 'base'
|
|
185
|
+
},
|
|
186
|
+
'timeframes': {
|
|
187
|
+
'1m': '1',
|
|
188
|
+
'15m': '15',
|
|
189
|
+
'30m': '30',
|
|
190
|
+
'1h': '60',
|
|
191
|
+
'4h': '240',
|
|
192
|
+
'1d': '1D',
|
|
193
|
+
'3d': '3D',
|
|
194
|
+
'1w': '1W',
|
|
195
|
+
},
|
|
164
196
|
},
|
|
165
197
|
'commonCurrencies': {
|
|
166
198
|
'STR': 'XLM',
|
|
@@ -180,10 +212,11 @@ export default class indodax extends Exchange {
|
|
|
180
212
|
* @method
|
|
181
213
|
* @name indodax#fetchTime
|
|
182
214
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
215
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#server-time
|
|
183
216
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
184
217
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
185
218
|
*/
|
|
186
|
-
const response = await this.
|
|
219
|
+
const response = await this.publicGetApiServerTime(params);
|
|
187
220
|
//
|
|
188
221
|
// {
|
|
189
222
|
// "timezone": "UTC",
|
|
@@ -197,10 +230,11 @@ export default class indodax extends Exchange {
|
|
|
197
230
|
* @method
|
|
198
231
|
* @name indodax#fetchMarkets
|
|
199
232
|
* @description retrieves data on all markets for indodax
|
|
233
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#pairs
|
|
200
234
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
201
235
|
* @returns {object[]} an array of objects representing market data
|
|
202
236
|
*/
|
|
203
|
-
const response = await this.
|
|
237
|
+
const response = await this.publicGetApiPairs(params);
|
|
204
238
|
//
|
|
205
239
|
// [
|
|
206
240
|
// {
|
|
@@ -317,6 +351,7 @@ export default class indodax extends Exchange {
|
|
|
317
351
|
* @method
|
|
318
352
|
* @name indodax#fetchBalance
|
|
319
353
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
354
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#get-info-endpoint
|
|
320
355
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
321
356
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
322
357
|
*/
|
|
@@ -359,6 +394,7 @@ export default class indodax extends Exchange {
|
|
|
359
394
|
* @method
|
|
360
395
|
* @name indodax#fetchOrderBook
|
|
361
396
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
397
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#depth
|
|
362
398
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
363
399
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
364
400
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -367,9 +403,9 @@ export default class indodax extends Exchange {
|
|
|
367
403
|
await this.loadMarkets();
|
|
368
404
|
const market = this.market(symbol);
|
|
369
405
|
const request = {
|
|
370
|
-
'pair': market['
|
|
406
|
+
'pair': market['base'] + market['quote'],
|
|
371
407
|
};
|
|
372
|
-
const orderbook = await this.
|
|
408
|
+
const orderbook = await this.publicGetApiDepthPair(this.extend(request, params));
|
|
373
409
|
return this.parseOrderBook(orderbook, market['symbol'], undefined, 'buy', 'sell');
|
|
374
410
|
}
|
|
375
411
|
parseTicker(ticker, market = undefined) {
|
|
@@ -418,6 +454,7 @@ export default class indodax extends Exchange {
|
|
|
418
454
|
* @method
|
|
419
455
|
* @name indodax#fetchTicker
|
|
420
456
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
457
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#ticker
|
|
421
458
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
422
459
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
423
460
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -425,9 +462,9 @@ export default class indodax extends Exchange {
|
|
|
425
462
|
await this.loadMarkets();
|
|
426
463
|
const market = this.market(symbol);
|
|
427
464
|
const request = {
|
|
428
|
-
'pair': market['
|
|
465
|
+
'pair': market['base'] + market['quote'],
|
|
429
466
|
};
|
|
430
|
-
const response = await this.
|
|
467
|
+
const response = await this.publicGetApiTickerPair(this.extend(request, params));
|
|
431
468
|
//
|
|
432
469
|
// {
|
|
433
470
|
// "ticker": {
|
|
@@ -472,7 +509,7 @@ export default class indodax extends Exchange {
|
|
|
472
509
|
// }
|
|
473
510
|
// }
|
|
474
511
|
//
|
|
475
|
-
const response = await this.
|
|
512
|
+
const response = await this.publicGetApiTickerAll(params);
|
|
476
513
|
const tickers = this.safeValue(response, 'tickers');
|
|
477
514
|
return this.parseTickers(tickers, symbols);
|
|
478
515
|
}
|
|
@@ -499,6 +536,7 @@ export default class indodax extends Exchange {
|
|
|
499
536
|
* @method
|
|
500
537
|
* @name indodax#fetchTrades
|
|
501
538
|
* @description get the list of most recent trades for a particular symbol
|
|
539
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#trades
|
|
502
540
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
503
541
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
504
542
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -508,11 +546,81 @@ export default class indodax extends Exchange {
|
|
|
508
546
|
await this.loadMarkets();
|
|
509
547
|
const market = this.market(symbol);
|
|
510
548
|
const request = {
|
|
511
|
-
'pair': market['
|
|
549
|
+
'pair': market['base'] + market['quote'],
|
|
512
550
|
};
|
|
513
|
-
const response = await this.
|
|
551
|
+
const response = await this.publicGetApiTradesPair(this.extend(request, params));
|
|
514
552
|
return this.parseTrades(response, market, since, limit);
|
|
515
553
|
}
|
|
554
|
+
parseOHLCV(ohlcv, market = undefined) {
|
|
555
|
+
//
|
|
556
|
+
// {
|
|
557
|
+
// "Time": 1708416900,
|
|
558
|
+
// "Open": 51707.52,
|
|
559
|
+
// "High": 51707.52,
|
|
560
|
+
// "Low": 51707.52,
|
|
561
|
+
// "Close": 51707.52,
|
|
562
|
+
// "Volume": "0"
|
|
563
|
+
// }
|
|
564
|
+
//
|
|
565
|
+
return [
|
|
566
|
+
this.safeTimestamp(ohlcv, 'Time'),
|
|
567
|
+
this.safeNumber(ohlcv, 'Open'),
|
|
568
|
+
this.safeNumber(ohlcv, 'High'),
|
|
569
|
+
this.safeNumber(ohlcv, 'Low'),
|
|
570
|
+
this.safeNumber(ohlcv, 'Close'),
|
|
571
|
+
this.safeNumber(ohlcv, 'Volume'),
|
|
572
|
+
];
|
|
573
|
+
}
|
|
574
|
+
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
575
|
+
/**
|
|
576
|
+
* @method
|
|
577
|
+
* @name indodax#fetchOHLCV
|
|
578
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
579
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
580
|
+
* @param {string} timeframe the length of time each candle represents
|
|
581
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
582
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
583
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
584
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
585
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
586
|
+
*/
|
|
587
|
+
await this.loadMarkets();
|
|
588
|
+
const market = this.market(symbol);
|
|
589
|
+
const timeframes = this.options['timeframes'];
|
|
590
|
+
const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
591
|
+
const now = this.seconds();
|
|
592
|
+
const until = this.safeInteger2(params, 'until', 'till', now);
|
|
593
|
+
params = this.omit(params, ['until', 'till']);
|
|
594
|
+
const request = {
|
|
595
|
+
'to': until,
|
|
596
|
+
'tf': selectedTimeframe,
|
|
597
|
+
'symbol': market['base'] + market['quote'],
|
|
598
|
+
};
|
|
599
|
+
if (limit === undefined) {
|
|
600
|
+
limit = 1000;
|
|
601
|
+
}
|
|
602
|
+
if (since !== undefined) {
|
|
603
|
+
request['from'] = Math.floor(since / 1000);
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
const duration = this.parseTimeframe(timeframe);
|
|
607
|
+
request['from'] = now - limit * duration - 1;
|
|
608
|
+
}
|
|
609
|
+
const response = await this.publicGetTradingviewHistoryV2(this.extend(request, params));
|
|
610
|
+
//
|
|
611
|
+
// [
|
|
612
|
+
// {
|
|
613
|
+
// "Time": 1708416900,
|
|
614
|
+
// "Open": 51707.52,
|
|
615
|
+
// "High": 51707.52,
|
|
616
|
+
// "Low": 51707.52,
|
|
617
|
+
// "Close": 51707.52,
|
|
618
|
+
// "Volume": "0"
|
|
619
|
+
// }
|
|
620
|
+
// ]
|
|
621
|
+
//
|
|
622
|
+
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
623
|
+
}
|
|
516
624
|
parseOrderStatus(status) {
|
|
517
625
|
const statuses = {
|
|
518
626
|
'open': 'open',
|
|
@@ -604,6 +712,7 @@ export default class indodax extends Exchange {
|
|
|
604
712
|
* @method
|
|
605
713
|
* @name indodax#fetchOrder
|
|
606
714
|
* @description fetches information on an order made by the user
|
|
715
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#get-order-endpoints
|
|
607
716
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
608
717
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
609
718
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -628,6 +737,7 @@ export default class indodax extends Exchange {
|
|
|
628
737
|
* @method
|
|
629
738
|
* @name indodax#fetchOpenOrders
|
|
630
739
|
* @description fetch all unfilled currently open orders
|
|
740
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#open-orders-endpoints
|
|
631
741
|
* @param {string} symbol unified market symbol
|
|
632
742
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
633
743
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -668,6 +778,7 @@ export default class indodax extends Exchange {
|
|
|
668
778
|
* @method
|
|
669
779
|
* @name indodax#fetchClosedOrders
|
|
670
780
|
* @description fetches information on multiple closed orders made by the user
|
|
781
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#order-history
|
|
671
782
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
672
783
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
673
784
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -692,6 +803,7 @@ export default class indodax extends Exchange {
|
|
|
692
803
|
* @method
|
|
693
804
|
* @name indodax#createOrder
|
|
694
805
|
* @description create a trade order
|
|
806
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#trade-endpoints
|
|
695
807
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
696
808
|
* @param {string} type 'market' or 'limit'
|
|
697
809
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -731,6 +843,7 @@ export default class indodax extends Exchange {
|
|
|
731
843
|
* @method
|
|
732
844
|
* @name indodax#cancelOrder
|
|
733
845
|
* @description cancels an open order
|
|
846
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#cancel-order-endpoints
|
|
734
847
|
* @param {string} id order id
|
|
735
848
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
736
849
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -757,6 +870,7 @@ export default class indodax extends Exchange {
|
|
|
757
870
|
* @method
|
|
758
871
|
* @name indodax#fetchTransactionFee
|
|
759
872
|
* @description fetch the fee for a transaction
|
|
873
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-fee-endpoints
|
|
760
874
|
* @param {string} code unified currency code
|
|
761
875
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
762
876
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -790,6 +904,7 @@ export default class indodax extends Exchange {
|
|
|
790
904
|
* @method
|
|
791
905
|
* @name indodax#fetchDepositsWithdrawals
|
|
792
906
|
* @description fetch history of deposits and withdrawals
|
|
907
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#transaction-history-endpoints
|
|
793
908
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
794
909
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
795
910
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -891,6 +1006,7 @@ export default class indodax extends Exchange {
|
|
|
891
1006
|
* @method
|
|
892
1007
|
* @name indodax#withdraw
|
|
893
1008
|
* @description make a withdrawal
|
|
1009
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-coin-endpoints
|
|
894
1010
|
* @param {string} code unified currency code
|
|
895
1011
|
* @param {float} amount the amount to withdraw
|
|
896
1012
|
* @param {string} address the address to withdraw to
|
|
@@ -1019,10 +1135,100 @@ export default class indodax extends Exchange {
|
|
|
1019
1135
|
};
|
|
1020
1136
|
return this.safeString(statuses, status, status);
|
|
1021
1137
|
}
|
|
1138
|
+
async fetchDepositAddresses(codes = undefined, params = {}) {
|
|
1139
|
+
/**
|
|
1140
|
+
* @method
|
|
1141
|
+
* @name indodax#fetchDepositAddresses
|
|
1142
|
+
* @description fetch deposit addresses for multiple currencies and chain types
|
|
1143
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#general-information-on-endpoints
|
|
1144
|
+
* @param {string[]} [codes] list of unified currency codes, default is undefined
|
|
1145
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1146
|
+
* @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1147
|
+
*/
|
|
1148
|
+
await this.loadMarkets();
|
|
1149
|
+
const response = await this.privatePostGetInfo(params);
|
|
1150
|
+
//
|
|
1151
|
+
// {
|
|
1152
|
+
// success: '1',
|
|
1153
|
+
// return: {
|
|
1154
|
+
// server_time: '1708031570',
|
|
1155
|
+
// balance: {
|
|
1156
|
+
// idr: '29952',
|
|
1157
|
+
// ...
|
|
1158
|
+
// },
|
|
1159
|
+
// balance_hold: {
|
|
1160
|
+
// idr: '0',
|
|
1161
|
+
// ...
|
|
1162
|
+
// },
|
|
1163
|
+
// address: {
|
|
1164
|
+
// btc: '1KMntgzvU7iTSgMBWc11nVuJjAyfW3qJyk',
|
|
1165
|
+
// ...
|
|
1166
|
+
// },
|
|
1167
|
+
// memo_is_required: {
|
|
1168
|
+
// btc: { mainnet: false },
|
|
1169
|
+
// ...
|
|
1170
|
+
// },
|
|
1171
|
+
// network: {
|
|
1172
|
+
// btc: 'mainnet',
|
|
1173
|
+
// ...
|
|
1174
|
+
// },
|
|
1175
|
+
// user_id: '276011',
|
|
1176
|
+
// name: '',
|
|
1177
|
+
// email: 'testbitcoincoid@mailforspam.com',
|
|
1178
|
+
// profile_picture: null,
|
|
1179
|
+
// verification_status: 'unverified',
|
|
1180
|
+
// gauth_enable: true,
|
|
1181
|
+
// withdraw_status: '0'
|
|
1182
|
+
// }
|
|
1183
|
+
// }
|
|
1184
|
+
//
|
|
1185
|
+
const data = this.safeDict(response, 'return');
|
|
1186
|
+
const addresses = this.safeDict(data, 'address', {});
|
|
1187
|
+
const networks = this.safeDict(data, 'network', {});
|
|
1188
|
+
const addressKeys = Object.keys(addresses);
|
|
1189
|
+
const result = {
|
|
1190
|
+
'info': data,
|
|
1191
|
+
};
|
|
1192
|
+
for (let i = 0; i < addressKeys.length; i++) {
|
|
1193
|
+
const marketId = addressKeys[i];
|
|
1194
|
+
const code = this.safeCurrencyCode(marketId);
|
|
1195
|
+
const address = this.safeString(addresses, marketId);
|
|
1196
|
+
if ((address !== undefined) && ((codes === undefined) || (this.inArray(code, codes)))) {
|
|
1197
|
+
this.checkAddress(address);
|
|
1198
|
+
let network = undefined;
|
|
1199
|
+
if (marketId in networks) {
|
|
1200
|
+
const networkId = this.safeString(networks, marketId);
|
|
1201
|
+
if (networkId.indexOf(',') >= 0) {
|
|
1202
|
+
network = [];
|
|
1203
|
+
const networkIds = networkId.split(',');
|
|
1204
|
+
for (let j = 0; j < networkIds.length; j++) {
|
|
1205
|
+
network.push(this.networkIdToCode(networkIds[j]).toUpperCase());
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
else {
|
|
1209
|
+
network = this.networkIdToCode(networkId).toUpperCase();
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
result[code] = {
|
|
1213
|
+
'info': {},
|
|
1214
|
+
'currency': code,
|
|
1215
|
+
'address': address,
|
|
1216
|
+
'network': network,
|
|
1217
|
+
'tag': undefined,
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
return result;
|
|
1222
|
+
}
|
|
1022
1223
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
1023
1224
|
let url = this.urls['api'][api];
|
|
1024
1225
|
if (api === 'public') {
|
|
1025
|
-
|
|
1226
|
+
const query = this.omit(params, this.extractParams(path));
|
|
1227
|
+
const requestPath = '/' + this.implodeParams(path, params);
|
|
1228
|
+
url = url + requestPath;
|
|
1229
|
+
if (Object.keys(query).length) {
|
|
1230
|
+
url += '?' + this.urlencodeWithArrayRepeat(query);
|
|
1231
|
+
}
|
|
1026
1232
|
}
|
|
1027
1233
|
else {
|
|
1028
1234
|
this.checkRequiredCredentials();
|
package/js/src/okx.js
CHANGED
|
@@ -5231,6 +5231,7 @@ export default class okx extends Exchange {
|
|
|
5231
5231
|
* @method
|
|
5232
5232
|
* @name okx#fetchPositions
|
|
5233
5233
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5234
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
5234
5235
|
* @description fetch all open positions
|
|
5235
5236
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5236
5237
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -5371,13 +5372,38 @@ export default class okx extends Exchange {
|
|
|
5371
5372
|
// "vegaBS": "",
|
|
5372
5373
|
// "vegaPA": ""
|
|
5373
5374
|
// }
|
|
5375
|
+
// history
|
|
5376
|
+
// {
|
|
5377
|
+
// "cTime":"1708351230102",
|
|
5378
|
+
// "ccy":"USDT",
|
|
5379
|
+
// "closeAvgPx":"1.2567",
|
|
5380
|
+
// "closeTotalPos":"40",
|
|
5381
|
+
// "direction":"short",
|
|
5382
|
+
// "fee":"-0.0351036",
|
|
5383
|
+
// "fundingFee":"0",
|
|
5384
|
+
// "instId":"SUSHI-USDT-SWAP",
|
|
5385
|
+
// "instType":"SWAP",
|
|
5386
|
+
// "lever":"10.0",
|
|
5387
|
+
// "liqPenalty":"0",
|
|
5388
|
+
// "mgnMode":"isolated",
|
|
5389
|
+
// "openAvgPx":"1.2462",
|
|
5390
|
+
// "openMaxPos":"40",
|
|
5391
|
+
// "pnl":"-0.42",
|
|
5392
|
+
// "pnlRatio":"-0.0912982667308618",
|
|
5393
|
+
// "posId":"666159086676836352",
|
|
5394
|
+
// "realizedPnl":"-0.4551036",
|
|
5395
|
+
// "triggerPx":"",
|
|
5396
|
+
// "type":"2",
|
|
5397
|
+
// "uTime":"1708354805699",
|
|
5398
|
+
// "uly":"SUSHI-USDT"
|
|
5399
|
+
// }
|
|
5374
5400
|
//
|
|
5375
5401
|
const marketId = this.safeString(position, 'instId');
|
|
5376
5402
|
market = this.safeMarket(marketId, market);
|
|
5377
5403
|
const symbol = market['symbol'];
|
|
5378
5404
|
const pos = this.safeString(position, 'pos'); // 'pos' field: One way mode: 0 if position is not open, 1 if open | Two way (hedge) mode: -1 if short, 1 if long, 0 if position is not open
|
|
5379
5405
|
const contractsAbs = Precise.stringAbs(pos);
|
|
5380
|
-
let side = this.
|
|
5406
|
+
let side = this.safeString2(position, 'posSide', 'direction');
|
|
5381
5407
|
const hedged = side !== 'net';
|
|
5382
5408
|
const contracts = this.parseNumber(contractsAbs);
|
|
5383
5409
|
if (market['margin']) {
|
|
@@ -5418,7 +5444,7 @@ export default class okx extends Exchange {
|
|
|
5418
5444
|
const notional = this.parseNumber(notionalString);
|
|
5419
5445
|
const marginMode = this.safeString(position, 'mgnMode');
|
|
5420
5446
|
let initialMarginString = undefined;
|
|
5421
|
-
const entryPriceString = this.
|
|
5447
|
+
const entryPriceString = this.safeString2(position, 'avgPx', 'openAvgPx');
|
|
5422
5448
|
const unrealizedPnlString = this.safeString(position, 'upl');
|
|
5423
5449
|
const leverageString = this.safeString(position, 'lever');
|
|
5424
5450
|
let initialMarginPercentage = undefined;
|
|
@@ -5449,23 +5475,24 @@ export default class okx extends Exchange {
|
|
|
5449
5475
|
const marginRatio = this.parseNumber(Precise.stringDiv(maintenanceMarginString, collateralString, 4));
|
|
5450
5476
|
return this.safePosition({
|
|
5451
5477
|
'info': position,
|
|
5452
|
-
'id':
|
|
5478
|
+
'id': this.safeString(position, 'posId'),
|
|
5453
5479
|
'symbol': symbol,
|
|
5454
5480
|
'notional': notional,
|
|
5455
5481
|
'marginMode': marginMode,
|
|
5456
5482
|
'liquidationPrice': liquidationPrice,
|
|
5457
5483
|
'entryPrice': this.parseNumber(entryPriceString),
|
|
5458
5484
|
'unrealizedPnl': this.parseNumber(unrealizedPnlString),
|
|
5485
|
+
'realizedPnl': this.safeNumber(position, 'realizedPnl'),
|
|
5459
5486
|
'percentage': percentage,
|
|
5460
5487
|
'contracts': contracts,
|
|
5461
5488
|
'contractSize': contractSize,
|
|
5462
5489
|
'markPrice': this.parseNumber(markPriceString),
|
|
5463
|
-
'lastPrice':
|
|
5490
|
+
'lastPrice': this.safeNumber(position, 'closeAvgPx'),
|
|
5464
5491
|
'side': side,
|
|
5465
5492
|
'hedged': hedged,
|
|
5466
5493
|
'timestamp': timestamp,
|
|
5467
5494
|
'datetime': this.iso8601(timestamp),
|
|
5468
|
-
'lastUpdateTimestamp':
|
|
5495
|
+
'lastUpdateTimestamp': this.safeInteger(position, 'uTime'),
|
|
5469
5496
|
'maintenanceMargin': maintenanceMargin,
|
|
5470
5497
|
'maintenanceMarginPercentage': maintenanceMarginPercentage,
|
|
5471
5498
|
'collateral': this.parseNumber(collateralString),
|
package/js/src/pro/hitbtc.js
CHANGED
|
@@ -223,7 +223,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
223
223
|
'symbols': [market['id']],
|
|
224
224
|
},
|
|
225
225
|
};
|
|
226
|
-
const orderbook = await this.subscribePublic(name,
|
|
226
|
+
const orderbook = await this.subscribePublic(name, 'orderbooks', [symbol], this.deepExtend(request, params));
|
|
227
227
|
return orderbook.limit();
|
|
228
228
|
}
|
|
229
229
|
handleOrderBook(client, message) {
|
|
@@ -252,13 +252,12 @@ export default class hitbtc extends hitbtcRest {
|
|
|
252
252
|
//
|
|
253
253
|
const data = this.safeValue2(message, 'snapshot', 'update', {});
|
|
254
254
|
const marketIds = Object.keys(data);
|
|
255
|
-
const channel = this.safeString(message, 'ch');
|
|
256
255
|
for (let i = 0; i < marketIds.length; i++) {
|
|
257
256
|
const marketId = marketIds[i];
|
|
258
257
|
const market = this.safeMarket(marketId);
|
|
259
258
|
const symbol = market['symbol'];
|
|
260
259
|
const item = data[marketId];
|
|
261
|
-
const messageHash =
|
|
260
|
+
const messageHash = 'orderbooks::' + symbol;
|
|
262
261
|
if (!(symbol in this.orderbooks)) {
|
|
263
262
|
const subscription = this.safeValue(client.subscriptions, messageHash, {});
|
|
264
263
|
const limit = this.safeInteger(subscription, 'limit');
|
|
@@ -316,7 +315,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
316
315
|
'symbols': [market['id']],
|
|
317
316
|
},
|
|
318
317
|
};
|
|
319
|
-
const result = await this.subscribePublic(name, '
|
|
318
|
+
const result = await this.subscribePublic(name, 'tickers', [symbol], this.deepExtend(request, params));
|
|
320
319
|
return this.safeValue(result, symbol);
|
|
321
320
|
}
|
|
322
321
|
async watchTickers(symbols = undefined, params = {}) {
|
|
@@ -399,7 +398,6 @@ export default class hitbtc extends hitbtcRest {
|
|
|
399
398
|
//
|
|
400
399
|
const data = this.safeValue(message, 'data', {});
|
|
401
400
|
const marketIds = Object.keys(data);
|
|
402
|
-
const channel = this.safeString(message, 'ch');
|
|
403
401
|
const newTickers = {};
|
|
404
402
|
for (let i = 0; i < marketIds.length; i++) {
|
|
405
403
|
const marketId = marketIds[i];
|
|
@@ -408,8 +406,6 @@ export default class hitbtc extends hitbtcRest {
|
|
|
408
406
|
const ticker = this.parseWsTicker(data[marketId], market);
|
|
409
407
|
this.tickers[symbol] = ticker;
|
|
410
408
|
newTickers[symbol] = ticker;
|
|
411
|
-
const messageHash = channel + '::' + symbol;
|
|
412
|
-
client.resolve(newTickers, messageHash);
|
|
413
409
|
}
|
|
414
410
|
client.resolve(newTickers, 'tickers');
|
|
415
411
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
@@ -425,7 +421,6 @@ export default class hitbtc extends hitbtcRest {
|
|
|
425
421
|
client.resolve(tickers, messageHash);
|
|
426
422
|
}
|
|
427
423
|
}
|
|
428
|
-
client.resolve(this.tickers, channel);
|
|
429
424
|
return message;
|
|
430
425
|
}
|
|
431
426
|
parseWsTicker(ticker, market = undefined) {
|
|
@@ -506,7 +501,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
506
501
|
request['limit'] = limit;
|
|
507
502
|
}
|
|
508
503
|
const name = 'trades';
|
|
509
|
-
const trades = await this.subscribePublic(name,
|
|
504
|
+
const trades = await this.subscribePublic(name, 'trades', [symbol], this.deepExtend(request, params));
|
|
510
505
|
if (this.newUpdates) {
|
|
511
506
|
limit = trades.getLimit(symbol, limit);
|
|
512
507
|
}
|
|
@@ -635,7 +630,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
635
630
|
if (limit !== undefined) {
|
|
636
631
|
request['params']['limit'] = limit;
|
|
637
632
|
}
|
|
638
|
-
const ohlcv = await this.subscribePublic(name,
|
|
633
|
+
const ohlcv = await this.subscribePublic(name, 'candles', [symbol], this.deepExtend(request, params));
|
|
639
634
|
if (this.newUpdates) {
|
|
640
635
|
limit = ohlcv.getLimit(symbol, limit);
|
|
641
636
|
}
|
|
@@ -696,7 +691,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
696
691
|
for (let j = 0; j < ohlcvs.length; j++) {
|
|
697
692
|
stored.append(ohlcvs[j]);
|
|
698
693
|
}
|
|
699
|
-
const messageHash =
|
|
694
|
+
const messageHash = 'candles::' + symbol;
|
|
700
695
|
client.resolve(stored, messageHash);
|
|
701
696
|
}
|
|
702
697
|
return message;
|
package/js/src/upbit.d.ts
CHANGED
|
@@ -62,7 +62,9 @@ export default class upbit extends Exchange {
|
|
|
62
62
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
63
63
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
64
64
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
65
|
+
fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
65
66
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
67
|
+
fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
66
68
|
parseTransactionStatus(status: any): string;
|
|
67
69
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
68
70
|
parseOrderStatus(status: any): string;
|