ccxt 4.2.47 → 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/README.md +3 -3
- package/dist/ccxt.browser.js +304 -54
- 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/idex.js +52 -1
- package/dist/cjs/src/indodax.js +120 -19
- 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/indodax.d.ts +9 -8
- package/js/src/binance.js +3 -1
- package/js/src/idex.d.ts +7 -0
- package/js/src/idex.js +52 -1
- package/js/src/indodax.d.ts +3 -1
- package/js/src/indodax.js +120 -19
- 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/dist/ccxt.browser.js
CHANGED
|
@@ -23830,12 +23830,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23830
23830
|
const trailingDelta = this.safeString(params, 'trailingDelta');
|
|
23831
23831
|
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
|
|
23832
23832
|
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23833
|
+
const priceMatch = this.safeString(params, 'priceMatch');
|
|
23833
23834
|
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23834
23835
|
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
23835
23836
|
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23836
23837
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
23837
23838
|
const isConditional = isTriggerOrder || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
23838
23839
|
const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
|
|
23840
|
+
const isPriceMatch = priceMatch !== undefined;
|
|
23839
23841
|
let uppercaseType = type.toUpperCase();
|
|
23840
23842
|
let stopPrice = undefined;
|
|
23841
23843
|
if (isTrailingPercentOrder) {
|
|
@@ -24016,7 +24018,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24016
24018
|
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
24017
24019
|
}
|
|
24018
24020
|
}
|
|
24019
|
-
if (priceIsRequired) {
|
|
24021
|
+
if (priceIsRequired && !isPriceMatch) {
|
|
24020
24022
|
if (price === undefined) {
|
|
24021
24023
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
|
24022
24024
|
}
|
|
@@ -158184,8 +158186,10 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158184
158186
|
'fetchPositions': false,
|
|
158185
158187
|
'fetchPositionsRisk': false,
|
|
158186
158188
|
'fetchPremiumIndexOHLCV': false,
|
|
158189
|
+
'fetchStatus': true,
|
|
158187
158190
|
'fetchTicker': true,
|
|
158188
158191
|
'fetchTickers': true,
|
|
158192
|
+
'fetchTime': true,
|
|
158189
158193
|
'fetchTrades': true,
|
|
158190
158194
|
'fetchTradingFee': false,
|
|
158191
158195
|
'fetchTradingFees': true,
|
|
@@ -158299,6 +158303,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158299
158303
|
* @method
|
|
158300
158304
|
* @name idex#fetchMarkets
|
|
158301
158305
|
* @description retrieves data on all markets for idex
|
|
158306
|
+
* @see https://api-docs-v3.idex.io/#get-markets
|
|
158302
158307
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
158303
158308
|
* @returns {object[]} an array of objects representing market data
|
|
158304
158309
|
*/
|
|
@@ -158429,6 +158434,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158429
158434
|
* @method
|
|
158430
158435
|
* @name idex#fetchTicker
|
|
158431
158436
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
158437
|
+
* @see https://api-docs-v3.idex.io/#get-tickers
|
|
158432
158438
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
158433
158439
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
158434
158440
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -158465,6 +158471,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158465
158471
|
* @method
|
|
158466
158472
|
* @name idex#fetchTickers
|
|
158467
158473
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
158474
|
+
* @see https://api-docs-v3.idex.io/#get-tickers
|
|
158468
158475
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
158469
158476
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
158470
158477
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -158541,6 +158548,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158541
158548
|
* @method
|
|
158542
158549
|
* @name idex#fetchOHLCV
|
|
158543
158550
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
158551
|
+
* @see https://api-docs-v3.idex.io/#get-candles
|
|
158544
158552
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
158545
158553
|
* @param {string} timeframe the length of time each candle represents
|
|
158546
158554
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -158603,6 +158611,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158603
158611
|
* @method
|
|
158604
158612
|
* @name idex#fetchTrades
|
|
158605
158613
|
* @description get the list of most recent trades for a particular symbol
|
|
158614
|
+
* @see https://api-docs-v3.idex.io/#get-trades
|
|
158606
158615
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
158607
158616
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
158608
158617
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -158716,6 +158725,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158716
158725
|
* @method
|
|
158717
158726
|
* @name idex#fetchTradingFees
|
|
158718
158727
|
* @description fetch the trading fees for multiple markets
|
|
158728
|
+
* @see https://api-docs-v3.idex.io/#get-api-account
|
|
158719
158729
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
158720
158730
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
158721
158731
|
*/
|
|
@@ -158761,6 +158771,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158761
158771
|
* @method
|
|
158762
158772
|
* @name idex#fetchOrderBook
|
|
158763
158773
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
158774
|
+
* @see https://api-docs-v3.idex.io/#get-order-books
|
|
158764
158775
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
158765
158776
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
158766
158777
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -158824,6 +158835,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158824
158835
|
* @method
|
|
158825
158836
|
* @name idex#fetchCurrencies
|
|
158826
158837
|
* @description fetches all available currencies on an exchange
|
|
158838
|
+
* @see https://api-docs-v3.idex.io/#get-assets
|
|
158827
158839
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
158828
158840
|
* @returns {object} an associative dictionary of currencies
|
|
158829
158841
|
*/
|
|
@@ -158889,6 +158901,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158889
158901
|
* @method
|
|
158890
158902
|
* @name idex#fetchBalance
|
|
158891
158903
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
158904
|
+
* @see https://api-docs-v3.idex.io/#get-balances
|
|
158892
158905
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
158893
158906
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
158894
158907
|
*/
|
|
@@ -158933,6 +158946,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158933
158946
|
* @method
|
|
158934
158947
|
* @name idex#fetchMyTrades
|
|
158935
158948
|
* @description fetch all trades made by the user
|
|
158949
|
+
* @see https://api-docs-v3.idex.io/#get-fills
|
|
158936
158950
|
* @param {string} symbol unified market symbol
|
|
158937
158951
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
158938
158952
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -159001,6 +159015,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159001
159015
|
* @method
|
|
159002
159016
|
* @name idex#fetchOrder
|
|
159003
159017
|
* @description fetches information on an order made by the user
|
|
159018
|
+
* @see https://api-docs-v3.idex.io/#get-orders
|
|
159004
159019
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
159005
159020
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
159006
159021
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -159015,6 +159030,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159015
159030
|
* @method
|
|
159016
159031
|
* @name idex#fetchOpenOrders
|
|
159017
159032
|
* @description fetch all unfilled currently open orders
|
|
159033
|
+
* @see https://api-docs-v3.idex.io/#get-orders
|
|
159018
159034
|
* @param {string} symbol unified market symbol
|
|
159019
159035
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
159020
159036
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -159031,6 +159047,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159031
159047
|
* @method
|
|
159032
159048
|
* @name idex#fetchClosedOrders
|
|
159033
159049
|
* @description fetches information on multiple closed orders made by the user
|
|
159050
|
+
* @see https://api-docs-v3.idex.io/#get-orders
|
|
159034
159051
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
159035
159052
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
159036
159053
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -159242,16 +159259,20 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159242
159259
|
* @method
|
|
159243
159260
|
* @name idex#createOrder
|
|
159244
159261
|
* @description create a trade order, https://docs.idex.io/#create-order
|
|
159262
|
+
* @see https://api-docs-v3.idex.io/#create-order
|
|
159245
159263
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
159246
159264
|
* @param {string} type 'market' or 'limit'
|
|
159247
159265
|
* @param {string} side 'buy' or 'sell'
|
|
159248
159266
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
159249
159267
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
159250
159268
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
159269
|
+
* @param {bool} [params.test] set to true to test an order, no order will be created but the request will be validated
|
|
159251
159270
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
159252
159271
|
*/
|
|
159253
159272
|
this.checkRequiredCredentials();
|
|
159254
159273
|
await this.loadMarkets();
|
|
159274
|
+
const testOrder = this.safeBool(params, 'test', false);
|
|
159275
|
+
params = this.omit(params, 'test');
|
|
159255
159276
|
const market = this.market(symbol);
|
|
159256
159277
|
const nonce = this.uuidv1();
|
|
159257
159278
|
let typeEnum = undefined;
|
|
@@ -159432,7 +159453,13 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159432
159453
|
// "avgExecutionPrice": "0.09905990"
|
|
159433
159454
|
// }
|
|
159434
159455
|
// we don't use extend here because it is a signed endpoint
|
|
159435
|
-
|
|
159456
|
+
let response = undefined;
|
|
159457
|
+
if (testOrder) {
|
|
159458
|
+
response = await this.privatePostOrdersTest(request);
|
|
159459
|
+
}
|
|
159460
|
+
else {
|
|
159461
|
+
response = await this.privatePostOrders(request);
|
|
159462
|
+
}
|
|
159436
159463
|
return this.parseOrder(response, market);
|
|
159437
159464
|
}
|
|
159438
159465
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
@@ -159440,6 +159467,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159440
159467
|
* @method
|
|
159441
159468
|
* @name idex#withdraw
|
|
159442
159469
|
* @description make a withdrawal
|
|
159470
|
+
* @see https://api-docs-v3.idex.io/#withdraw-funds
|
|
159443
159471
|
* @param {string} code unified currency code
|
|
159444
159472
|
* @param {float} amount the amount to withdraw
|
|
159445
159473
|
* @param {string} address the address to withdraw to
|
|
@@ -159493,6 +159521,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159493
159521
|
* @method
|
|
159494
159522
|
* @name idex#cancelAllOrders
|
|
159495
159523
|
* @description cancel all open orders
|
|
159524
|
+
* @see https://api-docs-v3.idex.io/#cancel-order
|
|
159496
159525
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
159497
159526
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
159498
159527
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -159532,6 +159561,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159532
159561
|
* @method
|
|
159533
159562
|
* @name idex#cancelOrder
|
|
159534
159563
|
* @description cancels an open order
|
|
159564
|
+
* @see https://api-docs-v3.idex.io/#cancel-order
|
|
159535
159565
|
* @param {string} id order id
|
|
159536
159566
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
159537
159567
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -159583,6 +159613,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159583
159613
|
* @method
|
|
159584
159614
|
* @name idex#fetchDeposit
|
|
159585
159615
|
* @description fetch information on a deposit
|
|
159616
|
+
* @see https://api-docs-v3.idex.io/#get-deposits
|
|
159586
159617
|
* @param {string} id deposit id
|
|
159587
159618
|
* @param {string} code not used by idex fetchDeposit ()
|
|
159588
159619
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -159603,6 +159634,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159603
159634
|
* @method
|
|
159604
159635
|
* @name idex#fetchDeposits
|
|
159605
159636
|
* @description fetch all deposits made to an account
|
|
159637
|
+
* @see https://api-docs-v3.idex.io/#get-deposits
|
|
159606
159638
|
* @param {string} code unified currency code
|
|
159607
159639
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
159608
159640
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -159614,11 +159646,30 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159614
159646
|
}, params);
|
|
159615
159647
|
return await this.fetchTransactionsHelper(code, since, limit, params);
|
|
159616
159648
|
}
|
|
159649
|
+
async fetchStatus(params = {}) {
|
|
159650
|
+
/**
|
|
159651
|
+
* @method
|
|
159652
|
+
* @name idex#fetchStatus
|
|
159653
|
+
* @description the latest known information on the availability of the exchange API
|
|
159654
|
+
* @see https://api-docs-v3.idex.io/#get-ping
|
|
159655
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
159656
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
159657
|
+
*/
|
|
159658
|
+
const response = await this.publicGetPing(params);
|
|
159659
|
+
return {
|
|
159660
|
+
'status': 'ok',
|
|
159661
|
+
'updated': undefined,
|
|
159662
|
+
'eta': undefined,
|
|
159663
|
+
'url': undefined,
|
|
159664
|
+
'info': response,
|
|
159665
|
+
};
|
|
159666
|
+
}
|
|
159617
159667
|
async fetchTime(params = {}) {
|
|
159618
159668
|
/**
|
|
159619
159669
|
* @method
|
|
159620
159670
|
* @name idex#fetchTime
|
|
159621
159671
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
159672
|
+
* @see https://api-docs-v3.idex.io/#get-time
|
|
159622
159673
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
159623
159674
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
159624
159675
|
*/
|
|
@@ -159633,6 +159684,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159633
159684
|
* @method
|
|
159634
159685
|
* @name idex#fetchWithdrawal
|
|
159635
159686
|
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
159687
|
+
* @see https://api-docs-v3.idex.io/#get-withdrawals
|
|
159636
159688
|
* @param {string} id withdrawal id
|
|
159637
159689
|
* @param {string} code not used by idex.fetchWithdrawal
|
|
159638
159690
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -159653,6 +159705,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159653
159705
|
* @method
|
|
159654
159706
|
* @name idex#fetchWithdrawals
|
|
159655
159707
|
* @description fetch all withdrawals made from an account
|
|
159708
|
+
* @see https://api-docs-v3.idex.io/#get-withdrawals
|
|
159656
159709
|
* @param {string} code unified currency code
|
|
159657
159710
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
159658
159711
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -160808,7 +160861,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
160808
160861
|
'urls': {
|
|
160809
160862
|
'logo': 'https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg',
|
|
160810
160863
|
'api': {
|
|
160811
|
-
'public': 'https://indodax.com
|
|
160864
|
+
'public': 'https://indodax.com',
|
|
160812
160865
|
'private': 'https://indodax.com/tapi',
|
|
160813
160866
|
},
|
|
160814
160867
|
'www': 'https://www.indodax.com',
|
|
@@ -160818,14 +160871,15 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
160818
160871
|
'api': {
|
|
160819
160872
|
'public': {
|
|
160820
160873
|
'get': {
|
|
160821
|
-
'server_time': 5,
|
|
160822
|
-
'pairs': 5,
|
|
160823
|
-
'price_increments': 5,
|
|
160824
|
-
'summaries': 5,
|
|
160825
|
-
'
|
|
160826
|
-
'
|
|
160827
|
-
'{pair}
|
|
160828
|
-
'{pair}
|
|
160874
|
+
'api/server_time': 5,
|
|
160875
|
+
'api/pairs': 5,
|
|
160876
|
+
'api/price_increments': 5,
|
|
160877
|
+
'api/summaries': 5,
|
|
160878
|
+
'api/ticker/{pair}': 5,
|
|
160879
|
+
'api/ticker_all': 5,
|
|
160880
|
+
'api/trades/{pair}': 5,
|
|
160881
|
+
'api/depth/{pair}': 5,
|
|
160882
|
+
'tradingview/history_v2': 5,
|
|
160829
160883
|
},
|
|
160830
160884
|
},
|
|
160831
160885
|
'private': {
|
|
@@ -160890,6 +160944,16 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
160890
160944
|
// 'ETH': 'eth'
|
|
160891
160945
|
// 'BASE': 'base'
|
|
160892
160946
|
},
|
|
160947
|
+
'timeframes': {
|
|
160948
|
+
'1m': '1',
|
|
160949
|
+
'15m': '15',
|
|
160950
|
+
'30m': '30',
|
|
160951
|
+
'1h': '60',
|
|
160952
|
+
'4h': '240',
|
|
160953
|
+
'1d': '1D',
|
|
160954
|
+
'3d': '3D',
|
|
160955
|
+
'1w': '1W',
|
|
160956
|
+
},
|
|
160893
160957
|
},
|
|
160894
160958
|
'commonCurrencies': {
|
|
160895
160959
|
'STR': 'XLM',
|
|
@@ -160909,10 +160973,11 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
160909
160973
|
* @method
|
|
160910
160974
|
* @name indodax#fetchTime
|
|
160911
160975
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
160976
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#server-time
|
|
160912
160977
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
160913
160978
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
160914
160979
|
*/
|
|
160915
|
-
const response = await this.
|
|
160980
|
+
const response = await this.publicGetApiServerTime(params);
|
|
160916
160981
|
//
|
|
160917
160982
|
// {
|
|
160918
160983
|
// "timezone": "UTC",
|
|
@@ -160926,10 +160991,11 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
160926
160991
|
* @method
|
|
160927
160992
|
* @name indodax#fetchMarkets
|
|
160928
160993
|
* @description retrieves data on all markets for indodax
|
|
160994
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#pairs
|
|
160929
160995
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
160930
160996
|
* @returns {object[]} an array of objects representing market data
|
|
160931
160997
|
*/
|
|
160932
|
-
const response = await this.
|
|
160998
|
+
const response = await this.publicGetApiPairs(params);
|
|
160933
160999
|
//
|
|
160934
161000
|
// [
|
|
160935
161001
|
// {
|
|
@@ -161046,6 +161112,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161046
161112
|
* @method
|
|
161047
161113
|
* @name indodax#fetchBalance
|
|
161048
161114
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
161115
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#get-info-endpoint
|
|
161049
161116
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161050
161117
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
161051
161118
|
*/
|
|
@@ -161088,6 +161155,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161088
161155
|
* @method
|
|
161089
161156
|
* @name indodax#fetchOrderBook
|
|
161090
161157
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
161158
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#depth
|
|
161091
161159
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
161092
161160
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
161093
161161
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -161096,9 +161164,9 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161096
161164
|
await this.loadMarkets();
|
|
161097
161165
|
const market = this.market(symbol);
|
|
161098
161166
|
const request = {
|
|
161099
|
-
'pair': market['
|
|
161167
|
+
'pair': market['base'] + market['quote'],
|
|
161100
161168
|
};
|
|
161101
|
-
const orderbook = await this.
|
|
161169
|
+
const orderbook = await this.publicGetApiDepthPair(this.extend(request, params));
|
|
161102
161170
|
return this.parseOrderBook(orderbook, market['symbol'], undefined, 'buy', 'sell');
|
|
161103
161171
|
}
|
|
161104
161172
|
parseTicker(ticker, market = undefined) {
|
|
@@ -161147,6 +161215,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161147
161215
|
* @method
|
|
161148
161216
|
* @name indodax#fetchTicker
|
|
161149
161217
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
161218
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#ticker
|
|
161150
161219
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
161151
161220
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161152
161221
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -161154,9 +161223,9 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161154
161223
|
await this.loadMarkets();
|
|
161155
161224
|
const market = this.market(symbol);
|
|
161156
161225
|
const request = {
|
|
161157
|
-
'pair': market['
|
|
161226
|
+
'pair': market['base'] + market['quote'],
|
|
161158
161227
|
};
|
|
161159
|
-
const response = await this.
|
|
161228
|
+
const response = await this.publicGetApiTickerPair(this.extend(request, params));
|
|
161160
161229
|
//
|
|
161161
161230
|
// {
|
|
161162
161231
|
// "ticker": {
|
|
@@ -161201,7 +161270,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161201
161270
|
// }
|
|
161202
161271
|
// }
|
|
161203
161272
|
//
|
|
161204
|
-
const response = await this.
|
|
161273
|
+
const response = await this.publicGetApiTickerAll(params);
|
|
161205
161274
|
const tickers = this.safeValue(response, 'tickers');
|
|
161206
161275
|
return this.parseTickers(tickers, symbols);
|
|
161207
161276
|
}
|
|
@@ -161228,6 +161297,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161228
161297
|
* @method
|
|
161229
161298
|
* @name indodax#fetchTrades
|
|
161230
161299
|
* @description get the list of most recent trades for a particular symbol
|
|
161300
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#trades
|
|
161231
161301
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
161232
161302
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
161233
161303
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -161237,11 +161307,81 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161237
161307
|
await this.loadMarkets();
|
|
161238
161308
|
const market = this.market(symbol);
|
|
161239
161309
|
const request = {
|
|
161240
|
-
'pair': market['
|
|
161310
|
+
'pair': market['base'] + market['quote'],
|
|
161241
161311
|
};
|
|
161242
|
-
const response = await this.
|
|
161312
|
+
const response = await this.publicGetApiTradesPair(this.extend(request, params));
|
|
161243
161313
|
return this.parseTrades(response, market, since, limit);
|
|
161244
161314
|
}
|
|
161315
|
+
parseOHLCV(ohlcv, market = undefined) {
|
|
161316
|
+
//
|
|
161317
|
+
// {
|
|
161318
|
+
// "Time": 1708416900,
|
|
161319
|
+
// "Open": 51707.52,
|
|
161320
|
+
// "High": 51707.52,
|
|
161321
|
+
// "Low": 51707.52,
|
|
161322
|
+
// "Close": 51707.52,
|
|
161323
|
+
// "Volume": "0"
|
|
161324
|
+
// }
|
|
161325
|
+
//
|
|
161326
|
+
return [
|
|
161327
|
+
this.safeTimestamp(ohlcv, 'Time'),
|
|
161328
|
+
this.safeNumber(ohlcv, 'Open'),
|
|
161329
|
+
this.safeNumber(ohlcv, 'High'),
|
|
161330
|
+
this.safeNumber(ohlcv, 'Low'),
|
|
161331
|
+
this.safeNumber(ohlcv, 'Close'),
|
|
161332
|
+
this.safeNumber(ohlcv, 'Volume'),
|
|
161333
|
+
];
|
|
161334
|
+
}
|
|
161335
|
+
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
161336
|
+
/**
|
|
161337
|
+
* @method
|
|
161338
|
+
* @name indodax#fetchOHLCV
|
|
161339
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
161340
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
161341
|
+
* @param {string} timeframe the length of time each candle represents
|
|
161342
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
161343
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
161344
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161345
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
161346
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
161347
|
+
*/
|
|
161348
|
+
await this.loadMarkets();
|
|
161349
|
+
const market = this.market(symbol);
|
|
161350
|
+
const timeframes = this.options['timeframes'];
|
|
161351
|
+
const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
161352
|
+
const now = this.seconds();
|
|
161353
|
+
const until = this.safeInteger2(params, 'until', 'till', now);
|
|
161354
|
+
params = this.omit(params, ['until', 'till']);
|
|
161355
|
+
const request = {
|
|
161356
|
+
'to': until,
|
|
161357
|
+
'tf': selectedTimeframe,
|
|
161358
|
+
'symbol': market['base'] + market['quote'],
|
|
161359
|
+
};
|
|
161360
|
+
if (limit === undefined) {
|
|
161361
|
+
limit = 1000;
|
|
161362
|
+
}
|
|
161363
|
+
if (since !== undefined) {
|
|
161364
|
+
request['from'] = Math.floor(since / 1000);
|
|
161365
|
+
}
|
|
161366
|
+
else {
|
|
161367
|
+
const duration = this.parseTimeframe(timeframe);
|
|
161368
|
+
request['from'] = now - limit * duration - 1;
|
|
161369
|
+
}
|
|
161370
|
+
const response = await this.publicGetTradingviewHistoryV2(this.extend(request, params));
|
|
161371
|
+
//
|
|
161372
|
+
// [
|
|
161373
|
+
// {
|
|
161374
|
+
// "Time": 1708416900,
|
|
161375
|
+
// "Open": 51707.52,
|
|
161376
|
+
// "High": 51707.52,
|
|
161377
|
+
// "Low": 51707.52,
|
|
161378
|
+
// "Close": 51707.52,
|
|
161379
|
+
// "Volume": "0"
|
|
161380
|
+
// }
|
|
161381
|
+
// ]
|
|
161382
|
+
//
|
|
161383
|
+
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
161384
|
+
}
|
|
161245
161385
|
parseOrderStatus(status) {
|
|
161246
161386
|
const statuses = {
|
|
161247
161387
|
'open': 'open',
|
|
@@ -161333,6 +161473,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161333
161473
|
* @method
|
|
161334
161474
|
* @name indodax#fetchOrder
|
|
161335
161475
|
* @description fetches information on an order made by the user
|
|
161476
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#get-order-endpoints
|
|
161336
161477
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
161337
161478
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161338
161479
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -161357,6 +161498,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161357
161498
|
* @method
|
|
161358
161499
|
* @name indodax#fetchOpenOrders
|
|
161359
161500
|
* @description fetch all unfilled currently open orders
|
|
161501
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#open-orders-endpoints
|
|
161360
161502
|
* @param {string} symbol unified market symbol
|
|
161361
161503
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
161362
161504
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -161397,6 +161539,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161397
161539
|
* @method
|
|
161398
161540
|
* @name indodax#fetchClosedOrders
|
|
161399
161541
|
* @description fetches information on multiple closed orders made by the user
|
|
161542
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#order-history
|
|
161400
161543
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
161401
161544
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
161402
161545
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -161421,6 +161564,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161421
161564
|
* @method
|
|
161422
161565
|
* @name indodax#createOrder
|
|
161423
161566
|
* @description create a trade order
|
|
161567
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#trade-endpoints
|
|
161424
161568
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
161425
161569
|
* @param {string} type 'market' or 'limit'
|
|
161426
161570
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -161460,6 +161604,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161460
161604
|
* @method
|
|
161461
161605
|
* @name indodax#cancelOrder
|
|
161462
161606
|
* @description cancels an open order
|
|
161607
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#cancel-order-endpoints
|
|
161463
161608
|
* @param {string} id order id
|
|
161464
161609
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
161465
161610
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -161486,6 +161631,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161486
161631
|
* @method
|
|
161487
161632
|
* @name indodax#fetchTransactionFee
|
|
161488
161633
|
* @description fetch the fee for a transaction
|
|
161634
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-fee-endpoints
|
|
161489
161635
|
* @param {string} code unified currency code
|
|
161490
161636
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161491
161637
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -161519,6 +161665,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161519
161665
|
* @method
|
|
161520
161666
|
* @name indodax#fetchDepositsWithdrawals
|
|
161521
161667
|
* @description fetch history of deposits and withdrawals
|
|
161668
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#transaction-history-endpoints
|
|
161522
161669
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
161523
161670
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
161524
161671
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -161620,6 +161767,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161620
161767
|
* @method
|
|
161621
161768
|
* @name indodax#withdraw
|
|
161622
161769
|
* @description make a withdrawal
|
|
161770
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-coin-endpoints
|
|
161623
161771
|
* @param {string} code unified currency code
|
|
161624
161772
|
* @param {float} amount the amount to withdraw
|
|
161625
161773
|
* @param {string} address the address to withdraw to
|
|
@@ -161753,6 +161901,7 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161753
161901
|
* @method
|
|
161754
161902
|
* @name indodax#fetchDepositAddresses
|
|
161755
161903
|
* @description fetch deposit addresses for multiple currencies and chain types
|
|
161904
|
+
* @see https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#general-information-on-endpoints
|
|
161756
161905
|
* @param {string[]} [codes] list of unified currency codes, default is undefined
|
|
161757
161906
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161758
161907
|
* @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -161835,7 +161984,12 @@ class indodax extends _abstract_indodax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
161835
161984
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
161836
161985
|
let url = this.urls['api'][api];
|
|
161837
161986
|
if (api === 'public') {
|
|
161838
|
-
|
|
161987
|
+
const query = this.omit(params, this.extractParams(path));
|
|
161988
|
+
const requestPath = '/' + this.implodeParams(path, params);
|
|
161989
|
+
url = url + requestPath;
|
|
161990
|
+
if (Object.keys(query).length) {
|
|
161991
|
+
url += '?' + this.urlencodeWithArrayRepeat(query);
|
|
161992
|
+
}
|
|
161839
161993
|
}
|
|
161840
161994
|
else {
|
|
161841
161995
|
this.checkRequiredCredentials();
|
|
@@ -203240,6 +203394,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
203240
203394
|
* @method
|
|
203241
203395
|
* @name okx#fetchPositions
|
|
203242
203396
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
203397
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
203243
203398
|
* @description fetch all open positions
|
|
203244
203399
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
203245
203400
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -203380,13 +203535,38 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
203380
203535
|
// "vegaBS": "",
|
|
203381
203536
|
// "vegaPA": ""
|
|
203382
203537
|
// }
|
|
203538
|
+
// history
|
|
203539
|
+
// {
|
|
203540
|
+
// "cTime":"1708351230102",
|
|
203541
|
+
// "ccy":"USDT",
|
|
203542
|
+
// "closeAvgPx":"1.2567",
|
|
203543
|
+
// "closeTotalPos":"40",
|
|
203544
|
+
// "direction":"short",
|
|
203545
|
+
// "fee":"-0.0351036",
|
|
203546
|
+
// "fundingFee":"0",
|
|
203547
|
+
// "instId":"SUSHI-USDT-SWAP",
|
|
203548
|
+
// "instType":"SWAP",
|
|
203549
|
+
// "lever":"10.0",
|
|
203550
|
+
// "liqPenalty":"0",
|
|
203551
|
+
// "mgnMode":"isolated",
|
|
203552
|
+
// "openAvgPx":"1.2462",
|
|
203553
|
+
// "openMaxPos":"40",
|
|
203554
|
+
// "pnl":"-0.42",
|
|
203555
|
+
// "pnlRatio":"-0.0912982667308618",
|
|
203556
|
+
// "posId":"666159086676836352",
|
|
203557
|
+
// "realizedPnl":"-0.4551036",
|
|
203558
|
+
// "triggerPx":"",
|
|
203559
|
+
// "type":"2",
|
|
203560
|
+
// "uTime":"1708354805699",
|
|
203561
|
+
// "uly":"SUSHI-USDT"
|
|
203562
|
+
// }
|
|
203383
203563
|
//
|
|
203384
203564
|
const marketId = this.safeString(position, 'instId');
|
|
203385
203565
|
market = this.safeMarket(marketId, market);
|
|
203386
203566
|
const symbol = market['symbol'];
|
|
203387
203567
|
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
|
|
203388
203568
|
const contractsAbs = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(pos);
|
|
203389
|
-
let side = this.
|
|
203569
|
+
let side = this.safeString2(position, 'posSide', 'direction');
|
|
203390
203570
|
const hedged = side !== 'net';
|
|
203391
203571
|
const contracts = this.parseNumber(contractsAbs);
|
|
203392
203572
|
if (market['margin']) {
|
|
@@ -203427,7 +203607,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
203427
203607
|
const notional = this.parseNumber(notionalString);
|
|
203428
203608
|
const marginMode = this.safeString(position, 'mgnMode');
|
|
203429
203609
|
let initialMarginString = undefined;
|
|
203430
|
-
const entryPriceString = this.
|
|
203610
|
+
const entryPriceString = this.safeString2(position, 'avgPx', 'openAvgPx');
|
|
203431
203611
|
const unrealizedPnlString = this.safeString(position, 'upl');
|
|
203432
203612
|
const leverageString = this.safeString(position, 'lever');
|
|
203433
203613
|
let initialMarginPercentage = undefined;
|
|
@@ -203458,23 +203638,24 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
203458
203638
|
const marginRatio = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(maintenanceMarginString, collateralString, 4));
|
|
203459
203639
|
return this.safePosition({
|
|
203460
203640
|
'info': position,
|
|
203461
|
-
'id':
|
|
203641
|
+
'id': this.safeString(position, 'posId'),
|
|
203462
203642
|
'symbol': symbol,
|
|
203463
203643
|
'notional': notional,
|
|
203464
203644
|
'marginMode': marginMode,
|
|
203465
203645
|
'liquidationPrice': liquidationPrice,
|
|
203466
203646
|
'entryPrice': this.parseNumber(entryPriceString),
|
|
203467
203647
|
'unrealizedPnl': this.parseNumber(unrealizedPnlString),
|
|
203648
|
+
'realizedPnl': this.safeNumber(position, 'realizedPnl'),
|
|
203468
203649
|
'percentage': percentage,
|
|
203469
203650
|
'contracts': contracts,
|
|
203470
203651
|
'contractSize': contractSize,
|
|
203471
203652
|
'markPrice': this.parseNumber(markPriceString),
|
|
203472
|
-
'lastPrice':
|
|
203653
|
+
'lastPrice': this.safeNumber(position, 'closeAvgPx'),
|
|
203473
203654
|
'side': side,
|
|
203474
203655
|
'hedged': hedged,
|
|
203475
203656
|
'timestamp': timestamp,
|
|
203476
203657
|
'datetime': this.iso8601(timestamp),
|
|
203477
|
-
'lastUpdateTimestamp':
|
|
203658
|
+
'lastUpdateTimestamp': this.safeInteger(position, 'uTime'),
|
|
203478
203659
|
'maintenanceMargin': maintenanceMargin,
|
|
203479
203660
|
'maintenanceMarginPercentage': maintenanceMarginPercentage,
|
|
203480
203661
|
'collateral': this.parseNumber(collateralString),
|
|
@@ -246774,7 +246955,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
246774
246955
|
'symbols': [market['id']],
|
|
246775
246956
|
},
|
|
246776
246957
|
};
|
|
246777
|
-
const orderbook = await this.subscribePublic(name,
|
|
246958
|
+
const orderbook = await this.subscribePublic(name, 'orderbooks', [symbol], this.deepExtend(request, params));
|
|
246778
246959
|
return orderbook.limit();
|
|
246779
246960
|
}
|
|
246780
246961
|
handleOrderBook(client, message) {
|
|
@@ -246803,13 +246984,12 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
246803
246984
|
//
|
|
246804
246985
|
const data = this.safeValue2(message, 'snapshot', 'update', {});
|
|
246805
246986
|
const marketIds = Object.keys(data);
|
|
246806
|
-
const channel = this.safeString(message, 'ch');
|
|
246807
246987
|
for (let i = 0; i < marketIds.length; i++) {
|
|
246808
246988
|
const marketId = marketIds[i];
|
|
246809
246989
|
const market = this.safeMarket(marketId);
|
|
246810
246990
|
const symbol = market['symbol'];
|
|
246811
246991
|
const item = data[marketId];
|
|
246812
|
-
const messageHash =
|
|
246992
|
+
const messageHash = 'orderbooks::' + symbol;
|
|
246813
246993
|
if (!(symbol in this.orderbooks)) {
|
|
246814
246994
|
const subscription = this.safeValue(client.subscriptions, messageHash, {});
|
|
246815
246995
|
const limit = this.safeInteger(subscription, 'limit');
|
|
@@ -246867,7 +247047,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
246867
247047
|
'symbols': [market['id']],
|
|
246868
247048
|
},
|
|
246869
247049
|
};
|
|
246870
|
-
const result = await this.subscribePublic(name, '
|
|
247050
|
+
const result = await this.subscribePublic(name, 'tickers', [symbol], this.deepExtend(request, params));
|
|
246871
247051
|
return this.safeValue(result, symbol);
|
|
246872
247052
|
}
|
|
246873
247053
|
async watchTickers(symbols = undefined, params = {}) {
|
|
@@ -246950,7 +247130,6 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
246950
247130
|
//
|
|
246951
247131
|
const data = this.safeValue(message, 'data', {});
|
|
246952
247132
|
const marketIds = Object.keys(data);
|
|
246953
|
-
const channel = this.safeString(message, 'ch');
|
|
246954
247133
|
const newTickers = {};
|
|
246955
247134
|
for (let i = 0; i < marketIds.length; i++) {
|
|
246956
247135
|
const marketId = marketIds[i];
|
|
@@ -246959,8 +247138,6 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
246959
247138
|
const ticker = this.parseWsTicker(data[marketId], market);
|
|
246960
247139
|
this.tickers[symbol] = ticker;
|
|
246961
247140
|
newTickers[symbol] = ticker;
|
|
246962
|
-
const messageHash = channel + '::' + symbol;
|
|
246963
|
-
client.resolve(newTickers, messageHash);
|
|
246964
247141
|
}
|
|
246965
247142
|
client.resolve(newTickers, 'tickers');
|
|
246966
247143
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
@@ -246976,7 +247153,6 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
246976
247153
|
client.resolve(tickers, messageHash);
|
|
246977
247154
|
}
|
|
246978
247155
|
}
|
|
246979
|
-
client.resolve(this.tickers, channel);
|
|
246980
247156
|
return message;
|
|
246981
247157
|
}
|
|
246982
247158
|
parseWsTicker(ticker, market = undefined) {
|
|
@@ -247057,7 +247233,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
247057
247233
|
request['limit'] = limit;
|
|
247058
247234
|
}
|
|
247059
247235
|
const name = 'trades';
|
|
247060
|
-
const trades = await this.subscribePublic(name,
|
|
247236
|
+
const trades = await this.subscribePublic(name, 'trades', [symbol], this.deepExtend(request, params));
|
|
247061
247237
|
if (this.newUpdates) {
|
|
247062
247238
|
limit = trades.getLimit(symbol, limit);
|
|
247063
247239
|
}
|
|
@@ -247186,7 +247362,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
247186
247362
|
if (limit !== undefined) {
|
|
247187
247363
|
request['params']['limit'] = limit;
|
|
247188
247364
|
}
|
|
247189
|
-
const ohlcv = await this.subscribePublic(name,
|
|
247365
|
+
const ohlcv = await this.subscribePublic(name, 'candles', [symbol], this.deepExtend(request, params));
|
|
247190
247366
|
if (this.newUpdates) {
|
|
247191
247367
|
limit = ohlcv.getLimit(symbol, limit);
|
|
247192
247368
|
}
|
|
@@ -247247,7 +247423,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
247247
247423
|
for (let j = 0; j < ohlcvs.length; j++) {
|
|
247248
247424
|
stored.append(ohlcvs[j]);
|
|
247249
247425
|
}
|
|
247250
|
-
const messageHash =
|
|
247426
|
+
const messageHash = 'candles::' + symbol;
|
|
247251
247427
|
client.resolve(stored, messageHash);
|
|
247252
247428
|
}
|
|
247253
247429
|
return message;
|
|
@@ -286982,6 +287158,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
286982
287158
|
'fetchClosedOrders': true,
|
|
286983
287159
|
'fetchDepositAddress': true,
|
|
286984
287160
|
'fetchDepositAddresses': true,
|
|
287161
|
+
'fetchDeposit': true,
|
|
286985
287162
|
'fetchDeposits': true,
|
|
286986
287163
|
'fetchFundingHistory': false,
|
|
286987
287164
|
'fetchFundingRate': false,
|
|
@@ -287007,6 +287184,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
287007
287184
|
'fetchTradingFee': true,
|
|
287008
287185
|
'fetchTradingFees': false,
|
|
287009
287186
|
'fetchTransactions': false,
|
|
287187
|
+
'fetchWithdrawal': true,
|
|
287010
287188
|
'fetchWithdrawals': true,
|
|
287011
287189
|
'transfer': false,
|
|
287012
287190
|
'withdraw': true,
|
|
@@ -288132,6 +288310,45 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
288132
288310
|
//
|
|
288133
288311
|
return this.parseTransactions(response, currency, since, limit);
|
|
288134
288312
|
}
|
|
288313
|
+
async fetchDeposit(id, code = undefined, params = {}) {
|
|
288314
|
+
/**
|
|
288315
|
+
* @method
|
|
288316
|
+
* @name upbit#fetchDeposit
|
|
288317
|
+
* @description fetch information on a deposit
|
|
288318
|
+
* @see https://global-docs.upbit.com/reference/individual-deposit-inquiry
|
|
288319
|
+
* @param {string} id the unique id for the deposit
|
|
288320
|
+
* @param {string} [code] unified currency code of the currency deposited
|
|
288321
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
288322
|
+
* @param {string} [params.txid] withdrawal transaction id, the id argument is reserved for uuid
|
|
288323
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
288324
|
+
*/
|
|
288325
|
+
await this.loadMarkets();
|
|
288326
|
+
const request = {
|
|
288327
|
+
'uuid': id,
|
|
288328
|
+
};
|
|
288329
|
+
let currency = undefined;
|
|
288330
|
+
if (code !== undefined) {
|
|
288331
|
+
currency = this.currency(code);
|
|
288332
|
+
request['currency'] = currency['id'];
|
|
288333
|
+
}
|
|
288334
|
+
const response = await this.privateGetDeposit(this.extend(request, params));
|
|
288335
|
+
//
|
|
288336
|
+
// {
|
|
288337
|
+
// "type": "deposit",
|
|
288338
|
+
// "uuid": "7f54527e-2eee-4268-860e-fd8b9d7fe3c7",
|
|
288339
|
+
// "currency": "ADA",
|
|
288340
|
+
// "net_type": "ADA",
|
|
288341
|
+
// "txid": "99795bbfeca91eaa071068bb659b33eeb65d8aaff2551fdf7c78f345d188952b",
|
|
288342
|
+
// "state": "ACCEPTED",
|
|
288343
|
+
// "created_at": "2023-12-12T04:58:41Z",
|
|
288344
|
+
// "done_at": "2023-12-12T05:31:50Z",
|
|
288345
|
+
// "amount": "35.72344",
|
|
288346
|
+
// "fee": "0.0",
|
|
288347
|
+
// "transaction_type": "default"
|
|
288348
|
+
// }
|
|
288349
|
+
//
|
|
288350
|
+
return this.parseTransaction(response, currency);
|
|
288351
|
+
}
|
|
288135
288352
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
288136
288353
|
/**
|
|
288137
288354
|
* @method
|
|
@@ -288176,13 +288393,52 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
288176
288393
|
//
|
|
288177
288394
|
return this.parseTransactions(response, currency, since, limit);
|
|
288178
288395
|
}
|
|
288396
|
+
async fetchWithdrawal(id, code = undefined, params = {}) {
|
|
288397
|
+
/**
|
|
288398
|
+
* @method
|
|
288399
|
+
* @name upbit#fetchWithdrawal
|
|
288400
|
+
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
288401
|
+
* @see https://global-docs.upbit.com/reference/individual-withdrawal-inquiry
|
|
288402
|
+
* @param {string} id the unique id for the withdrawal
|
|
288403
|
+
* @param {string} [code] unified currency code of the currency withdrawn
|
|
288404
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
288405
|
+
* @param {string} [params.txid] withdrawal transaction id, the id argument is reserved for uuid
|
|
288406
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
288407
|
+
*/
|
|
288408
|
+
await this.loadMarkets();
|
|
288409
|
+
const request = {
|
|
288410
|
+
'uuid': id,
|
|
288411
|
+
};
|
|
288412
|
+
let currency = undefined;
|
|
288413
|
+
if (code !== undefined) {
|
|
288414
|
+
currency = this.currency(code);
|
|
288415
|
+
request['currency'] = currency['id'];
|
|
288416
|
+
}
|
|
288417
|
+
const response = await this.privateGetWithdraw(this.extend(request, params));
|
|
288418
|
+
//
|
|
288419
|
+
// {
|
|
288420
|
+
// "type": "withdraw",
|
|
288421
|
+
// "uuid": "95ef274b-23a6-4de4-95b0-5cbef4ca658f",
|
|
288422
|
+
// "currency": "ADA",
|
|
288423
|
+
// "net_type": "ADA",
|
|
288424
|
+
// "txid": "b1528f149297a71671b86636f731f8fdb0ff53da0f1d8c19093d59df96f34583",
|
|
288425
|
+
// "state": "DONE",
|
|
288426
|
+
// "created_at": "2023-12-14T02:46:52Z",
|
|
288427
|
+
// "done_at": "2023-12-14T03:10:11Z",
|
|
288428
|
+
// "amount": "35.22344",
|
|
288429
|
+
// "fee": "0.5",
|
|
288430
|
+
// "transaction_type": "default"
|
|
288431
|
+
// }
|
|
288432
|
+
//
|
|
288433
|
+
return this.parseTransaction(response, currency);
|
|
288434
|
+
}
|
|
288179
288435
|
parseTransactionStatus(status) {
|
|
288180
288436
|
const statuses = {
|
|
288181
288437
|
'submitting': 'pending',
|
|
288182
288438
|
'submitted': 'pending',
|
|
288183
288439
|
'almost_accepted': 'pending',
|
|
288184
288440
|
'rejected': 'failed',
|
|
288185
|
-
'accepted': '
|
|
288441
|
+
'accepted': 'ok',
|
|
288186
288442
|
'processing': 'pending',
|
|
288187
288443
|
'done': 'ok',
|
|
288188
288444
|
'canceled': 'canceled', // 취소됨
|
|
@@ -288191,7 +288447,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
288191
288447
|
}
|
|
288192
288448
|
parseTransaction(transaction, currency = undefined) {
|
|
288193
288449
|
//
|
|
288194
|
-
// fetchDeposits
|
|
288450
|
+
// fetchDeposits, fetchDeposit
|
|
288195
288451
|
//
|
|
288196
288452
|
// {
|
|
288197
288453
|
// "type": "deposit",
|
|
@@ -288205,7 +288461,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
288205
288461
|
// "fee": "0.0"
|
|
288206
288462
|
// }
|
|
288207
288463
|
//
|
|
288208
|
-
// fetchWithdrawals
|
|
288464
|
+
// fetchWithdrawals, fetchWithdrawal
|
|
288209
288465
|
//
|
|
288210
288466
|
// {
|
|
288211
288467
|
// "type": "withdraw",
|
|
@@ -288220,27 +288476,21 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
288220
288476
|
// "krw_amount": "80420.0"
|
|
288221
288477
|
// }
|
|
288222
288478
|
//
|
|
288223
|
-
const id = this.safeString(transaction, 'uuid');
|
|
288224
|
-
const amount = this.safeNumber(transaction, 'amount');
|
|
288225
288479
|
const address = undefined; // not present in the data structure received from the exchange
|
|
288226
288480
|
const tag = undefined; // not present in the data structure received from the exchange
|
|
288227
|
-
const txid = this.safeString(transaction, 'txid');
|
|
288228
288481
|
const updatedRaw = this.safeString(transaction, 'done_at');
|
|
288229
|
-
const updated = this.parse8601(updatedRaw);
|
|
288230
288482
|
const timestamp = this.parse8601(this.safeString(transaction, 'created_at', updatedRaw));
|
|
288231
288483
|
let type = this.safeString(transaction, 'type');
|
|
288232
288484
|
if (type === 'withdraw') {
|
|
288233
288485
|
type = 'withdrawal';
|
|
288234
288486
|
}
|
|
288235
288487
|
const currencyId = this.safeString(transaction, 'currency');
|
|
288236
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
288237
|
-
const status = this.parseTransactionStatus(this.safeStringLower(transaction, 'state'));
|
|
288238
|
-
const feeCost = this.safeNumber(transaction, 'fee');
|
|
288488
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
288239
288489
|
return {
|
|
288240
288490
|
'info': transaction,
|
|
288241
|
-
'id':
|
|
288491
|
+
'id': this.safeString(transaction, 'uuid'),
|
|
288242
288492
|
'currency': code,
|
|
288243
|
-
'amount': amount,
|
|
288493
|
+
'amount': this.safeNumber(transaction, 'amount'),
|
|
288244
288494
|
'network': undefined,
|
|
288245
288495
|
'address': address,
|
|
288246
288496
|
'addressTo': undefined,
|
|
@@ -288248,17 +288498,17 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
288248
288498
|
'tag': tag,
|
|
288249
288499
|
'tagTo': undefined,
|
|
288250
288500
|
'tagFrom': undefined,
|
|
288251
|
-
'status':
|
|
288501
|
+
'status': this.parseTransactionStatus(this.safeStringLower(transaction, 'state')),
|
|
288252
288502
|
'type': type,
|
|
288253
|
-
'updated':
|
|
288254
|
-
'txid': txid,
|
|
288503
|
+
'updated': this.parse8601(updatedRaw),
|
|
288504
|
+
'txid': this.safeString(transaction, 'txid'),
|
|
288255
288505
|
'timestamp': timestamp,
|
|
288256
288506
|
'datetime': this.iso8601(timestamp),
|
|
288257
288507
|
'internal': undefined,
|
|
288258
288508
|
'comment': undefined,
|
|
288259
288509
|
'fee': {
|
|
288260
288510
|
'currency': code,
|
|
288261
|
-
'cost':
|
|
288511
|
+
'cost': this.safeNumber(transaction, 'fee'),
|
|
288262
288512
|
},
|
|
288263
288513
|
};
|
|
288264
288514
|
}
|
|
@@ -307068,7 +307318,7 @@ SOFTWARE.
|
|
|
307068
307318
|
|
|
307069
307319
|
//-----------------------------------------------------------------------------
|
|
307070
307320
|
// this is updated by vss.js when building
|
|
307071
|
-
const version = '4.2.
|
|
307321
|
+
const version = '4.2.48';
|
|
307072
307322
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
307073
307323
|
//-----------------------------------------------------------------------------
|
|
307074
307324
|
|