ccxt 4.1.1 → 4.1.3
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 +545 -159
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/binance.js +84 -0
- package/dist/cjs/src/bingx.js +140 -124
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bitmart.js +176 -0
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bybit.js +27 -8
- package/dist/cjs/src/coinbasepro.js +1 -0
- package/dist/cjs/src/deribit.js +1 -1
- package/dist/cjs/src/okx.js +27 -11
- package/dist/cjs/src/pro/binance.js +11 -5
- package/dist/cjs/src/pro/coinbasepro.js +70 -8
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinbaseprime.d.ts +1 -0
- package/js/src/abstract/coinbasepro.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +6 -0
- package/js/src/binance.js +84 -0
- package/js/src/bingx.js +140 -124
- package/js/src/bitget.js +1 -1
- package/js/src/bitmart.d.ts +3 -0
- package/js/src/bitmart.js +176 -0
- package/js/src/bitrue.js +1 -1
- package/js/src/bybit.js +27 -8
- package/js/src/coinbasepro.js +1 -0
- package/js/src/deribit.js +1 -1
- package/js/src/okx.js +27 -11
- package/js/src/pro/binance.js +11 -5
- package/js/src/pro/coinbasepro.d.ts +3 -24
- package/js/src/pro/coinbasepro.js +70 -8
- package/package.json +1 -1
- package/skip-tests.json +6 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -7836,6 +7836,12 @@ class Exchange {
|
|
|
7836
7836
|
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
7837
7837
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTradesForSymbols() is not supported yet');
|
|
7838
7838
|
}
|
|
7839
|
+
async watchMyTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
7840
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchMyTradesForSymbols() is not supported yet');
|
|
7841
|
+
}
|
|
7842
|
+
async watchOrdersForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
7843
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOrdersForSymbols() is not supported yet');
|
|
7844
|
+
}
|
|
7839
7845
|
async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
|
|
7840
7846
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOHLCVForSymbols() is not supported yet');
|
|
7841
7847
|
}
|
|
@@ -18979,6 +18985,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18979
18985
|
* @method
|
|
18980
18986
|
* @name binance#fetchOHLCV
|
|
18981
18987
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
18988
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
|
|
18989
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#kline-candlestick-data
|
|
18990
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#index-price-kline-candlestick-data
|
|
18991
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#mark-price-kline-candlestick-data
|
|
18992
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data
|
|
18993
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-kline-candlestick-data
|
|
18994
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#mark-price-kline-candlestick-data
|
|
18995
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#kline-candlestick-data
|
|
18982
18996
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
18983
18997
|
* @param {string} timeframe the length of time each candle represents
|
|
18984
18998
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -20294,6 +20308,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20294
20308
|
* @method
|
|
20295
20309
|
* @name binance#fetchOrder
|
|
20296
20310
|
* @description fetches information on an order made by the user
|
|
20311
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data
|
|
20312
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#query-order-user_data
|
|
20313
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#query-order-user_data
|
|
20314
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-single-order-trade
|
|
20315
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data
|
|
20297
20316
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
20298
20317
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
20299
20318
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
@@ -20345,6 +20364,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20345
20364
|
* @method
|
|
20346
20365
|
* @name binance#fetchOrders
|
|
20347
20366
|
* @description fetches information on multiple orders made by the user
|
|
20367
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
|
20368
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#all-orders-user_data
|
|
20369
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
|
|
20370
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
20371
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
20348
20372
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
20349
20373
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
20350
20374
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -20465,6 +20489,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20465
20489
|
* @method
|
|
20466
20490
|
* @name binance#fetchOpenOrders
|
|
20467
20491
|
* @description fetch all unfilled currently open orders
|
|
20492
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
|
20493
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
20494
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
20495
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
20496
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data
|
|
20468
20497
|
* @param {string} symbol unified market symbol
|
|
20469
20498
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
20470
20499
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -20532,6 +20561,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20532
20561
|
* @method
|
|
20533
20562
|
* @name binance#fetchClosedOrders
|
|
20534
20563
|
* @description fetches information on multiple closed orders made by the user
|
|
20564
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
|
20565
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#all-orders-user_data
|
|
20566
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
|
|
20567
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
20568
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
20535
20569
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
20536
20570
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
20537
20571
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -20571,6 +20605,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20571
20605
|
* @method
|
|
20572
20606
|
* @name binance#cancelOrder
|
|
20573
20607
|
* @description cancels an open order
|
|
20608
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
|
|
20609
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#cancel-order-trade
|
|
20610
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-order-trade
|
|
20611
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#cancel-option-order-trade
|
|
20612
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
|
|
20574
20613
|
* @param {string} id order id
|
|
20575
20614
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
20576
20615
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
@@ -20673,6 +20712,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20673
20712
|
* @name binance#cancelOrders
|
|
20674
20713
|
* @description cancel multiple orders
|
|
20675
20714
|
* @see https://binance-docs.github.io/apidocs/futures/en/#cancel-multiple-orders-trade
|
|
20715
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-multiple-orders-trade
|
|
20676
20716
|
* @param {[string]} ids order ids
|
|
20677
20717
|
* @param {string} [symbol] unified market symbol
|
|
20678
20718
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
@@ -20741,6 +20781,10 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20741
20781
|
* @method
|
|
20742
20782
|
* @name binance#fetchOrderTrades
|
|
20743
20783
|
* @description fetch all the trades made from a single order
|
|
20784
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
|
|
20785
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-trade-list-user_data
|
|
20786
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-trade-list-user_data
|
|
20787
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data
|
|
20744
20788
|
* @param {string} id order id
|
|
20745
20789
|
* @param {string} symbol unified market symbol
|
|
20746
20790
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -20768,6 +20812,10 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20768
20812
|
* @method
|
|
20769
20813
|
* @name binance#fetchMyTrades
|
|
20770
20814
|
* @description fetch all trades made by the user
|
|
20815
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
|
|
20816
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-trade-list-user_data
|
|
20817
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-trade-list-user_data
|
|
20818
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data
|
|
20771
20819
|
* @param {string} symbol unified market symbol
|
|
20772
20820
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
20773
20821
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -20907,6 +20955,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20907
20955
|
* @method
|
|
20908
20956
|
* @name binance#fetchMyDustTrades
|
|
20909
20957
|
* @description fetch all dust trades made by the user
|
|
20958
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data
|
|
20910
20959
|
* @param {string} symbol not used by binance fetchMyDustTrades ()
|
|
20911
20960
|
* @param {int} [since] the earliest time in ms to fetch my dust trades for
|
|
20912
20961
|
* @param {int} [limit] the maximum number of dust trades to retrieve
|
|
@@ -21045,6 +21094,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21045
21094
|
* @method
|
|
21046
21095
|
* @name binance#fetchDeposits
|
|
21047
21096
|
* @description fetch all deposits made to an account
|
|
21097
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
21098
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
|
|
21048
21099
|
* @param {string} code unified currency code
|
|
21049
21100
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
21050
21101
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -21149,6 +21200,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21149
21200
|
* @method
|
|
21150
21201
|
* @name binance#fetchWithdrawals
|
|
21151
21202
|
* @description fetch all withdrawals made from an account
|
|
21203
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
21204
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
|
21152
21205
|
* @param {string} code unified currency code
|
|
21153
21206
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
21154
21207
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -21613,6 +21666,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21613
21666
|
* @method
|
|
21614
21667
|
* @name binance#fetchTransfers
|
|
21615
21668
|
* @description fetch a history of internal transfers made on an account
|
|
21669
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
|
|
21616
21670
|
* @param {string} code unified currency code of the currency transferred
|
|
21617
21671
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
21618
21672
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
@@ -21676,6 +21730,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21676
21730
|
* @method
|
|
21677
21731
|
* @name binance#fetchDepositAddress
|
|
21678
21732
|
* @description fetch the deposit address for a currency associated with this account
|
|
21733
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
|
|
21679
21734
|
* @param {string} code unified currency code
|
|
21680
21735
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21681
21736
|
* @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
|
|
@@ -21751,6 +21806,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21751
21806
|
* @name binance#fetchTransactionFees
|
|
21752
21807
|
* @deprecated
|
|
21753
21808
|
* @description please use fetchDepositWithdrawFees instead
|
|
21809
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
|
|
21754
21810
|
* @param {string[]|undefined} codes not used by binance fetchTransactionFees ()
|
|
21755
21811
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21756
21812
|
* @returns {object[]} a list of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
|
|
@@ -21864,6 +21920,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21864
21920
|
* @method
|
|
21865
21921
|
* @name binance#fetchDepositWithdrawFees
|
|
21866
21922
|
* @description fetch deposit and withdraw fees
|
|
21923
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
|
|
21867
21924
|
* @param {string[]|undefined} codes not used by binance fetchDepositWithdrawFees ()
|
|
21868
21925
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21869
21926
|
* @returns {object[]} a list of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
|
|
@@ -21987,6 +22044,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21987
22044
|
* @method
|
|
21988
22045
|
* @name binance#withdraw
|
|
21989
22046
|
* @description make a withdrawal
|
|
22047
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-user_data
|
|
21990
22048
|
* @param {string} code unified currency code
|
|
21991
22049
|
* @param {float} amount the amount to withdraw
|
|
21992
22050
|
* @param {string} address the address to withdraw to
|
|
@@ -22042,6 +22100,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22042
22100
|
* @method
|
|
22043
22101
|
* @name binance#fetchTradingFee
|
|
22044
22102
|
* @description fetch the trading fees for a market
|
|
22103
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
|
22045
22104
|
* @param {string} symbol unified market symbol
|
|
22046
22105
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22047
22106
|
* @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
|
|
@@ -22069,6 +22128,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22069
22128
|
* @method
|
|
22070
22129
|
* @name binance#fetchTradingFees
|
|
22071
22130
|
* @description fetch the trading fees for multiple markets
|
|
22131
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
|
22132
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
22133
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
22072
22134
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22073
22135
|
* @returns {object} a dictionary of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure} indexed by market symbols
|
|
22074
22136
|
*/
|
|
@@ -22246,6 +22308,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22246
22308
|
* @method
|
|
22247
22309
|
* @name binance#futuresTransfer
|
|
22248
22310
|
* @description transfer between futures account
|
|
22311
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data
|
|
22249
22312
|
* @param {string} code unified currency code
|
|
22250
22313
|
* @param {float} amount the amount to transfer
|
|
22251
22314
|
* @param {string} type 1 - transfer from spot account to USDT-Ⓜ futures account, 2 - transfer from USDT-Ⓜ futures account to spot account, 3 - transfer from spot account to COIN-Ⓜ futures account, 4 - transfer from COIN-Ⓜ futures account to spot account
|
|
@@ -22276,6 +22339,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22276
22339
|
* @method
|
|
22277
22340
|
* @name binance#fetchFundingRate
|
|
22278
22341
|
* @description fetch the current funding rate
|
|
22342
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
|
|
22343
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
22279
22344
|
* @param {string} symbol unified market symbol
|
|
22280
22345
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22281
22346
|
* @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
|
|
@@ -22318,6 +22383,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22318
22383
|
* @method
|
|
22319
22384
|
* @name binance#fetchFundingRateHistory
|
|
22320
22385
|
* @description fetches historical funding rate prices
|
|
22386
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#get-funding-rate-history
|
|
22387
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#get-funding-rate-history-of-perpetual-futures
|
|
22321
22388
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
22322
22389
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
22323
22390
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
@@ -22388,6 +22455,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22388
22455
|
* @method
|
|
22389
22456
|
* @name binance#fetchFundingRates
|
|
22390
22457
|
* @description fetch the funding rate for multiple markets
|
|
22458
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
|
|
22459
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
22391
22460
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
22392
22461
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22393
22462
|
* @returns {object} a dictionary of [funding rates structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure}, indexe by market symbols
|
|
@@ -22916,6 +22985,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22916
22985
|
* @method
|
|
22917
22986
|
* @name binance#fetchLeverageTiers
|
|
22918
22987
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
22988
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#notional-and-leverage-brackets-user_data
|
|
22989
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#notional-bracket-for-symbol-user_data
|
|
22919
22990
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
22920
22991
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22921
22992
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
|
|
@@ -23204,6 +23275,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23204
23275
|
* @method
|
|
23205
23276
|
* @name binance#fetchAccountPositions
|
|
23206
23277
|
* @description fetch account positions
|
|
23278
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
23279
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
23207
23280
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
23208
23281
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
23209
23282
|
* @returns {object} data on account positions
|
|
@@ -23241,6 +23314,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23241
23314
|
* @name binance#fetchPositionsRisk
|
|
23242
23315
|
* @description fetch positions risk
|
|
23243
23316
|
* @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
|
|
23317
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
|
|
23244
23318
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
23245
23319
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
23246
23320
|
* @returns {object} data on the positions risk
|
|
@@ -23337,6 +23411,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23337
23411
|
* @method
|
|
23338
23412
|
* @name binance#fetchFundingHistory
|
|
23339
23413
|
* @description fetch the history of funding payments paid and received on this account
|
|
23414
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#get-income-history-user_data
|
|
23415
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#get-income-history-user_data
|
|
23340
23416
|
* @param {string} symbol unified market symbol
|
|
23341
23417
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
23342
23418
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
@@ -23384,6 +23460,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23384
23460
|
* @method
|
|
23385
23461
|
* @name binance#setLeverage
|
|
23386
23462
|
* @description set the level of leverage for a market
|
|
23463
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#change-initial-leverage-trade
|
|
23464
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#change-initial-leverage-trade
|
|
23387
23465
|
* @param {float} leverage the rate of leverage
|
|
23388
23466
|
* @param {string} symbol unified market symbol
|
|
23389
23467
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
@@ -23420,6 +23498,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23420
23498
|
* @method
|
|
23421
23499
|
* @name binance#setMarginMode
|
|
23422
23500
|
* @description set margin mode to 'cross' or 'isolated'
|
|
23501
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#change-margin-type-trade
|
|
23502
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#change-margin-type-trade
|
|
23423
23503
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
23424
23504
|
* @param {string} symbol unified market symbol
|
|
23425
23505
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
@@ -23488,6 +23568,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23488
23568
|
* @method
|
|
23489
23569
|
* @name binance#setPositionMode
|
|
23490
23570
|
* @description set hedged to true or false for a market
|
|
23571
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#change-position-mode-trade
|
|
23572
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#change-position-mode-trade
|
|
23491
23573
|
* @param {bool} hedged set to true to use dualSidePosition
|
|
23492
23574
|
* @param {string} symbol not used by binance setPositionMode ()
|
|
23493
23575
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
@@ -24176,6 +24258,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24176
24258
|
* @method
|
|
24177
24259
|
* @name binance#fetchBorrowRate
|
|
24178
24260
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
24261
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
|
|
24179
24262
|
* @param {string} code unified currency code
|
|
24180
24263
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
24181
24264
|
* @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
|
|
@@ -24205,6 +24288,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24205
24288
|
* @method
|
|
24206
24289
|
* @name binance#fetchBorrowRateHistory
|
|
24207
24290
|
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
24291
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
|
|
24208
24292
|
* @param {string} code unified currency code
|
|
24209
24293
|
* @param {int} [since] timestamp for the earliest borrow rate
|
|
24210
24294
|
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} to retrieve
|
|
@@ -24278,6 +24362,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24278
24362
|
* @method
|
|
24279
24363
|
* @name binance#createGiftCode
|
|
24280
24364
|
* @description create gift code
|
|
24365
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#create-a-single-token-gift-card-user_data
|
|
24281
24366
|
* @param {string} code gift code
|
|
24282
24367
|
* @param {float} amount amount of currency for the gift
|
|
24283
24368
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
@@ -24315,6 +24400,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24315
24400
|
* @method
|
|
24316
24401
|
* @name binance#redeemGiftCode
|
|
24317
24402
|
* @description redeem gift code
|
|
24403
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#redeem-a-binance-gift-card-user_data
|
|
24318
24404
|
* @param {string} giftcardCode
|
|
24319
24405
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
24320
24406
|
* @returns {object} response from the exchange
|
|
@@ -24341,6 +24427,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24341
24427
|
* @method
|
|
24342
24428
|
* @name binance#verifyGiftCode
|
|
24343
24429
|
* @description verify gift code
|
|
24430
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#verify-binance-gift-card-by-gift-card-number-user_data
|
|
24344
24431
|
* @param {string} id reference number id
|
|
24345
24432
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
24346
24433
|
* @returns {object} response from the exchange
|
|
@@ -24364,6 +24451,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24364
24451
|
* @method
|
|
24365
24452
|
* @name binance#fetchBorrowInterest
|
|
24366
24453
|
* @description fetch the interest owed by the user for borrowing currency for margin trading
|
|
24454
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data
|
|
24367
24455
|
* @param {string} code unified currency code
|
|
24368
24456
|
* @param {string} symbol unified market symbol when fetch interest in isolated markets
|
|
24369
24457
|
* @param {int} [since] the earliest time in ms to fetch borrrow interest for
|
|
@@ -24516,6 +24604,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24516
24604
|
* @method
|
|
24517
24605
|
* @name binance#fetchOpenInterestHistory
|
|
24518
24606
|
* @description Retrieves the open interest history of a currency
|
|
24607
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#open-interest-statistics
|
|
24608
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#open-interest-statistics
|
|
24519
24609
|
* @param {string} symbol Unified CCXT market symbol
|
|
24520
24610
|
* @param {string} timeframe "5m","15m","30m","1h","2h","4h","6h","12h", or "1d"
|
|
24521
24611
|
* @param {int} [since] the time(ms) of the earliest record to retrieve as a unix timestamp
|
|
@@ -26375,6 +26465,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26375
26465
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
26376
26466
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
26377
26467
|
* @param {bool} [params.postOnly] true to place a post only order
|
|
26468
|
+
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
26469
|
+
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
26378
26470
|
* @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
|
|
26379
26471
|
* @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
|
|
26380
26472
|
* @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
|
|
@@ -26382,8 +26474,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26382
26474
|
*/
|
|
26383
26475
|
await this.loadMarkets();
|
|
26384
26476
|
const market = this.market(symbol);
|
|
26477
|
+
let postOnly = undefined;
|
|
26385
26478
|
let response = undefined;
|
|
26386
|
-
|
|
26479
|
+
let marketType = undefined;
|
|
26480
|
+
[marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
|
|
26387
26481
|
type = type.toUpperCase();
|
|
26388
26482
|
const request = {
|
|
26389
26483
|
'symbol': market['id'],
|
|
@@ -26391,51 +26485,16 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26391
26485
|
'side': side.toUpperCase(),
|
|
26392
26486
|
};
|
|
26393
26487
|
const isMarketOrder = type === 'MARKET';
|
|
26394
|
-
const
|
|
26395
|
-
|
|
26396
|
-
|
|
26397
|
-
|
|
26398
|
-
let takeProfitPrice = undefined;
|
|
26399
|
-
if (!isSpotMarket) {
|
|
26400
|
-
stopPriceRaw = this.safeValue2(params, 'stopPrice', 'triggerPrice');
|
|
26401
|
-
if (stopPriceRaw !== undefined) {
|
|
26402
|
-
stopPrice = this.priceToPrecision(symbol, stopPriceRaw);
|
|
26403
|
-
}
|
|
26404
|
-
stopLossPrice = this.safeValue(params, 'stopLossPrice');
|
|
26405
|
-
takeProfitPrice = this.safeValue(params, 'takeProfitPrice');
|
|
26406
|
-
}
|
|
26407
|
-
if ((stopLossPrice !== undefined) && (takeProfitPrice !== undefined)) {
|
|
26408
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder('Order is either a takeProfit order or a stopLoss order');
|
|
26409
|
-
}
|
|
26410
|
-
if ((type === 'LIMIT') || (type === 'TRIGGER_LIMIT')) {
|
|
26411
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
26412
|
-
if ((stopPrice !== undefined)) {
|
|
26413
|
-
request['type'] = 'TRIGGER_LIMIT';
|
|
26414
|
-
request['stopPrice'] = stopPrice;
|
|
26415
|
-
}
|
|
26416
|
-
if (type === 'TRIGGER_LIMIT') {
|
|
26417
|
-
if (stopPrice === undefined) {
|
|
26418
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder('TRIGGER_LIMIT requires a triggerPrice / stopPrice');
|
|
26419
|
-
}
|
|
26420
|
-
request['stopPrice'] = stopPrice;
|
|
26421
|
-
}
|
|
26488
|
+
const isSpot = marketType === 'spot';
|
|
26489
|
+
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
26490
|
+
if (timeInForce === 'IOC') {
|
|
26491
|
+
request['timeInForce'] = 'IOC';
|
|
26422
26492
|
}
|
|
26423
|
-
if (
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
request['
|
|
26427
|
-
}
|
|
26428
|
-
if (type === 'TRIGGER_MARKET') {
|
|
26429
|
-
if (stopPrice === undefined) {
|
|
26430
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder('TRIGGER_MARKET requires a triggerPrice / stopPrice');
|
|
26431
|
-
}
|
|
26432
|
-
request['stopPrice'] = stopPrice;
|
|
26493
|
+
if (isSpot) {
|
|
26494
|
+
[postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'POC', params);
|
|
26495
|
+
if (postOnly || (timeInForce === 'POC')) {
|
|
26496
|
+
request['timeInForce'] = 'POC';
|
|
26433
26497
|
}
|
|
26434
|
-
}
|
|
26435
|
-
const exchangeSpecificTifParam = this.safeStringUpperN(params, ['force', 'timeInForce']);
|
|
26436
|
-
let postOnly = undefined;
|
|
26437
|
-
[postOnly, params] = this.handlePostOnly(isMarketOrder, exchangeSpecificTifParam === 'POC', params);
|
|
26438
|
-
if (isSpotMarket) {
|
|
26439
26498
|
const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
26440
26499
|
if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
|
|
26441
26500
|
if (price === undefined) {
|
|
@@ -26451,35 +26510,77 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26451
26510
|
else {
|
|
26452
26511
|
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
26453
26512
|
}
|
|
26513
|
+
if (!isMarketOrder) {
|
|
26514
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
26515
|
+
}
|
|
26516
|
+
response = await this.spotV1PrivatePostTradeOrder(this.extend(request, params));
|
|
26454
26517
|
}
|
|
26455
26518
|
else {
|
|
26519
|
+
[postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
|
|
26520
|
+
if (postOnly || (timeInForce === 'PostOnly')) {
|
|
26521
|
+
request['timeInForce'] = 'PostOnly';
|
|
26522
|
+
}
|
|
26523
|
+
else if (timeInForce === 'GTC') {
|
|
26524
|
+
request['timeInForce'] = 'GTC';
|
|
26525
|
+
}
|
|
26526
|
+
else if (timeInForce === 'FOK') {
|
|
26527
|
+
request['timeInForce'] = 'FOK';
|
|
26528
|
+
}
|
|
26529
|
+
if ((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) {
|
|
26530
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
26531
|
+
}
|
|
26532
|
+
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
|
|
26533
|
+
const stopLossPrice = this.safeNumber(params, 'stopLossPrice');
|
|
26534
|
+
const takeProfitPrice = this.safeNumber(params, 'takeProfitPrice');
|
|
26535
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
26536
|
+
const isStopLossPriceOrder = stopLossPrice !== undefined;
|
|
26537
|
+
const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
|
|
26538
|
+
if (isTriggerOrder) {
|
|
26539
|
+
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
26540
|
+
if (isMarketOrder || (type === 'TRIGGER_MARKET')) {
|
|
26541
|
+
request['type'] = 'TRIGGER_MARKET';
|
|
26542
|
+
}
|
|
26543
|
+
else if ((type === 'LIMIT') || (type === 'TRIGGER_LIMIT')) {
|
|
26544
|
+
request['type'] = 'TRIGGER_LIMIT';
|
|
26545
|
+
}
|
|
26546
|
+
}
|
|
26547
|
+
else if (isStopLossPriceOrder || isTakeProfitPriceOrder) {
|
|
26548
|
+
// This can be used to set the stop loss and take profit, but the position needs to be opened first
|
|
26549
|
+
if (isStopLossPriceOrder) {
|
|
26550
|
+
request['stopPrice'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
26551
|
+
if (isMarketOrder || (type === 'STOP_MARKET')) {
|
|
26552
|
+
request['type'] = 'STOP_MARKET';
|
|
26553
|
+
}
|
|
26554
|
+
else if ((type === 'LIMIT') || (type === 'STOP')) {
|
|
26555
|
+
request['type'] = 'STOP';
|
|
26556
|
+
}
|
|
26557
|
+
}
|
|
26558
|
+
else if (isTakeProfitPriceOrder) {
|
|
26559
|
+
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
26560
|
+
if (isMarketOrder || (type === 'TAKE_PROFIT_MARKET')) {
|
|
26561
|
+
request['type'] = 'TAKE_PROFIT_MARKET';
|
|
26562
|
+
}
|
|
26563
|
+
else if ((type === 'LIMIT') || (type === 'TAKE_PROFIT')) {
|
|
26564
|
+
request['type'] = 'TAKE_PROFIT';
|
|
26565
|
+
}
|
|
26566
|
+
}
|
|
26567
|
+
}
|
|
26568
|
+
const reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
26569
|
+
let positionSide = undefined;
|
|
26570
|
+
if (reduceOnly) {
|
|
26571
|
+
positionSide = (side === 'buy') ? 'SHORT' : 'LONG';
|
|
26572
|
+
}
|
|
26573
|
+
else {
|
|
26574
|
+
positionSide = (side === 'buy') ? 'LONG' : 'SHORT';
|
|
26575
|
+
}
|
|
26576
|
+
request['positionSide'] = positionSide;
|
|
26456
26577
|
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
26457
|
-
|
|
26458
|
-
|
|
26459
|
-
request['type'] = 'STOP_MARKET';
|
|
26460
|
-
request['stopPrice'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
26461
|
-
}
|
|
26462
|
-
if ((takeProfitPrice !== undefined)) {
|
|
26463
|
-
request['type'] = 'TAKE_PROFIT_MARKET';
|
|
26464
|
-
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
26465
|
-
}
|
|
26466
|
-
if (postOnly) {
|
|
26467
|
-
request['timeInForce'] = 'POC';
|
|
26468
|
-
}
|
|
26469
|
-
else if (exchangeSpecificTifParam === 'POC') {
|
|
26470
|
-
request['timeInForce'] = 'POC';
|
|
26471
|
-
}
|
|
26472
|
-
else if (!isSpotMarket) {
|
|
26473
|
-
request['timeInForce'] = 'GTC';
|
|
26474
|
-
}
|
|
26475
|
-
if (isSpotMarket) {
|
|
26476
|
-
response = await this.spotV1PrivatePostTradeOrder(this.extend(request, query));
|
|
26477
|
-
}
|
|
26478
|
-
else {
|
|
26479
|
-
response = await this.swapV2PrivatePostTradeOrder(this.extend(request, query));
|
|
26578
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
26579
|
+
response = await this.swapV2PrivatePostTradeOrder(this.extend(request, params));
|
|
26480
26580
|
}
|
|
26481
26581
|
//
|
|
26482
26582
|
// spot
|
|
26583
|
+
//
|
|
26483
26584
|
// {
|
|
26484
26585
|
// "code": 0,
|
|
26485
26586
|
// "msg": "",
|
|
@@ -26499,23 +26600,25 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26499
26600
|
//
|
|
26500
26601
|
// swap
|
|
26501
26602
|
//
|
|
26502
|
-
//
|
|
26503
|
-
//
|
|
26504
|
-
//
|
|
26505
|
-
//
|
|
26506
|
-
//
|
|
26507
|
-
//
|
|
26508
|
-
//
|
|
26509
|
-
//
|
|
26510
|
-
//
|
|
26511
|
-
//
|
|
26512
|
-
//
|
|
26513
|
-
//
|
|
26514
|
-
//
|
|
26603
|
+
// {
|
|
26604
|
+
// "code": 0,
|
|
26605
|
+
// "msg": "",
|
|
26606
|
+
// "data": {
|
|
26607
|
+
// "order": {
|
|
26608
|
+
// "symbol": "BTC-USDT",
|
|
26609
|
+
// "orderId": 1709036527545438208,
|
|
26610
|
+
// "side": "BUY",
|
|
26611
|
+
// "positionSide": "LONG",
|
|
26612
|
+
// "type": "TRIGGER_LIMIT",
|
|
26613
|
+
// "clientOrderID": "",
|
|
26614
|
+
// "workingType": ""
|
|
26615
|
+
// }
|
|
26616
|
+
// }
|
|
26617
|
+
// }
|
|
26515
26618
|
//
|
|
26516
|
-
const data = this.safeValue(response, 'data');
|
|
26517
|
-
const
|
|
26518
|
-
return this.parseOrder(
|
|
26619
|
+
const data = this.safeValue(response, 'data', {});
|
|
26620
|
+
const order = this.safeValue(data, 'order', data);
|
|
26621
|
+
return this.parseOrder(order, market);
|
|
26519
26622
|
}
|
|
26520
26623
|
parseOrder(order, market = undefined) {
|
|
26521
26624
|
//
|
|
@@ -26585,65 +26688,68 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26585
26688
|
//
|
|
26586
26689
|
// fetchOrder, fetchOpenOrders, fetchClosedOrders
|
|
26587
26690
|
//
|
|
26588
|
-
//
|
|
26589
|
-
//
|
|
26590
|
-
//
|
|
26591
|
-
//
|
|
26592
|
-
//
|
|
26593
|
-
//
|
|
26594
|
-
//
|
|
26595
|
-
//
|
|
26596
|
-
//
|
|
26597
|
-
//
|
|
26598
|
-
//
|
|
26599
|
-
//
|
|
26600
|
-
//
|
|
26601
|
-
//
|
|
26602
|
-
//
|
|
26603
|
-
//
|
|
26604
|
-
//
|
|
26605
|
-
//
|
|
26691
|
+
// {
|
|
26692
|
+
// "symbol": "BTC-USDT",
|
|
26693
|
+
// "orderId": 1709036527545438208,
|
|
26694
|
+
// "side": "BUY",
|
|
26695
|
+
// "positionSide": "LONG",
|
|
26696
|
+
// "type": "TRIGGER_LIMIT",
|
|
26697
|
+
// "origQty": "0.0010",
|
|
26698
|
+
// "price": "22000.0",
|
|
26699
|
+
// "executedQty": "0.0000",
|
|
26700
|
+
// "avgPrice": "0.0",
|
|
26701
|
+
// "cumQuote": "",
|
|
26702
|
+
// "stopPrice": "23000.0",
|
|
26703
|
+
// "profit": "",
|
|
26704
|
+
// "commission": "",
|
|
26705
|
+
// "status": "NEW",
|
|
26706
|
+
// "time": 1696301035187,
|
|
26707
|
+
// "updateTime": 1696301035187,
|
|
26708
|
+
// "clientOrderId": "",
|
|
26709
|
+
// "leverage": "",
|
|
26710
|
+
// "takeProfit": "",
|
|
26711
|
+
// "stopLoss": "",
|
|
26712
|
+
// "advanceAttr": 0,
|
|
26713
|
+
// "positionID": 0,
|
|
26714
|
+
// "takeProfitEntrustPrice": 0,
|
|
26715
|
+
// "stopLossEntrustPrice": 0,
|
|
26716
|
+
// "orderType": "",
|
|
26717
|
+
// "workingType": "MARK_PRICE"
|
|
26718
|
+
// }
|
|
26606
26719
|
//
|
|
26607
26720
|
const positionSide = this.safeString(order, 'positionSide');
|
|
26608
26721
|
const marketType = (positionSide === undefined) ? 'spot' : 'swap';
|
|
26609
26722
|
const marketId = this.safeString(order, 'symbol');
|
|
26610
26723
|
const symbol = this.safeSymbol(marketId, market, '-', marketType);
|
|
26611
|
-
const orderId = this.safeString(order, 'orderId');
|
|
26612
|
-
const side = this.safeStringLower(order, 'side');
|
|
26613
|
-
const type = this.safeStringLower(order, 'type');
|
|
26614
26724
|
const timestamp = this.safeInteger2(order, 'time', 'transactTime');
|
|
26615
|
-
const lastTradeTimestamp = this.safeInteger(order, 'updateTime');
|
|
26616
|
-
const price = this.safeString(order, 'price');
|
|
26617
|
-
const average = this.safeString(order, 'avgPrice');
|
|
26618
|
-
const amount = this.safeString(order, 'origQty');
|
|
26619
|
-
const filled = this.safeString(order, 'executedQty');
|
|
26620
|
-
const statusId = this.safeString(order, 'status');
|
|
26621
26725
|
const fee = {
|
|
26622
26726
|
'currency': this.safeString(order, 'feeAsset'),
|
|
26623
26727
|
'rate': this.safeString2(order, 'fee', 'commission'),
|
|
26624
26728
|
};
|
|
26625
|
-
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
26626
26729
|
return this.safeOrder({
|
|
26627
26730
|
'info': order,
|
|
26628
|
-
'id': orderId,
|
|
26629
|
-
'clientOrderId': clientOrderId,
|
|
26731
|
+
'id': this.safeString(order, 'orderId'),
|
|
26732
|
+
'clientOrderId': this.safeString(order, 'clientOrderId'),
|
|
26630
26733
|
'timestamp': timestamp,
|
|
26631
26734
|
'datetime': this.iso8601(timestamp),
|
|
26632
|
-
'lastTradeTimestamp':
|
|
26735
|
+
'lastTradeTimestamp': this.safeInteger(order, 'updateTime'),
|
|
26736
|
+
'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
|
|
26633
26737
|
'symbol': symbol,
|
|
26634
|
-
'type': type,
|
|
26738
|
+
'type': this.safeStringLower(order, 'type'),
|
|
26635
26739
|
'timeInForce': undefined,
|
|
26636
26740
|
'postOnly': undefined,
|
|
26637
|
-
'side': side,
|
|
26638
|
-
'price': price,
|
|
26639
|
-
'stopPrice': this.safeNumber(order, '
|
|
26640
|
-
'triggerPrice': this.safeNumber(order, '
|
|
26641
|
-
'
|
|
26741
|
+
'side': this.safeStringLower(order, 'side'),
|
|
26742
|
+
'price': this.safeString(order, 'price'),
|
|
26743
|
+
'stopPrice': this.safeNumber(order, 'stopPrice'),
|
|
26744
|
+
'triggerPrice': this.safeNumber(order, 'stopPrice'),
|
|
26745
|
+
'stopLossPrice': this.safeNumber(order, 'stopLoss'),
|
|
26746
|
+
'takeProfitPrice': this.safeNumber(order, 'takeProfit'),
|
|
26747
|
+
'average': this.safeString(order, 'avgPrice'),
|
|
26642
26748
|
'cost': undefined,
|
|
26643
|
-
'amount':
|
|
26644
|
-
'filled':
|
|
26749
|
+
'amount': this.safeString(order, 'origQty'),
|
|
26750
|
+
'filled': this.safeString(order, 'executedQty'),
|
|
26645
26751
|
'remaining': undefined,
|
|
26646
|
-
'status': this.parseOrderStatus(
|
|
26752
|
+
'status': this.parseOrderStatus(this.safeString(order, 'status')),
|
|
26647
26753
|
'fee': fee,
|
|
26648
26754
|
'trades': undefined,
|
|
26649
26755
|
}, market);
|
|
@@ -41386,7 +41492,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41386
41492
|
//
|
|
41387
41493
|
const data = this.safeValue(response, 'data');
|
|
41388
41494
|
if (data !== undefined) {
|
|
41389
|
-
return this.
|
|
41495
|
+
return this.safeValue(data, 'orderList', data);
|
|
41390
41496
|
}
|
|
41391
41497
|
const parsedData = JSON.parse(response);
|
|
41392
41498
|
return this.safeValue(parsedData, 'data', []);
|
|
@@ -43917,7 +44023,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
43917
44023
|
'fetchOrderBook': true,
|
|
43918
44024
|
'fetchOrders': false,
|
|
43919
44025
|
'fetchOrderTrades': true,
|
|
44026
|
+
'fetchPosition': true,
|
|
43920
44027
|
'fetchPositionMode': false,
|
|
44028
|
+
'fetchPositions': true,
|
|
43921
44029
|
'fetchStatus': true,
|
|
43922
44030
|
'fetchTicker': true,
|
|
43923
44031
|
'fetchTickers': true,
|
|
@@ -47602,6 +47710,180 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
47602
47710
|
'previousFundingDatetime': undefined,
|
|
47603
47711
|
};
|
|
47604
47712
|
}
|
|
47713
|
+
async fetchPosition(symbol, params = {}) {
|
|
47714
|
+
/**
|
|
47715
|
+
* @method
|
|
47716
|
+
* @name bitmart#fetchPosition
|
|
47717
|
+
* @description fetch data on a single open contract trade position
|
|
47718
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
|
47719
|
+
* @param {string} symbol unified market symbol of the market the position is held in
|
|
47720
|
+
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
47721
|
+
* @returns {object} a [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
|
|
47722
|
+
*/
|
|
47723
|
+
await this.loadMarkets();
|
|
47724
|
+
const market = this.market(symbol);
|
|
47725
|
+
const request = {
|
|
47726
|
+
'symbol': market['id'],
|
|
47727
|
+
};
|
|
47728
|
+
const response = await this.privateGetContractPrivatePosition(this.extend(request, params));
|
|
47729
|
+
//
|
|
47730
|
+
// {
|
|
47731
|
+
// "code": 1000,
|
|
47732
|
+
// "message": "Ok",
|
|
47733
|
+
// "data": [
|
|
47734
|
+
// {
|
|
47735
|
+
// "symbol": "BTCUSDT",
|
|
47736
|
+
// "leverage": "10",
|
|
47737
|
+
// "timestamp": 1696392515269,
|
|
47738
|
+
// "current_fee": "0.0014250028",
|
|
47739
|
+
// "open_timestamp": 1696392256998,
|
|
47740
|
+
// "current_value": "27.4039",
|
|
47741
|
+
// "mark_price": "27.4039",
|
|
47742
|
+
// "position_value": "27.4079",
|
|
47743
|
+
// "position_cross": "3.75723474",
|
|
47744
|
+
// "maintenance_margin": "0.1370395",
|
|
47745
|
+
// "close_vol": "0",
|
|
47746
|
+
// "close_avg_price": "0",
|
|
47747
|
+
// "open_avg_price": "27407.9",
|
|
47748
|
+
// "entry_price": "27407.9",
|
|
47749
|
+
// "current_amount": "1",
|
|
47750
|
+
// "unrealized_value": "-0.004",
|
|
47751
|
+
// "realized_value": "-0.01644474",
|
|
47752
|
+
// "position_type": 1
|
|
47753
|
+
// }
|
|
47754
|
+
// ],
|
|
47755
|
+
// "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
|
|
47756
|
+
// }
|
|
47757
|
+
//
|
|
47758
|
+
const data = this.safeValue(response, 'data', []);
|
|
47759
|
+
const first = this.safeValue(data, 0, {});
|
|
47760
|
+
return this.parsePosition(first, market);
|
|
47761
|
+
}
|
|
47762
|
+
async fetchPositions(symbols = undefined, params = {}) {
|
|
47763
|
+
/**
|
|
47764
|
+
* @method
|
|
47765
|
+
* @name bitmart#fetchPositions
|
|
47766
|
+
* @description fetch all open contract positions
|
|
47767
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
|
47768
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
47769
|
+
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
47770
|
+
* @returns {object[]} a list of [position structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
|
|
47771
|
+
*/
|
|
47772
|
+
await this.loadMarkets();
|
|
47773
|
+
let market = undefined;
|
|
47774
|
+
let symbolsLength = undefined;
|
|
47775
|
+
if (symbols !== undefined) {
|
|
47776
|
+
symbolsLength = symbols.length;
|
|
47777
|
+
const first = this.safeString(symbols, 0);
|
|
47778
|
+
market = this.market(first);
|
|
47779
|
+
}
|
|
47780
|
+
const request = {};
|
|
47781
|
+
if (symbolsLength === 1) {
|
|
47782
|
+
// only supports symbols as undefined or sending one symbol
|
|
47783
|
+
request['symbol'] = market['id'];
|
|
47784
|
+
}
|
|
47785
|
+
const response = await this.privateGetContractPrivatePosition(this.extend(request, params));
|
|
47786
|
+
//
|
|
47787
|
+
// {
|
|
47788
|
+
// "code": 1000,
|
|
47789
|
+
// "message": "Ok",
|
|
47790
|
+
// "data": [
|
|
47791
|
+
// {
|
|
47792
|
+
// "symbol": "BTCUSDT",
|
|
47793
|
+
// "leverage": "10",
|
|
47794
|
+
// "timestamp": 1696392515269,
|
|
47795
|
+
// "current_fee": "0.0014250028",
|
|
47796
|
+
// "open_timestamp": 1696392256998,
|
|
47797
|
+
// "current_value": "27.4039",
|
|
47798
|
+
// "mark_price": "27.4039",
|
|
47799
|
+
// "position_value": "27.4079",
|
|
47800
|
+
// "position_cross": "3.75723474",
|
|
47801
|
+
// "maintenance_margin": "0.1370395",
|
|
47802
|
+
// "close_vol": "0",
|
|
47803
|
+
// "close_avg_price": "0",
|
|
47804
|
+
// "open_avg_price": "27407.9",
|
|
47805
|
+
// "entry_price": "27407.9",
|
|
47806
|
+
// "current_amount": "1",
|
|
47807
|
+
// "unrealized_value": "-0.004",
|
|
47808
|
+
// "realized_value": "-0.01644474",
|
|
47809
|
+
// "position_type": 1
|
|
47810
|
+
// },
|
|
47811
|
+
// ],
|
|
47812
|
+
// "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
|
|
47813
|
+
// }
|
|
47814
|
+
//
|
|
47815
|
+
const positions = this.safeValue(response, 'data', []);
|
|
47816
|
+
const result = [];
|
|
47817
|
+
for (let i = 0; i < positions.length; i++) {
|
|
47818
|
+
result.push(this.parsePosition(positions[i]));
|
|
47819
|
+
}
|
|
47820
|
+
symbols = this.marketSymbols(symbols);
|
|
47821
|
+
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
|
47822
|
+
}
|
|
47823
|
+
parsePosition(position, market = undefined) {
|
|
47824
|
+
//
|
|
47825
|
+
// {
|
|
47826
|
+
// "symbol": "BTCUSDT",
|
|
47827
|
+
// "leverage": "10",
|
|
47828
|
+
// "timestamp": 1696392515269,
|
|
47829
|
+
// "current_fee": "0.0014250028",
|
|
47830
|
+
// "open_timestamp": 1696392256998,
|
|
47831
|
+
// "current_value": "27.4039",
|
|
47832
|
+
// "mark_price": "27.4039",
|
|
47833
|
+
// "position_value": "27.4079",
|
|
47834
|
+
// "position_cross": "3.75723474",
|
|
47835
|
+
// "maintenance_margin": "0.1370395",
|
|
47836
|
+
// "close_vol": "0",
|
|
47837
|
+
// "close_avg_price": "0",
|
|
47838
|
+
// "open_avg_price": "27407.9",
|
|
47839
|
+
// "entry_price": "27407.9",
|
|
47840
|
+
// "current_amount": "1",
|
|
47841
|
+
// "unrealized_value": "-0.004",
|
|
47842
|
+
// "realized_value": "-0.01644474",
|
|
47843
|
+
// "position_type": 1
|
|
47844
|
+
// }
|
|
47845
|
+
//
|
|
47846
|
+
const marketId = this.safeString(position, 'symbol');
|
|
47847
|
+
market = this.safeMarket(marketId, market);
|
|
47848
|
+
const symbol = market['symbol'];
|
|
47849
|
+
const timestamp = this.safeInteger(position, 'timestamp');
|
|
47850
|
+
const side = this.safeInteger(position, 'position_type');
|
|
47851
|
+
const maintenanceMargin = this.safeString(position, 'maintenance_margin');
|
|
47852
|
+
const notional = this.safeString(position, 'current_value');
|
|
47853
|
+
const collateral = this.safeString(position, 'position_cross');
|
|
47854
|
+
const maintenanceMarginPercentage = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(maintenanceMargin, notional);
|
|
47855
|
+
const marginRatio = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(maintenanceMargin, collateral);
|
|
47856
|
+
return this.safePosition({
|
|
47857
|
+
'info': position,
|
|
47858
|
+
'id': undefined,
|
|
47859
|
+
'symbol': symbol,
|
|
47860
|
+
'timestamp': timestamp,
|
|
47861
|
+
'datetime': this.iso8601(timestamp),
|
|
47862
|
+
'lastUpdateTimestamp': undefined,
|
|
47863
|
+
'hedged': undefined,
|
|
47864
|
+
'side': (side === 1) ? 'long' : 'short',
|
|
47865
|
+
'contracts': this.safeNumber(position, 'current_amount'),
|
|
47866
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
47867
|
+
'entryPrice': this.safeNumber(position, 'entry_price'),
|
|
47868
|
+
'markPrice': this.safeNumber(position, 'mark_price'),
|
|
47869
|
+
'lastPrice': undefined,
|
|
47870
|
+
'notional': this.parseNumber(notional),
|
|
47871
|
+
'leverage': this.safeNumber(position, 'leverage'),
|
|
47872
|
+
'collateral': this.parseNumber(collateral),
|
|
47873
|
+
'initialMargin': undefined,
|
|
47874
|
+
'initialMarginPercentage': undefined,
|
|
47875
|
+
'maintenanceMargin': this.parseNumber(maintenanceMargin),
|
|
47876
|
+
'maintenanceMarginPercentage': this.parseNumber(maintenanceMarginPercentage),
|
|
47877
|
+
'unrealizedPnl': this.safeNumber(position, 'unrealized_value'),
|
|
47878
|
+
'realizedPnl': this.safeNumber(position, 'realized_value'),
|
|
47879
|
+
'liquidationPrice': undefined,
|
|
47880
|
+
'marginMode': undefined,
|
|
47881
|
+
'percentage': undefined,
|
|
47882
|
+
'marginRatio': this.parseNumber(marginRatio),
|
|
47883
|
+
'stopLossPrice': undefined,
|
|
47884
|
+
'takeProfitPrice': undefined,
|
|
47885
|
+
});
|
|
47886
|
+
}
|
|
47605
47887
|
nonce() {
|
|
47606
47888
|
return this.milliseconds();
|
|
47607
47889
|
}
|
|
@@ -54899,7 +55181,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
54899
55181
|
'last': last,
|
|
54900
55182
|
'previousClose': undefined,
|
|
54901
55183
|
'change': undefined,
|
|
54902
|
-
'percentage': this.safeString(ticker, 'percentChange'),
|
|
55184
|
+
'percentage': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(this.safeString(ticker, 'percentChange'), '10000'),
|
|
54903
55185
|
'average': undefined,
|
|
54904
55186
|
'baseVolume': this.safeString(ticker, 'baseVolume'),
|
|
54905
55187
|
'quoteVolume': this.safeString(ticker, 'quoteVolume'),
|
|
@@ -74626,6 +74908,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74626
74908
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
74627
74909
|
* @param {float} price the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
74628
74910
|
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
74911
|
+
* @param {float} [params.triggerPrice] The price that a trigger order is triggered at
|
|
74912
|
+
* @param {float} [params.stopLossPrice] The price that a stop loss order is triggered at
|
|
74913
|
+
* @param {float} [params.takeProfitPrice] The price that a take profit order is triggered at
|
|
74914
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
|
|
74915
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
74916
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
|
|
74917
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
74918
|
+
* @param {string} [params.triggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
|
|
74919
|
+
* @param {string} [params.slTriggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
|
|
74920
|
+
* @param {string} [params.tpTriggerby] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
|
|
74629
74921
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
74630
74922
|
*/
|
|
74631
74923
|
this.checkRequiredSymbol('editOrder', symbol);
|
|
@@ -74668,9 +74960,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74668
74960
|
if (amount !== undefined) {
|
|
74669
74961
|
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
74670
74962
|
}
|
|
74671
|
-
let triggerPrice = this.
|
|
74672
|
-
const stopLossTriggerPrice = this.
|
|
74673
|
-
const takeProfitTriggerPrice = this.
|
|
74963
|
+
let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
74964
|
+
const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
|
|
74965
|
+
const takeProfitTriggerPrice = this.safeString(params, 'takeProfitPrice');
|
|
74674
74966
|
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
74675
74967
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
74676
74968
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
@@ -74681,16 +74973,25 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74681
74973
|
triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
|
|
74682
74974
|
}
|
|
74683
74975
|
if (triggerPrice !== undefined) {
|
|
74684
|
-
|
|
74976
|
+
const triggerPriceRequest = (triggerPrice === '0') ? triggerPrice : this.priceToPrecision(symbol, triggerPrice);
|
|
74977
|
+
request['triggerPrice'] = triggerPriceRequest;
|
|
74978
|
+
const triggerBy = this.safeString(params, 'triggerBy', 'LastPrice');
|
|
74979
|
+
request['triggerBy'] = triggerBy;
|
|
74685
74980
|
}
|
|
74686
74981
|
if (isStopLoss || isTakeProfit) {
|
|
74687
74982
|
if (isStopLoss) {
|
|
74688
|
-
const slTriggerPrice = this.
|
|
74689
|
-
|
|
74983
|
+
const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
74984
|
+
const stopLossRequest = (slTriggerPrice === '0') ? slTriggerPrice : this.priceToPrecision(symbol, slTriggerPrice);
|
|
74985
|
+
request['stopLoss'] = stopLossRequest;
|
|
74986
|
+
const slTriggerBy = this.safeString(params, 'slTriggerBy', 'LastPrice');
|
|
74987
|
+
request['slTriggerBy'] = slTriggerBy;
|
|
74690
74988
|
}
|
|
74691
74989
|
if (isTakeProfit) {
|
|
74692
|
-
const tpTriggerPrice = this.
|
|
74693
|
-
|
|
74990
|
+
const tpTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
74991
|
+
const takeProfitRequest = (tpTriggerPrice === '0') ? tpTriggerPrice : this.priceToPrecision(symbol, tpTriggerPrice);
|
|
74992
|
+
request['takeProfit'] = takeProfitRequest;
|
|
74993
|
+
const tpTriggerBy = this.safeString(params, 'tpTriggerBy', 'LastPrice');
|
|
74994
|
+
request['tpTriggerBy'] = tpTriggerBy;
|
|
74694
74995
|
}
|
|
74695
74996
|
}
|
|
74696
74997
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -82802,6 +83103,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
82802
83103
|
},
|
|
82803
83104
|
'private': {
|
|
82804
83105
|
'get': [
|
|
83106
|
+
'address-book',
|
|
82805
83107
|
'accounts',
|
|
82806
83108
|
'accounts/{id}',
|
|
82807
83109
|
'accounts/{id}/holds',
|
|
@@ -104257,7 +104559,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
104257
104559
|
const defaultCode = this.safeValue(this.options, 'code', 'BTC');
|
|
104258
104560
|
const options = this.safeValue(this.options, methodName, {});
|
|
104259
104561
|
const code = this.safeValue(options, 'code', defaultCode);
|
|
104260
|
-
return this.
|
|
104562
|
+
return this.safeValue2(params, 'code', code);
|
|
104261
104563
|
}
|
|
104262
104564
|
async fetchStatus(params = {}) {
|
|
104263
104565
|
/**
|
|
@@ -177438,15 +177740,32 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177438
177740
|
defaultType = this.safeString(options, 'type', defaultType); // Candles or HistoryCandles
|
|
177439
177741
|
const type = this.safeString(params, 'type', defaultType);
|
|
177440
177742
|
params = this.omit(params, 'type');
|
|
177441
|
-
let method = 'publicGetMarket' + type;
|
|
177442
177743
|
const isHistoryCandles = (type === 'HistoryCandles');
|
|
177744
|
+
let response = undefined;
|
|
177443
177745
|
if (price === 'mark') {
|
|
177444
|
-
|
|
177746
|
+
if (isHistoryCandles) {
|
|
177747
|
+
response = await this.publicGetMarketHistoryMarkPriceCandles(this.extend(request, params));
|
|
177748
|
+
}
|
|
177749
|
+
else {
|
|
177750
|
+
response = await this.publicGetMarketMarkPriceCandles(this.extend(request, params));
|
|
177751
|
+
}
|
|
177445
177752
|
}
|
|
177446
177753
|
else if (price === 'index') {
|
|
177447
|
-
|
|
177754
|
+
if (isHistoryCandles) {
|
|
177755
|
+
response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));
|
|
177756
|
+
}
|
|
177757
|
+
else {
|
|
177758
|
+
response = await this.publicGetMarketIndexCandles(this.extend(request, params));
|
|
177759
|
+
}
|
|
177760
|
+
}
|
|
177761
|
+
else {
|
|
177762
|
+
if (isHistoryCandles) {
|
|
177763
|
+
response = await this.publicGetMarketHistoryCandles(this.extend(request, params));
|
|
177764
|
+
}
|
|
177765
|
+
else {
|
|
177766
|
+
response = await this.publicGetMarketCandles(this.extend(request, params));
|
|
177767
|
+
}
|
|
177448
177768
|
}
|
|
177449
|
-
const response = await this[method](this.extend(request, params));
|
|
177450
177769
|
//
|
|
177451
177770
|
// {
|
|
177452
177771
|
// "code": "0",
|
|
@@ -177658,17 +177977,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177658
177977
|
*/
|
|
177659
177978
|
await this.loadMarkets();
|
|
177660
177979
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
177661
|
-
|
|
177980
|
+
const request = {
|
|
177981
|
+
// 'ccy': 'BTC,ETH', // comma-separated list of currency ids
|
|
177982
|
+
};
|
|
177983
|
+
let response = undefined;
|
|
177662
177984
|
if (marketType === 'funding') {
|
|
177663
|
-
|
|
177985
|
+
response = await this.privateGetAssetBalances(this.extend(request, query));
|
|
177664
177986
|
}
|
|
177665
177987
|
else {
|
|
177666
|
-
|
|
177988
|
+
response = await this.privateGetAccountBalance(this.extend(request, query));
|
|
177667
177989
|
}
|
|
177668
|
-
const request = {
|
|
177669
|
-
// 'ccy': 'BTC,ETH', // comma-separated list of currency ids
|
|
177670
|
-
};
|
|
177671
|
-
const response = await this[method](this.extend(request, query));
|
|
177672
177990
|
//
|
|
177673
177991
|
// {
|
|
177674
177992
|
// "code": "0",
|
|
@@ -193147,14 +193465,20 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
193147
193465
|
// valid <levels> are 5, 10, or 20
|
|
193148
193466
|
//
|
|
193149
193467
|
// default 100, max 1000, valid limits 5, 10, 20, 50, 100, 500, 1000
|
|
193468
|
+
await this.loadMarkets();
|
|
193469
|
+
const market = this.market(symbol);
|
|
193150
193470
|
if (limit !== undefined) {
|
|
193151
|
-
if (
|
|
193152
|
-
|
|
193471
|
+
if (market['contract']) {
|
|
193472
|
+
if ((limit !== 5) && (limit !== 10) && (limit !== 20) && (limit !== 50) && (limit !== 100) && (limit !== 500) && (limit !== 1000)) {
|
|
193473
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' watchOrderBook limit argument must be undefined, 5, 10, 20, 50, 100, 500 or 1000');
|
|
193474
|
+
}
|
|
193475
|
+
}
|
|
193476
|
+
else {
|
|
193477
|
+
if (limit > 5000) {
|
|
193478
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' watchOrderBook limit argument must be less than or equal to 5000');
|
|
193479
|
+
}
|
|
193153
193480
|
}
|
|
193154
193481
|
}
|
|
193155
|
-
//
|
|
193156
|
-
await this.loadMarkets();
|
|
193157
|
-
const market = this.market(symbol);
|
|
193158
193482
|
let type = market['type'];
|
|
193159
193483
|
if (market['contract']) {
|
|
193160
193484
|
type = market['linear'] ? 'future' : 'delivery';
|
|
@@ -209883,9 +210207,11 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
209883
210207
|
'watchTickers': true,
|
|
209884
210208
|
'watchTrades': true,
|
|
209885
210209
|
'watchTradesForSymbols': true,
|
|
210210
|
+
'watchMyTradesForSymbols': true,
|
|
209886
210211
|
'watchBalance': false,
|
|
209887
210212
|
'watchStatus': false,
|
|
209888
210213
|
'watchOrders': true,
|
|
210214
|
+
'watchOrdersForSymbols': true,
|
|
209889
210215
|
'watchMyTrades': true,
|
|
209890
210216
|
},
|
|
209891
210217
|
'urls': {
|
|
@@ -210073,6 +210399,54 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210073
210399
|
}
|
|
210074
210400
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
210075
210401
|
}
|
|
210402
|
+
async watchMyTradesForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
210403
|
+
/**
|
|
210404
|
+
* @method
|
|
210405
|
+
* @name coinbasepro#watchMyTradesForSymbols
|
|
210406
|
+
* @description watches information on multiple trades made by the user
|
|
210407
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
210408
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
210409
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
210410
|
+
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
210411
|
+
* @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure
|
|
210412
|
+
*/
|
|
210413
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
210414
|
+
await this.loadMarkets();
|
|
210415
|
+
const name = 'user';
|
|
210416
|
+
const messageHash = 'multipleMyTrades::';
|
|
210417
|
+
const authentication = this.authenticate();
|
|
210418
|
+
const trades = await this.subscribeMultiple(name, symbols, messageHash, this.extend(params, authentication));
|
|
210419
|
+
if (this.newUpdates) {
|
|
210420
|
+
const first = this.safeValue(trades, 0);
|
|
210421
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
210422
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
210423
|
+
}
|
|
210424
|
+
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
210425
|
+
}
|
|
210426
|
+
async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
210427
|
+
/**
|
|
210428
|
+
* @method
|
|
210429
|
+
* @name coinbasepro#watchOrdersForSymbols
|
|
210430
|
+
* @description watches information on multiple orders made by the user
|
|
210431
|
+
* @param {string[]} symbols unified symbol of the market to fetch orders for
|
|
210432
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
210433
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
210434
|
+
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
210435
|
+
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
210436
|
+
*/
|
|
210437
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
210438
|
+
await this.loadMarkets();
|
|
210439
|
+
const name = 'user';
|
|
210440
|
+
const messageHash = 'multipleOrders::';
|
|
210441
|
+
const authentication = this.authenticate();
|
|
210442
|
+
const orders = await this.subscribeMultiple(name, symbols, messageHash, this.extend(params, authentication));
|
|
210443
|
+
if (this.newUpdates) {
|
|
210444
|
+
const first = this.safeValue(orders, 0);
|
|
210445
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
210446
|
+
limit = orders.getLimit(tradeSymbol, limit);
|
|
210447
|
+
}
|
|
210448
|
+
return this.filterBySinceLimit(orders, since, limit, 'timestamp', true);
|
|
210449
|
+
}
|
|
210076
210450
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
210077
210451
|
/**
|
|
210078
210452
|
* @method
|
|
@@ -210212,6 +210586,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210212
210586
|
const marketId = this.safeString(message, 'product_id');
|
|
210213
210587
|
if (marketId !== undefined) {
|
|
210214
210588
|
const trade = this.parseWsTrade(message);
|
|
210589
|
+
const symbol = trade['symbol'];
|
|
210215
210590
|
const type = 'myTrades';
|
|
210216
210591
|
const messageHash = type + ':' + marketId;
|
|
210217
210592
|
let tradesArray = this.myTrades;
|
|
@@ -210222,6 +210597,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210222
210597
|
}
|
|
210223
210598
|
tradesArray.append(trade);
|
|
210224
210599
|
client.resolve(tradesArray, messageHash);
|
|
210600
|
+
this.resolvePromiseIfMessagehashMatches(client, 'multipleMyTrades::', symbol, tradesArray);
|
|
210225
210601
|
}
|
|
210226
210602
|
return message;
|
|
210227
210603
|
}
|
|
@@ -210278,14 +210654,25 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210278
210654
|
// }
|
|
210279
210655
|
const parsed = super.parseTrade(trade);
|
|
210280
210656
|
let feeRate = undefined;
|
|
210657
|
+
let isMaker = false;
|
|
210281
210658
|
if ('maker_fee_rate' in trade) {
|
|
210659
|
+
isMaker = true;
|
|
210282
210660
|
parsed['takerOrMaker'] = 'maker';
|
|
210283
210661
|
feeRate = this.safeNumber(trade, 'maker_fee_rate');
|
|
210284
210662
|
}
|
|
210285
210663
|
else {
|
|
210286
210664
|
parsed['takerOrMaker'] = 'taker';
|
|
210287
210665
|
feeRate = this.safeNumber(trade, 'taker_fee_rate');
|
|
210288
|
-
|
|
210666
|
+
// side always represents the maker side of the trade
|
|
210667
|
+
// so if we're taker, we invert it
|
|
210668
|
+
const currentSide = parsed['side'];
|
|
210669
|
+
parsed['side'] = this.safeString({
|
|
210670
|
+
'buy': 'sell',
|
|
210671
|
+
'sell': 'buy',
|
|
210672
|
+
}, currentSide, currentSide);
|
|
210673
|
+
}
|
|
210674
|
+
const idKey = isMaker ? 'maker_order_id' : 'taker_order_id';
|
|
210675
|
+
parsed['order'] = this.safeString(trade, idKey);
|
|
210289
210676
|
market = this.market(parsed['symbol']);
|
|
210290
210677
|
const feeCurrency = market['quote'];
|
|
210291
210678
|
let feeCost = undefined;
|
|
@@ -210411,6 +210798,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210411
210798
|
const parsed = this.parseWsOrder(message);
|
|
210412
210799
|
orders.append(parsed);
|
|
210413
210800
|
client.resolve(orders, messageHash);
|
|
210801
|
+
this.resolvePromiseIfMessagehashMatches(client, 'multipleOrders::', symbol, orders);
|
|
210414
210802
|
}
|
|
210415
210803
|
else {
|
|
210416
210804
|
const sequence = this.safeInteger(message, 'sequence');
|
|
@@ -210454,6 +210842,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210454
210842
|
// update the newUpdates count
|
|
210455
210843
|
orders.append(previousOrder);
|
|
210456
210844
|
client.resolve(orders, messageHash);
|
|
210845
|
+
this.resolvePromiseIfMessagehashMatches(client, 'multipleOrders::', symbol, orders);
|
|
210457
210846
|
}
|
|
210458
210847
|
else if ((type === 'received') || (type === 'done')) {
|
|
210459
210848
|
const info = this.extend(previousOrder['info'], message);
|
|
@@ -210469,6 +210858,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210469
210858
|
// update the newUpdates count
|
|
210470
210859
|
orders.append(previousOrder);
|
|
210471
210860
|
client.resolve(orders, messageHash);
|
|
210861
|
+
this.resolvePromiseIfMessagehashMatches(client, 'multipleOrders::', symbol, orders);
|
|
210472
210862
|
}
|
|
210473
210863
|
}
|
|
210474
210864
|
}
|
|
@@ -210499,11 +210889,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210499
210889
|
remaining = amount - filled;
|
|
210500
210890
|
}
|
|
210501
210891
|
}
|
|
210502
|
-
|
|
210503
|
-
if ((price !== undefined) && (amount !== undefined)) {
|
|
210504
|
-
cost = price * amount;
|
|
210505
|
-
}
|
|
210506
|
-
return {
|
|
210892
|
+
return this.safeOrder({
|
|
210507
210893
|
'info': order,
|
|
210508
210894
|
'symbol': symbol,
|
|
210509
210895
|
'id': id,
|
|
@@ -210519,14 +210905,14 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210519
210905
|
'stopPrice': undefined,
|
|
210520
210906
|
'triggerPrice': undefined,
|
|
210521
210907
|
'amount': amount,
|
|
210522
|
-
'cost':
|
|
210908
|
+
'cost': undefined,
|
|
210523
210909
|
'average': undefined,
|
|
210524
210910
|
'filled': filled,
|
|
210525
210911
|
'remaining': remaining,
|
|
210526
210912
|
'status': status,
|
|
210527
210913
|
'fee': undefined,
|
|
210528
210914
|
'trades': undefined,
|
|
210529
|
-
};
|
|
210915
|
+
});
|
|
210530
210916
|
}
|
|
210531
210917
|
handleTicker(client, message) {
|
|
210532
210918
|
//
|
|
@@ -273607,7 +273993,7 @@ SOFTWARE.
|
|
|
273607
273993
|
|
|
273608
273994
|
//-----------------------------------------------------------------------------
|
|
273609
273995
|
// this is updated by vss.js when building
|
|
273610
|
-
const version = '4.1.
|
|
273996
|
+
const version = '4.1.3';
|
|
273611
273997
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
273612
273998
|
//-----------------------------------------------------------------------------
|
|
273613
273999
|
|