ccxt 4.4.11 → 4.4.13
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 -4
- package/dist/ccxt.browser.min.js +4 -4
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/bigone.js +2 -0
- package/dist/cjs/src/binance.js +61 -3
- package/dist/cjs/src/bingx.js +96 -6
- package/dist/cjs/src/bitget.js +2 -0
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/bybit.js +4 -1
- package/dist/cjs/src/coinbaseinternational.js +2 -0
- package/dist/cjs/src/coinex.js +2 -0
- package/dist/cjs/src/delta.js +2 -0
- package/dist/cjs/src/deribit.js +2 -0
- package/dist/cjs/src/digifinex.js +2 -0
- package/dist/cjs/src/gate.js +2 -0
- package/dist/cjs/src/htx.js +8 -2
- package/dist/cjs/src/kraken.js +4 -4
- package/dist/cjs/src/krakenfutures.js +2 -0
- package/dist/cjs/src/kucoinfutures.js +2 -0
- package/dist/cjs/src/mexc.js +19 -4
- package/dist/cjs/src/okx.js +56 -23
- package/dist/cjs/src/oxfun.js +1 -0
- package/dist/cjs/src/paradex.js +1 -0
- package/dist/cjs/src/phemex.js +13 -4
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/binance.js +80 -5
- package/dist/cjs/src/pro/bitfinex.js +8 -8
- package/dist/cjs/src/pro/krakenfutures.js +2 -0
- package/dist/cjs/src/pro/phemex.js +2 -0
- package/dist/cjs/src/pro/woo.js +73 -0
- package/examples/README.md +4 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +6 -0
- package/js/src/base/types.d.ts +18 -16
- package/js/src/bigone.js +2 -0
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +61 -3
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +96 -6
- package/js/src/bitget.js +2 -0
- package/js/src/bitmex.js +1 -0
- package/js/src/bybit.js +4 -1
- package/js/src/coinbaseinternational.js +2 -0
- package/js/src/coinex.js +2 -0
- package/js/src/delta.js +2 -0
- package/js/src/deribit.js +2 -0
- package/js/src/digifinex.js +2 -0
- package/js/src/gate.js +2 -0
- package/js/src/htx.js +8 -2
- package/js/src/kraken.js +4 -4
- package/js/src/krakenfutures.js +2 -0
- package/js/src/kucoinfutures.js +2 -0
- package/js/src/mexc.js +19 -4
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +56 -23
- package/js/src/oxfun.js +1 -0
- package/js/src/paradex.js +1 -0
- package/js/src/phemex.js +13 -4
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/binance.d.ts +5 -0
- package/js/src/pro/binance.js +80 -5
- package/js/src/pro/bitfinex.js +8 -8
- package/js/src/pro/krakenfutures.js +2 -0
- package/js/src/pro/phemex.js +2 -0
- package/js/src/pro/woo.d.ts +3 -0
- package/js/src/pro/woo.js +73 -0
- package/package.json +2 -2
package/dist/cjs/ccxt.js
CHANGED
|
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
194
|
|
|
195
195
|
//-----------------------------------------------------------------------------
|
|
196
196
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.4.
|
|
197
|
+
const version = '4.4.13';
|
|
198
198
|
Exchange["default"].ccxtVersion = version;
|
|
199
199
|
const exchanges = {
|
|
200
200
|
'ace': ace,
|
|
@@ -1460,6 +1460,7 @@ class Exchange {
|
|
|
1460
1460
|
'fetchTicker': true,
|
|
1461
1461
|
'fetchTickerWs': undefined,
|
|
1462
1462
|
'fetchTickers': undefined,
|
|
1463
|
+
'fetchMarkPrices': undefined,
|
|
1463
1464
|
'fetchTickersWs': undefined,
|
|
1464
1465
|
'fetchTime': undefined,
|
|
1465
1466
|
'fetchTrades': true,
|
|
@@ -3214,6 +3215,8 @@ class Exchange {
|
|
|
3214
3215
|
'baseVolume': this.parseNumber(baseVolume),
|
|
3215
3216
|
'quoteVolume': this.parseNumber(quoteVolume),
|
|
3216
3217
|
'previousClose': this.safeNumber(ticker, 'previousClose'),
|
|
3218
|
+
'indexPrice': this.safeNumber(ticker, 'indexPrice'),
|
|
3219
|
+
'markPrice': this.safeNumber(ticker, 'markPrice'),
|
|
3217
3220
|
});
|
|
3218
3221
|
}
|
|
3219
3222
|
async fetchBorrowRate(code, amount, params = {}) {
|
|
@@ -4438,6 +4441,9 @@ class Exchange {
|
|
|
4438
4441
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
4439
4442
|
throw new errors.NotSupported(this.id + ' fetchTickers() is not supported yet');
|
|
4440
4443
|
}
|
|
4444
|
+
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
4445
|
+
throw new errors.NotSupported(this.id + ' fetchMarkPrices() is not supported yet');
|
|
4446
|
+
}
|
|
4441
4447
|
async fetchTickersWs(symbols = undefined, params = {}) {
|
|
4442
4448
|
throw new errors.NotSupported(this.id + ' fetchTickers() is not supported yet');
|
|
4443
4449
|
}
|
package/dist/cjs/src/bigone.js
CHANGED
|
@@ -722,6 +722,8 @@ class bigone extends bigone$1 {
|
|
|
722
722
|
'average': undefined,
|
|
723
723
|
'baseVolume': this.safeString2(ticker, 'volume', 'volume24h'),
|
|
724
724
|
'quoteVolume': this.safeString(ticker, 'volume24hInUsd'),
|
|
725
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
726
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
725
727
|
'info': ticker,
|
|
726
728
|
}, market);
|
|
727
729
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -109,6 +109,7 @@ class binance extends binance$1 {
|
|
|
109
109
|
'fetchMarketLeverageTiers': 'emulated',
|
|
110
110
|
'fetchMarkets': true,
|
|
111
111
|
'fetchMarkOHLCV': true,
|
|
112
|
+
'fetchMarkPrices': true,
|
|
112
113
|
'fetchMyLiquidations': true,
|
|
113
114
|
'fetchMySettlementHistory': true,
|
|
114
115
|
'fetchMyTrades': true,
|
|
@@ -1193,6 +1194,9 @@ class binance extends binance$1 {
|
|
|
1193
1194
|
},
|
|
1194
1195
|
'option': {},
|
|
1195
1196
|
},
|
|
1197
|
+
'currencies': {
|
|
1198
|
+
'BNFCR': this.safeCurrencyStructure({ 'id': 'BNFCR', 'code': 'BNFCR', 'precision': this.parseNumber('0.001') }),
|
|
1199
|
+
},
|
|
1196
1200
|
'commonCurrencies': {
|
|
1197
1201
|
'BCC': 'BCC',
|
|
1198
1202
|
'YOYO': 'YOYOW',
|
|
@@ -3811,6 +3815,18 @@ class binance extends binance$1 {
|
|
|
3811
3815
|
return orderbook;
|
|
3812
3816
|
}
|
|
3813
3817
|
parseTicker(ticker, market = undefined) {
|
|
3818
|
+
// markPrices
|
|
3819
|
+
//
|
|
3820
|
+
// {
|
|
3821
|
+
// "symbol": "BTCUSDT",
|
|
3822
|
+
// "markPrice": "11793.63104562", // mark price
|
|
3823
|
+
// "indexPrice": "11781.80495970", // index price
|
|
3824
|
+
// "estimatedSettlePrice": "11781.16138815", // Estimated Settle Price, only useful in the last hour before the settlement starts.
|
|
3825
|
+
// "lastFundingRate": "0.00038246", // This is the lastest estimated funding rate
|
|
3826
|
+
// "nextFundingTime": 1597392000000,
|
|
3827
|
+
// "interestRate": "0.00010000",
|
|
3828
|
+
// "time": 1597370495002
|
|
3829
|
+
// }
|
|
3814
3830
|
//
|
|
3815
3831
|
// {
|
|
3816
3832
|
// "symbol": "ETHBTC",
|
|
@@ -3914,7 +3930,7 @@ class binance extends binance$1 {
|
|
|
3914
3930
|
// "time":"1673899278514"
|
|
3915
3931
|
// }
|
|
3916
3932
|
//
|
|
3917
|
-
const timestamp = this.
|
|
3933
|
+
const timestamp = this.safeInteger2(ticker, 'closeTime', 'time');
|
|
3918
3934
|
let marketType = undefined;
|
|
3919
3935
|
if (('time' in ticker)) {
|
|
3920
3936
|
marketType = 'contract';
|
|
@@ -3958,6 +3974,8 @@ class binance extends binance$1 {
|
|
|
3958
3974
|
'average': undefined,
|
|
3959
3975
|
'baseVolume': baseVolume,
|
|
3960
3976
|
'quoteVolume': quoteVolume,
|
|
3977
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
3978
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
3961
3979
|
'info': ticker,
|
|
3962
3980
|
}, market);
|
|
3963
3981
|
}
|
|
@@ -4220,6 +4238,36 @@ class binance extends binance$1 {
|
|
|
4220
4238
|
}
|
|
4221
4239
|
return this.parseTickers(response, symbols);
|
|
4222
4240
|
}
|
|
4241
|
+
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
4242
|
+
/**
|
|
4243
|
+
* @method
|
|
4244
|
+
* @name binance#fetchMarkPrices
|
|
4245
|
+
* @description fetches mark prices for multiple markets
|
|
4246
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
|
|
4247
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
4248
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4249
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
4250
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
4251
|
+
*/
|
|
4252
|
+
await this.loadMarkets();
|
|
4253
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
4254
|
+
const market = this.getMarketFromSymbols(symbols);
|
|
4255
|
+
let type = undefined;
|
|
4256
|
+
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params, 'swap');
|
|
4257
|
+
let subType = undefined;
|
|
4258
|
+
[subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
|
|
4259
|
+
let response = undefined;
|
|
4260
|
+
if (this.isLinear(type, subType)) {
|
|
4261
|
+
response = await this.fapiPublicGetPremiumIndex(params);
|
|
4262
|
+
}
|
|
4263
|
+
else if (this.isInverse(type, subType)) {
|
|
4264
|
+
response = await this.dapiPublicGetPremiumIndex(params);
|
|
4265
|
+
}
|
|
4266
|
+
else {
|
|
4267
|
+
throw new errors.NotSupported(this.id + ' fetchMarkPrices() does not support ' + type + ' markets yet');
|
|
4268
|
+
}
|
|
4269
|
+
return this.parseTickers(response, symbols);
|
|
4270
|
+
}
|
|
4223
4271
|
parseOHLCV(ohlcv, market = undefined) {
|
|
4224
4272
|
// when api method = publicGetKlines || fapiPublicGetKlines || dapiPublicGetKlines
|
|
4225
4273
|
// [
|
|
@@ -5839,6 +5887,8 @@ class binance extends binance$1 {
|
|
|
5839
5887
|
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
5840
5888
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
|
|
5841
5889
|
* @param {string} [params.stopLossOrTakeProfit] 'stopLoss' or 'takeProfit', required for spot trailing orders
|
|
5890
|
+
* @param {string} [params.positionSide] *swap and portfolio margin only* "BOTH" for one-way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
|
|
5891
|
+
* @param {bool} [params.hedged] *swap and portfolio margin only* true for hedged mode, false for one way mode, default is false
|
|
5842
5892
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5843
5893
|
*/
|
|
5844
5894
|
await this.loadMarkets();
|
|
@@ -5947,9 +5997,9 @@ class binance extends binance$1 {
|
|
|
5947
5997
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'createOrder', 'papi', 'portfolioMargin', false);
|
|
5948
5998
|
let marginMode = undefined;
|
|
5949
5999
|
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
6000
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
5950
6001
|
if ((marketType === 'margin') || (marginMode !== undefined) || market['option']) {
|
|
5951
6002
|
// for swap and future reduceOnly is a string that cant be sent with close position set to true or in hedge mode
|
|
5952
|
-
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
5953
6003
|
params = this.omit(params, 'reduceOnly');
|
|
5954
6004
|
if (market['option']) {
|
|
5955
6005
|
request['reduceOnly'] = reduceOnly;
|
|
@@ -6219,7 +6269,15 @@ class binance extends binance$1 {
|
|
|
6219
6269
|
if (this.safeString(params, 'timeInForce') === 'PO') {
|
|
6220
6270
|
params = this.omit(params, 'timeInForce');
|
|
6221
6271
|
}
|
|
6222
|
-
const
|
|
6272
|
+
const hedged = this.safeBool(params, 'hedged', false);
|
|
6273
|
+
if (!market['spot'] && !market['option'] && hedged) {
|
|
6274
|
+
if (reduceOnly) {
|
|
6275
|
+
params = this.omit(params, 'reduceOnly');
|
|
6276
|
+
side = (side === 'buy') ? 'sell' : 'buy';
|
|
6277
|
+
}
|
|
6278
|
+
request['positionSide'] = (side === 'buy') ? 'LONG' : 'SHORT';
|
|
6279
|
+
}
|
|
6280
|
+
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test', 'hedged']);
|
|
6223
6281
|
return this.extend(request, requestParams);
|
|
6224
6282
|
}
|
|
6225
6283
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -65,6 +65,7 @@ class bingx extends bingx$1 {
|
|
|
65
65
|
'fetchMarginMode': true,
|
|
66
66
|
'fetchMarkets': true,
|
|
67
67
|
'fetchMarkOHLCV': true,
|
|
68
|
+
'fetchMarkPrices': true,
|
|
68
69
|
'fetchMyLiquidations': true,
|
|
69
70
|
'fetchOHLCV': true,
|
|
70
71
|
'fetchOpenInterest': true,
|
|
@@ -581,8 +582,8 @@ class bingx extends bingx$1 {
|
|
|
581
582
|
const networkList = this.safeList(entry, 'networkList');
|
|
582
583
|
const networks = {};
|
|
583
584
|
let fee = undefined;
|
|
584
|
-
let depositEnabled =
|
|
585
|
-
let withdrawEnabled =
|
|
585
|
+
let depositEnabled = false;
|
|
586
|
+
let withdrawEnabled = false;
|
|
586
587
|
let defaultLimits = {};
|
|
587
588
|
for (let j = 0; j < networkList.length; j++) {
|
|
588
589
|
const rawNetwork = networkList[j];
|
|
@@ -594,7 +595,7 @@ class bingx extends bingx$1 {
|
|
|
594
595
|
depositEnabled = true;
|
|
595
596
|
}
|
|
596
597
|
const networkWithdrawEnabled = this.safeBool(rawNetwork, 'withdrawEnable');
|
|
597
|
-
if (
|
|
598
|
+
if (networkWithdrawEnabled) {
|
|
598
599
|
withdrawEnabled = true;
|
|
599
600
|
}
|
|
600
601
|
const limits = {
|
|
@@ -1729,7 +1730,76 @@ class bingx extends bingx$1 {
|
|
|
1729
1730
|
const tickers = this.safeList(response, 'data');
|
|
1730
1731
|
return this.parseTickers(tickers, symbols);
|
|
1731
1732
|
}
|
|
1733
|
+
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
1734
|
+
/**
|
|
1735
|
+
* @method
|
|
1736
|
+
* @name bingx#fetchMarkPrices
|
|
1737
|
+
* @description fetches mark prices for multiple markets
|
|
1738
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
|
|
1739
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1740
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1741
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1742
|
+
*/
|
|
1743
|
+
await this.loadMarkets();
|
|
1744
|
+
let market = undefined;
|
|
1745
|
+
if (symbols !== undefined) {
|
|
1746
|
+
symbols = this.marketSymbols(symbols);
|
|
1747
|
+
const firstSymbol = this.safeString(symbols, 0);
|
|
1748
|
+
if (firstSymbol !== undefined) {
|
|
1749
|
+
market = this.market(firstSymbol);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
let subType = undefined;
|
|
1753
|
+
[subType, params] = this.handleSubTypeAndParams('fetchMarkPrices', market, params, 'linear');
|
|
1754
|
+
let response = undefined;
|
|
1755
|
+
if (subType === 'inverse') {
|
|
1756
|
+
response = await this.cswapV1PublicGetMarketPremiumIndex(params);
|
|
1757
|
+
}
|
|
1758
|
+
else {
|
|
1759
|
+
response = await this.swapV2PublicGetQuotePremiumIndex(params);
|
|
1760
|
+
}
|
|
1761
|
+
//
|
|
1762
|
+
// spot and swap
|
|
1763
|
+
//
|
|
1764
|
+
// {
|
|
1765
|
+
// "code": 0,
|
|
1766
|
+
// "msg": "",
|
|
1767
|
+
// "timestamp": 1720647285296,
|
|
1768
|
+
// "data": [
|
|
1769
|
+
// {
|
|
1770
|
+
// "symbol": "SOL-USD",
|
|
1771
|
+
// "priceChange": "-2.418",
|
|
1772
|
+
// "priceChangePercent": "-1.6900%",
|
|
1773
|
+
// "lastPrice": "140.574",
|
|
1774
|
+
// "lastQty": "1",
|
|
1775
|
+
// "highPrice": "146.190",
|
|
1776
|
+
// "lowPrice": "138.586",
|
|
1777
|
+
// "volume": "1464648.00",
|
|
1778
|
+
// "quoteVolume": "102928.12",
|
|
1779
|
+
// "openPrice": "142.994",
|
|
1780
|
+
// "closeTime": "1720647284976",
|
|
1781
|
+
// "bidPrice": "140.573",
|
|
1782
|
+
// "bidQty": "372",
|
|
1783
|
+
// "askPrice": "140.577",
|
|
1784
|
+
// "askQty": "58"
|
|
1785
|
+
// },
|
|
1786
|
+
// ...
|
|
1787
|
+
// ]
|
|
1788
|
+
// }
|
|
1789
|
+
//
|
|
1790
|
+
const tickers = this.safeList(response, 'data');
|
|
1791
|
+
return this.parseTickers(tickers, symbols);
|
|
1792
|
+
}
|
|
1732
1793
|
parseTicker(ticker, market = undefined) {
|
|
1794
|
+
//
|
|
1795
|
+
// mark price
|
|
1796
|
+
// {
|
|
1797
|
+
// "symbol": "string",
|
|
1798
|
+
// "lastFundingRate": "string",
|
|
1799
|
+
// "markPrice": "string",
|
|
1800
|
+
// "indexPrice": "string",
|
|
1801
|
+
// "nextFundingTime": "int64"
|
|
1802
|
+
// }
|
|
1733
1803
|
//
|
|
1734
1804
|
// spot
|
|
1735
1805
|
// {
|
|
@@ -1817,6 +1887,8 @@ class bingx extends bingx$1 {
|
|
|
1817
1887
|
'average': undefined,
|
|
1818
1888
|
'baseVolume': baseVolume,
|
|
1819
1889
|
'quoteVolume': quoteVolume,
|
|
1890
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
1891
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
1820
1892
|
'info': ticker,
|
|
1821
1893
|
}, market);
|
|
1822
1894
|
}
|
|
@@ -2612,6 +2684,7 @@ class bingx extends bingx$1 {
|
|
|
2612
2684
|
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
2613
2685
|
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
2614
2686
|
* @param {boolean} [params.test] *swap only* whether to use the test endpoint or not, default is false
|
|
2687
|
+
* @param {string} [params.positionSide] *contracts only* "BOTH" for one way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
|
|
2615
2688
|
* @param {boolean} [params.hedged] *swap only* whether the order is in hedged mode or one way mode
|
|
2616
2689
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2617
2690
|
*/
|
|
@@ -4447,18 +4520,35 @@ class bingx extends bingx$1 {
|
|
|
4447
4520
|
// "tag": ''
|
|
4448
4521
|
// }
|
|
4449
4522
|
//
|
|
4450
|
-
|
|
4523
|
+
let address = this.safeString(depositAddress, 'address');
|
|
4451
4524
|
const tag = this.safeString(depositAddress, 'tag');
|
|
4452
4525
|
const currencyId = this.safeString(depositAddress, 'coin');
|
|
4453
4526
|
currency = this.safeCurrency(currencyId, currency);
|
|
4454
4527
|
const code = currency['code'];
|
|
4455
|
-
|
|
4528
|
+
// the exchange API returns deposit addresses without the leading '0x' prefix
|
|
4529
|
+
// however, the exchange API does require the 0x prefix to withdraw
|
|
4530
|
+
// so we append the prefix before returning the address to the user
|
|
4531
|
+
// that is only if the underlying contract address has the 0x prefix as well
|
|
4532
|
+
const networkCode = this.safeString(depositAddress, 'network');
|
|
4533
|
+
if (networkCode !== undefined) {
|
|
4534
|
+
if (networkCode in currency['networks']) {
|
|
4535
|
+
const network = currency['networks'][networkCode];
|
|
4536
|
+
const contractAddress = this.safeString(network['info'], 'contractAddress');
|
|
4537
|
+
if (contractAddress !== undefined) {
|
|
4538
|
+
if (contractAddress[0] === '0' && contractAddress[1] === 'x') {
|
|
4539
|
+
if (address[0] !== '0' || address[1] !== 'x') {
|
|
4540
|
+
address = '0x' + address;
|
|
4541
|
+
}
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4456
4546
|
this.checkAddress(address);
|
|
4457
4547
|
return {
|
|
4458
4548
|
'currency': code,
|
|
4459
4549
|
'address': address,
|
|
4460
4550
|
'tag': tag,
|
|
4461
|
-
'network':
|
|
4551
|
+
'network': networkCode,
|
|
4462
4552
|
'info': depositAddress,
|
|
4463
4553
|
};
|
|
4464
4554
|
}
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -2640,6 +2640,7 @@ class bitget extends bitget$1 {
|
|
|
2640
2640
|
'average': undefined,
|
|
2641
2641
|
'baseVolume': this.safeString(ticker, 'baseVolume'),
|
|
2642
2642
|
'quoteVolume': this.safeString(ticker, 'quoteVolume'),
|
|
2643
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
2643
2644
|
'info': ticker,
|
|
2644
2645
|
}, market);
|
|
2645
2646
|
}
|
|
@@ -4120,6 +4121,7 @@ class bitget extends bitget$1 {
|
|
|
4120
4121
|
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
4121
4122
|
* @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
4122
4123
|
* @param {boolean} [params.oneWayMode] *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method
|
|
4124
|
+
* @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode, default is false
|
|
4123
4125
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
4124
4126
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4125
4127
|
*/
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -1437,6 +1437,7 @@ class bitmex extends bitmex$1 {
|
|
|
1437
1437
|
'average': undefined,
|
|
1438
1438
|
'baseVolume': this.safeString(ticker, 'homeNotional24h'),
|
|
1439
1439
|
'quoteVolume': this.safeString(ticker, 'foreignNotional24h'),
|
|
1440
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
1440
1441
|
'info': ticker,
|
|
1441
1442
|
}, market);
|
|
1442
1443
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -2108,6 +2108,8 @@ class bybit extends bybit$1 {
|
|
|
2108
2108
|
'average': undefined,
|
|
2109
2109
|
'baseVolume': baseVolume,
|
|
2110
2110
|
'quoteVolume': quoteVolume,
|
|
2111
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
2112
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
2111
2113
|
'info': ticker,
|
|
2112
2114
|
}, market);
|
|
2113
2115
|
}
|
|
@@ -3618,7 +3620,8 @@ class bybit extends bybit$1 {
|
|
|
3618
3620
|
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK"
|
|
3619
3621
|
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
3620
3622
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
3621
|
-
* @param {string} [params.positionIdx] *contracts only*
|
|
3623
|
+
* @param {string} [params.positionIdx] *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
|
|
3624
|
+
* @param {bool} [params.hedged] *contracts only* true for hedged mode, false for one way mode, default is false
|
|
3622
3625
|
* @param {boolean} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
3623
3626
|
* @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
|
|
3624
3627
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
@@ -1505,6 +1505,8 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1505
1505
|
'baseVolume': undefined,
|
|
1506
1506
|
'quoteVolume': undefined,
|
|
1507
1507
|
'previousClose': undefined,
|
|
1508
|
+
'markPrice': this.safeNumber(ticker, 'mark_price'),
|
|
1509
|
+
'indexPrice': this.safeNumber(ticker, 'index_price'),
|
|
1508
1510
|
});
|
|
1509
1511
|
}
|
|
1510
1512
|
async fetchBalance(params = {}) {
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -917,6 +917,8 @@ class coinex extends coinex$1 {
|
|
|
917
917
|
'average': undefined,
|
|
918
918
|
'baseVolume': this.safeString(ticker, 'volume'),
|
|
919
919
|
'quoteVolume': undefined,
|
|
920
|
+
'markPrice': this.safeString(ticker, 'mark_price'),
|
|
921
|
+
'indexPrice': this.safeString(ticker, 'index_price'),
|
|
920
922
|
'info': ticker,
|
|
921
923
|
}, market);
|
|
922
924
|
}
|
package/dist/cjs/src/delta.js
CHANGED
|
@@ -963,6 +963,8 @@ class delta extends delta$1 {
|
|
|
963
963
|
'average': undefined,
|
|
964
964
|
'baseVolume': this.safeNumber(ticker, 'volume'),
|
|
965
965
|
'quoteVolume': this.safeNumber(ticker, 'turnover'),
|
|
966
|
+
'markPrice': this.safeNumber(ticker, 'mark_price'),
|
|
967
|
+
'indexPrice': this.safeNumber(ticker, 'spot_price'),
|
|
966
968
|
'info': ticker,
|
|
967
969
|
}, market);
|
|
968
970
|
}
|
package/dist/cjs/src/deribit.js
CHANGED
|
@@ -1157,6 +1157,8 @@ class deribit extends deribit$1 {
|
|
|
1157
1157
|
'average': undefined,
|
|
1158
1158
|
'baseVolume': undefined,
|
|
1159
1159
|
'quoteVolume': this.safeString(stats, 'volume'),
|
|
1160
|
+
'markPrice': this.safeString(ticker, 'mark_price'),
|
|
1161
|
+
'indexPrice': this.safeString(ticker, 'index_price'),
|
|
1160
1162
|
'info': ticker,
|
|
1161
1163
|
}, market);
|
|
1162
1164
|
}
|
|
@@ -1192,6 +1192,8 @@ class digifinex extends digifinex$1 {
|
|
|
1192
1192
|
'average': undefined,
|
|
1193
1193
|
'baseVolume': this.safeString2(ticker, 'vol', 'volume_24h'),
|
|
1194
1194
|
'quoteVolume': this.safeString(ticker, 'base_vol'),
|
|
1195
|
+
'markPrice': this.safeString(ticker, 'mark_price'),
|
|
1196
|
+
'indexPrice': indexPrice,
|
|
1195
1197
|
'info': ticker,
|
|
1196
1198
|
}, market);
|
|
1197
1199
|
}
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -2610,6 +2610,8 @@ class gate extends gate$1 {
|
|
|
2610
2610
|
'average': undefined,
|
|
2611
2611
|
'baseVolume': baseVolume,
|
|
2612
2612
|
'quoteVolume': quoteVolume,
|
|
2613
|
+
'markPrice': this.safeString(ticker, 'mark_price'),
|
|
2614
|
+
'indexPrice': this.safeString(ticker, 'index_price'),
|
|
2613
2615
|
'info': ticker,
|
|
2614
2616
|
}, market);
|
|
2615
2617
|
}
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -3702,6 +3702,12 @@ class htx extends htx$1 {
|
|
|
3702
3702
|
* @method
|
|
3703
3703
|
* @name htx#fetchOrder
|
|
3704
3704
|
* @description fetches information on an order made by the user
|
|
3705
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id
|
|
3706
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order
|
|
3707
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-information-of-an-order
|
|
3708
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-information-of-order
|
|
3709
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#get-information-of-an-order
|
|
3710
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-information-of-an-order
|
|
3705
3711
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3706
3712
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3707
3713
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -4373,7 +4379,7 @@ class htx extends htx$1 {
|
|
|
4373
4379
|
await this.loadAccounts();
|
|
4374
4380
|
for (let i = 0; i < this.accounts.length; i++) {
|
|
4375
4381
|
const account = this.accounts[i];
|
|
4376
|
-
if (account
|
|
4382
|
+
if (this.safeString(account, 'type') === 'spot') {
|
|
4377
4383
|
accountId = this.safeString(account, 'id');
|
|
4378
4384
|
if (accountId !== undefined) {
|
|
4379
4385
|
break;
|
|
@@ -5065,7 +5071,7 @@ class htx extends htx$1 {
|
|
|
5065
5071
|
}
|
|
5066
5072
|
else {
|
|
5067
5073
|
amount = this.safeString2(order, 'volume', 'amount');
|
|
5068
|
-
cost = this.safeStringN(order, ['filled-cash-amount', 'field-cash-amount', 'trade_turnover']); // same typo
|
|
5074
|
+
cost = this.safeStringN(order, ['filled-cash-amount', 'field-cash-amount', 'trade_turnover']); // same typo here
|
|
5069
5075
|
}
|
|
5070
5076
|
const filled = this.safeStringN(order, ['filled-amount', 'field-amount', 'trade_volume']); // typo in their API, filled amount
|
|
5071
5077
|
const price = this.safeString2(order, 'price', 'order_price');
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1823,7 +1823,7 @@ class kraken extends kraken$1 {
|
|
|
1823
1823
|
const extendedOflags = (flags !== undefined) ? flags + ',viqc' : 'viqc';
|
|
1824
1824
|
request['oflags'] = extendedOflags;
|
|
1825
1825
|
}
|
|
1826
|
-
else if (isLimitOrder && !isTrailingAmountOrder) {
|
|
1826
|
+
else if (isLimitOrder && !isTrailingAmountOrder && !isTrailingPercentOrder) {
|
|
1827
1827
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1828
1828
|
}
|
|
1829
1829
|
const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
|
|
@@ -1852,8 +1852,8 @@ class kraken extends kraken$1 {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
else if (isTrailingAmountOrder || isTrailingPercentOrder) {
|
|
1854
1854
|
let trailingPercentString = undefined;
|
|
1855
|
-
if (
|
|
1856
|
-
trailingPercentString = (trailingPercent.endsWith('%')) ? trailingPercent : '+' +
|
|
1855
|
+
if (trailingPercent !== undefined) {
|
|
1856
|
+
trailingPercentString = (trailingPercent.endsWith('%')) ? ('+' + trailingPercent) : ('+' + trailingPercent + '%');
|
|
1857
1857
|
}
|
|
1858
1858
|
const trailingAmountString = (trailingAmount !== undefined) ? '+' + trailingAmount : undefined; // must use + for this
|
|
1859
1859
|
const offset = this.safeString(params, 'offset', '-'); // can use + or - for this
|
|
@@ -1863,7 +1863,7 @@ class kraken extends kraken$1 {
|
|
|
1863
1863
|
if (isLimitOrder || (trailingLimitAmount !== undefined) || (trailingLimitPercent !== undefined)) {
|
|
1864
1864
|
request['ordertype'] = 'trailing-stop-limit';
|
|
1865
1865
|
if (trailingLimitPercent !== undefined) {
|
|
1866
|
-
const trailingLimitPercentString = (trailingLimitPercent.endsWith('%')) ? trailingLimitPercent : (
|
|
1866
|
+
const trailingLimitPercentString = (trailingLimitPercent.endsWith('%')) ? (offset + trailingLimitPercent) : (offset + trailingLimitPercent + '%');
|
|
1867
1867
|
request['price'] = trailingPercentString;
|
|
1868
1868
|
request['price2'] = trailingLimitPercentString;
|
|
1869
1869
|
}
|
|
@@ -613,6 +613,8 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
613
613
|
'average': average,
|
|
614
614
|
'baseVolume': baseVolume,
|
|
615
615
|
'quoteVolume': quoteVolume,
|
|
616
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
617
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
616
618
|
'info': ticker,
|
|
617
619
|
});
|
|
618
620
|
}
|
|
@@ -966,6 +966,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
966
966
|
'average': undefined,
|
|
967
967
|
'baseVolume': this.safeString(ticker, 'volumeOf24h'),
|
|
968
968
|
'quoteVolume': this.safeString(ticker, 'turnoverOf24h'),
|
|
969
|
+
'markPrice': this.safeString(ticker, 'markPrice'),
|
|
970
|
+
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
969
971
|
'info': ticker,
|
|
970
972
|
}, market);
|
|
971
973
|
}
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -2147,6 +2147,7 @@ class mexc extends mexc$1 {
|
|
|
2147
2147
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
2148
2148
|
* @param {bool} [params.postOnly] if true, the order will only be posted if it will be a maker order
|
|
2149
2149
|
* @param {bool} [params.reduceOnly] *contract only* indicates if this order is to reduce the size of a position
|
|
2150
|
+
* @param {bool} [params.hedged] *swap only* true for hedged mode, false for one way mode, default is false
|
|
2150
2151
|
*
|
|
2151
2152
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
2152
2153
|
* @param {int} [params.leverage] *contract only* leverage is necessary on isolated margin
|
|
@@ -2291,6 +2292,7 @@ class mexc extends mexc$1 {
|
|
|
2291
2292
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
2292
2293
|
* @param {bool} [params.postOnly] if true, the order will only be posted if it will be a maker order
|
|
2293
2294
|
* @param {bool} [params.reduceOnly] indicates if this order is to reduce the size of a position
|
|
2295
|
+
* @param {bool} [params.hedged] *swap only* true for hedged mode, false for one way mode, default is false
|
|
2294
2296
|
*
|
|
2295
2297
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
2296
2298
|
* @param {int} [params.leverage] leverage is necessary on isolated margin
|
|
@@ -2371,18 +2373,31 @@ class mexc extends mexc$1 {
|
|
|
2371
2373
|
}
|
|
2372
2374
|
}
|
|
2373
2375
|
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
+
const hedged = this.safeBool(params, 'hedged', false);
|
|
2377
|
+
let sideInteger = undefined;
|
|
2378
|
+
if (hedged) {
|
|
2379
|
+
if (reduceOnly) {
|
|
2380
|
+
params = this.omit(params, 'reduceOnly'); // hedged mode does not accept this parameter
|
|
2381
|
+
side = (side === 'buy') ? 'sell' : 'buy';
|
|
2382
|
+
}
|
|
2383
|
+
sideInteger = (side === 'buy') ? 1 : 3;
|
|
2384
|
+
request['positionMode'] = 1;
|
|
2376
2385
|
}
|
|
2377
2386
|
else {
|
|
2378
|
-
|
|
2387
|
+
if (reduceOnly) {
|
|
2388
|
+
sideInteger = (side === 'buy') ? 2 : 4;
|
|
2389
|
+
}
|
|
2390
|
+
else {
|
|
2391
|
+
sideInteger = (side === 'buy') ? 1 : 3;
|
|
2392
|
+
}
|
|
2379
2393
|
}
|
|
2394
|
+
request['side'] = sideInteger;
|
|
2380
2395
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'externalOid');
|
|
2381
2396
|
if (clientOrderId !== undefined) {
|
|
2382
2397
|
request['externalOid'] = clientOrderId;
|
|
2383
2398
|
}
|
|
2384
2399
|
const stopPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
|
|
2385
|
-
params = this.omit(params, ['clientOrderId', 'externalOid', 'postOnly', 'stopPrice', 'triggerPrice']);
|
|
2400
|
+
params = this.omit(params, ['clientOrderId', 'externalOid', 'postOnly', 'stopPrice', 'triggerPrice', 'hedged']);
|
|
2386
2401
|
let response = undefined;
|
|
2387
2402
|
if (stopPrice) {
|
|
2388
2403
|
request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
|