ccxt 4.2.64 → 4.2.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +295 -74
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +12 -0
- package/dist/cjs/src/binance.js +26 -3
- package/dist/cjs/src/bingx.js +13 -4
- package/dist/cjs/src/bitmex.js +3 -1
- package/dist/cjs/src/blofin.js +35 -0
- package/dist/cjs/src/btcmarkets.js +12 -0
- package/dist/cjs/src/coinbase.js +12 -2
- package/dist/cjs/src/delta.js +95 -1
- package/dist/cjs/src/kucoin.js +85 -61
- package/dist/cjs/src/pro/currencycom.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +9 -0
- package/js/src/abstract/kucoinfutures.d.ts +9 -0
- package/js/src/base/Exchange.js +12 -0
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +26 -3
- package/js/src/bingx.js +13 -4
- package/js/src/bitmex.js +3 -1
- package/js/src/blofin.d.ts +3 -1
- package/js/src/blofin.js +35 -0
- package/js/src/btcmarkets.js +12 -0
- package/js/src/coinbase.js +12 -2
- package/js/src/delta.d.ts +3 -1
- package/js/src/delta.js +95 -1
- package/js/src/gate.d.ts +1 -1
- package/js/src/kucoin.js +85 -61
- package/js/src/okx.d.ts +1 -1
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/currencycom.js +1 -1
- package/js/src/woo.d.ts +1 -1
- package/package.json +2 -2
- package/skip-tests.json +35 -13
package/dist/cjs/ccxt.js
CHANGED
|
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
177
177
|
|
|
178
178
|
//-----------------------------------------------------------------------------
|
|
179
179
|
// this is updated by vss.js when building
|
|
180
|
-
const version = '4.2.
|
|
180
|
+
const version = '4.2.65';
|
|
181
181
|
Exchange["default"].ccxtVersion = version;
|
|
182
182
|
const exchanges = {
|
|
183
183
|
'ace': ace,
|
|
@@ -2705,6 +2705,18 @@ class Exchange {
|
|
|
2705
2705
|
return this.filterBySymbolSinceLimit(results, symbol, since, limit);
|
|
2706
2706
|
}
|
|
2707
2707
|
calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
|
2708
|
+
/**
|
|
2709
|
+
* @method
|
|
2710
|
+
* @description calculates the presumptive fee that would be charged for an order
|
|
2711
|
+
* @param {string} symbol unified market symbol
|
|
2712
|
+
* @param {string} type 'market' or 'limit'
|
|
2713
|
+
* @param {string} side 'buy' or 'sell'
|
|
2714
|
+
* @param {float} amount how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
|
2715
|
+
* @param {float} price the price for the order to be filled at, in units of the quote currency
|
|
2716
|
+
* @param {string} takerOrMaker 'taker' or 'maker'
|
|
2717
|
+
* @param {object} params
|
|
2718
|
+
* @returns {object} contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
|
2719
|
+
*/
|
|
2708
2720
|
if (type === 'market' && takerOrMaker === 'maker') {
|
|
2709
2721
|
throw new errors.ArgumentsRequired(this.id + ' calculateFee() - you have provided incompatible arguments - "market" type order can not be "maker". Change either the "type" or the "takerOrMaker" argument to calculate the fee.');
|
|
2710
2722
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -2525,6 +2525,7 @@ class binance extends binance$1 {
|
|
|
2525
2525
|
* @see https://binance-docs.github.io/apidocs/futures/en/#check-server-time // swap
|
|
2526
2526
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#check-server-time // future
|
|
2527
2527
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2528
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
2528
2529
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
2529
2530
|
*/
|
|
2530
2531
|
const defaultType = this.safeString2(this.options, 'fetchTime', 'defaultType', 'spot');
|
|
@@ -3320,6 +3321,7 @@ class binance extends binance$1 {
|
|
|
3320
3321
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
3321
3322
|
* @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
|
|
3322
3323
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the balance for a portfolio margin account
|
|
3324
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
3323
3325
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3324
3326
|
*/
|
|
3325
3327
|
await this.loadMarkets();
|
|
@@ -3898,6 +3900,7 @@ class binance extends binance$1 {
|
|
|
3898
3900
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-order-book-ticker // future
|
|
3899
3901
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
3900
3902
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3903
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
3901
3904
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3902
3905
|
*/
|
|
3903
3906
|
await this.loadMarkets();
|
|
@@ -3938,6 +3941,7 @@ class binance extends binance$1 {
|
|
|
3938
3941
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
|
|
3939
3942
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
|
|
3940
3943
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3944
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
3941
3945
|
* @returns {object} a dictionary of lastprices structures
|
|
3942
3946
|
*/
|
|
3943
3947
|
await this.loadMarkets();
|
|
@@ -4043,6 +4047,7 @@ class binance extends binance$1 {
|
|
|
4043
4047
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
|
|
4044
4048
|
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
4045
4049
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4050
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
4046
4051
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
4047
4052
|
*/
|
|
4048
4053
|
await this.loadMarkets();
|
|
@@ -6469,6 +6474,7 @@ class binance extends binance$1 {
|
|
|
6469
6474
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
6470
6475
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch open orders in the portfolio margin account
|
|
6471
6476
|
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account conditional orders
|
|
6477
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
6472
6478
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
6473
6479
|
*/
|
|
6474
6480
|
await this.loadMarkets();
|
|
@@ -8612,6 +8618,7 @@ class binance extends binance$1 {
|
|
|
8612
8618
|
* @param {string} symbol unified market symbol
|
|
8613
8619
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8614
8620
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
|
|
8621
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
8615
8622
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
8616
8623
|
*/
|
|
8617
8624
|
await this.loadMarkets();
|
|
@@ -8680,6 +8687,7 @@ class binance extends binance$1 {
|
|
|
8680
8687
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
8681
8688
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
8682
8689
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8690
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
8683
8691
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
8684
8692
|
*/
|
|
8685
8693
|
await this.loadMarkets();
|
|
@@ -8937,6 +8945,7 @@ class binance extends binance$1 {
|
|
|
8937
8945
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8938
8946
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
8939
8947
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
8948
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
8940
8949
|
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
8941
8950
|
*/
|
|
8942
8951
|
await this.loadMarkets();
|
|
@@ -9010,6 +9019,7 @@ class binance extends binance$1 {
|
|
|
9010
9019
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
9011
9020
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
9012
9021
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9022
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
9013
9023
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
9014
9024
|
*/
|
|
9015
9025
|
await this.loadMarkets();
|
|
@@ -9633,6 +9643,7 @@ class binance extends binance$1 {
|
|
|
9633
9643
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
9634
9644
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9635
9645
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the leverage tiers for a portfolio margin account
|
|
9646
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
9636
9647
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
9637
9648
|
*/
|
|
9638
9649
|
await this.loadMarkets();
|
|
@@ -9947,6 +9958,7 @@ class binance extends binance$1 {
|
|
|
9947
9958
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
9948
9959
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9949
9960
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
|
|
9961
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
9950
9962
|
* @returns {object} data on account positions
|
|
9951
9963
|
*/
|
|
9952
9964
|
if (symbols !== undefined) {
|
|
@@ -10000,6 +10012,7 @@ class binance extends binance$1 {
|
|
|
10000
10012
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
10001
10013
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10002
10014
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
|
|
10015
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
10003
10016
|
* @returns {object} data on the positions risk
|
|
10004
10017
|
*/
|
|
10005
10018
|
if (symbols !== undefined) {
|
|
@@ -10159,6 +10172,7 @@ class binance extends binance$1 {
|
|
|
10159
10172
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10160
10173
|
* @param {int} [params.until] timestamp in ms of the latest funding history entry
|
|
10161
10174
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the funding history for a portfolio margin account
|
|
10175
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
10162
10176
|
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
10163
10177
|
*/
|
|
10164
10178
|
await this.loadMarkets();
|
|
@@ -10343,6 +10357,7 @@ class binance extends binance$1 {
|
|
|
10343
10357
|
* @param {string} symbol not used by binance setPositionMode ()
|
|
10344
10358
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10345
10359
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to set the position mode for a portfolio margin account
|
|
10360
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
10346
10361
|
* @returns {object} response from the exchange
|
|
10347
10362
|
*/
|
|
10348
10363
|
const defaultType = this.safeString(this.options, 'defaultType', 'future');
|
|
@@ -10371,7 +10386,7 @@ class binance extends binance$1 {
|
|
|
10371
10386
|
response = await this.dapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
10372
10387
|
}
|
|
10373
10388
|
}
|
|
10374
|
-
else {
|
|
10389
|
+
else if (this.isLinear(type, subType)) {
|
|
10375
10390
|
if (isPortfolioMargin) {
|
|
10376
10391
|
response = await this.papiPostUmPositionSideDual(this.extend(request, params));
|
|
10377
10392
|
}
|
|
@@ -10379,6 +10394,9 @@ class binance extends binance$1 {
|
|
|
10379
10394
|
response = await this.fapiPrivatePostPositionSideDual(this.extend(request, params));
|
|
10380
10395
|
}
|
|
10381
10396
|
}
|
|
10397
|
+
else {
|
|
10398
|
+
throw new errors.BadRequest(this.id + ' setPositionMode() supports linear and inverse contracts only');
|
|
10399
|
+
}
|
|
10382
10400
|
//
|
|
10383
10401
|
// {
|
|
10384
10402
|
// "code": 200,
|
|
@@ -10398,6 +10416,7 @@ class binance extends binance$1 {
|
|
|
10398
10416
|
* @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
|
|
10399
10417
|
* @param {string[]} [symbols] a list of unified market symbols
|
|
10400
10418
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10419
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
10401
10420
|
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
10402
10421
|
*/
|
|
10403
10422
|
await this.loadMarkets();
|
|
@@ -10672,6 +10691,7 @@ class binance extends binance$1 {
|
|
|
10672
10691
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
10673
10692
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
10674
10693
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the ledger for a portfolio margin account
|
|
10694
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
10675
10695
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
10676
10696
|
*/
|
|
10677
10697
|
await this.loadMarkets();
|
|
@@ -11815,6 +11835,8 @@ class binance extends binance$1 {
|
|
|
11815
11835
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
11816
11836
|
* @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
11817
11837
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch liquidations in a portfolio margin account
|
|
11838
|
+
* @param {string} [params.type] "spot"
|
|
11839
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
11818
11840
|
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
11819
11841
|
*/
|
|
11820
11842
|
await this.loadMarkets();
|
|
@@ -12140,8 +12162,8 @@ class binance extends binance$1 {
|
|
|
12140
12162
|
* @name binance#fetchPositionMode
|
|
12141
12163
|
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
12142
12164
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
12143
|
-
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
12144
|
-
* @param {string} params.subType "linear" or "inverse"
|
|
12165
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12166
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
12145
12167
|
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
12146
12168
|
*/
|
|
12147
12169
|
let market = undefined;
|
|
@@ -12179,6 +12201,7 @@ class binance extends binance$1 {
|
|
|
12179
12201
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
12180
12202
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
12181
12203
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12204
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
12182
12205
|
* @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
12183
12206
|
*/
|
|
12184
12207
|
await this.loadMarkets();
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -1864,6 +1864,7 @@ class bingx extends bingx$1 {
|
|
|
1864
1864
|
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
1865
1865
|
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
1866
1866
|
const trailingPercent = this.safeString2(params, 'trailingPercent', 'priceRate');
|
|
1867
|
+
const trailingType = this.safeString(params, 'trailingType', 'TRAILING_STOP_MARKET');
|
|
1867
1868
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
1868
1869
|
const isStopLossPriceOrder = stopLossPrice !== undefined;
|
|
1869
1870
|
const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
|
|
@@ -1910,7 +1911,7 @@ class bingx extends bingx$1 {
|
|
|
1910
1911
|
}
|
|
1911
1912
|
}
|
|
1912
1913
|
else if (isTrailing) {
|
|
1913
|
-
request['type'] =
|
|
1914
|
+
request['type'] = trailingType;
|
|
1914
1915
|
if (isTrailingAmountOrder) {
|
|
1915
1916
|
request['price'] = this.parseToNumeric(trailingAmount);
|
|
1916
1917
|
}
|
|
@@ -1965,7 +1966,7 @@ class bingx extends bingx$1 {
|
|
|
1965
1966
|
}
|
|
1966
1967
|
request['positionSide'] = positionSide;
|
|
1967
1968
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1968
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
1969
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
1969
1970
|
}
|
|
1970
1971
|
return this.extend(request, params);
|
|
1971
1972
|
}
|
|
@@ -1996,14 +1997,22 @@ class bingx extends bingx$1 {
|
|
|
1996
1997
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
1997
1998
|
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
1998
1999
|
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
2000
|
+
* @param {boolean} [params.test] *swap only* whether to use the test endpoint or not, default is false
|
|
1999
2001
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2000
2002
|
*/
|
|
2001
2003
|
await this.loadMarkets();
|
|
2002
2004
|
const market = this.market(symbol);
|
|
2005
|
+
const test = this.safeBool(params, 'test', false);
|
|
2006
|
+
params = this.omit(params, 'test');
|
|
2003
2007
|
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
2004
2008
|
let response = undefined;
|
|
2005
2009
|
if (market['swap']) {
|
|
2006
|
-
|
|
2010
|
+
if (test) {
|
|
2011
|
+
response = await this.swapV2PrivatePostTradeOrderTest(request);
|
|
2012
|
+
}
|
|
2013
|
+
else {
|
|
2014
|
+
response = await this.swapV2PrivatePostTradeOrder(request);
|
|
2015
|
+
}
|
|
2007
2016
|
}
|
|
2008
2017
|
else {
|
|
2009
2018
|
response = await this.spotV1PrivatePostTradeOrder(request);
|
|
@@ -4057,7 +4066,7 @@ class bingx extends bingx$1 {
|
|
|
4057
4066
|
* @param {string} [params.newClientOrderId] custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
|
|
4058
4067
|
* @param {string} [params.positionSide] *contract only* position direction, required for single position as BOTH, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty
|
|
4059
4068
|
* @param {string} [params.reduceOnly] *contract only* true or false, default=false for single position mode. this parameter is not accepted for both long and short positions mode
|
|
4060
|
-
* @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market, Max = 1
|
|
4069
|
+
* @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market or TRAILING_TP_SL, Max = 1
|
|
4061
4070
|
* @param {string} [params.workingType] *contract only* StopPrice trigger price types, MARK_PRICE (default), CONTRACT_PRICE, or INDEX_PRICE
|
|
4062
4071
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4063
4072
|
*/
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -2547,7 +2547,9 @@ class bitmex extends bitmex$1 {
|
|
|
2547
2547
|
if (until !== undefined) {
|
|
2548
2548
|
request['endTime'] = this.iso8601(until);
|
|
2549
2549
|
}
|
|
2550
|
-
|
|
2550
|
+
if ((since === undefined) && (until === undefined)) {
|
|
2551
|
+
request['reverse'] = true;
|
|
2552
|
+
}
|
|
2551
2553
|
const response = await this.publicGetFunding(this.extend(request, params));
|
|
2552
2554
|
//
|
|
2553
2555
|
// [
|
package/dist/cjs/src/blofin.js
CHANGED
|
@@ -82,6 +82,8 @@ class blofin extends blofin$1 {
|
|
|
82
82
|
'fetchLeverage': true,
|
|
83
83
|
'fetchLeverages': true,
|
|
84
84
|
'fetchLeverageTiers': false,
|
|
85
|
+
'fetchMarginMode': true,
|
|
86
|
+
'fetchMarginModes': false,
|
|
85
87
|
'fetchMarketLeverageTiers': false,
|
|
86
88
|
'fetchMarkets': true,
|
|
87
89
|
'fetchMarkOHLCV': false,
|
|
@@ -185,6 +187,7 @@ class blofin extends blofin$1 {
|
|
|
185
187
|
'account/balance': 1,
|
|
186
188
|
'account/positions': 1,
|
|
187
189
|
'account/leverage-info': 1,
|
|
190
|
+
'account/margin-mode': 1,
|
|
188
191
|
'account/batch-leverage-info': 1,
|
|
189
192
|
'trade/orders-tpsl-pending': 1,
|
|
190
193
|
'trade/orders-history': 1,
|
|
@@ -2105,6 +2108,38 @@ class blofin extends blofin$1 {
|
|
|
2105
2108
|
const data = this.safeList(response, 'data', []);
|
|
2106
2109
|
return this.parseOrders(data, market, since, limit);
|
|
2107
2110
|
}
|
|
2111
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
2112
|
+
/**
|
|
2113
|
+
* @method
|
|
2114
|
+
* @name blofin#fetchMarginMode
|
|
2115
|
+
* @description fetches the margin mode of a trading pair
|
|
2116
|
+
* @see https://docs.blofin.com/index.html#get-margin-mode
|
|
2117
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
2118
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2119
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
2120
|
+
*/
|
|
2121
|
+
await this.loadMarkets();
|
|
2122
|
+
const market = this.market(symbol);
|
|
2123
|
+
const response = await this.privateGetAccountMarginMode(params);
|
|
2124
|
+
//
|
|
2125
|
+
// {
|
|
2126
|
+
// "code": "0",
|
|
2127
|
+
// "msg": "success",
|
|
2128
|
+
// "data": {
|
|
2129
|
+
// "marginMode": "cross"
|
|
2130
|
+
// }
|
|
2131
|
+
// }
|
|
2132
|
+
//
|
|
2133
|
+
const data = this.safeDict(response, 'data', {});
|
|
2134
|
+
return this.parseMarginMode(data, market);
|
|
2135
|
+
}
|
|
2136
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
2137
|
+
return {
|
|
2138
|
+
'info': marginMode,
|
|
2139
|
+
'symbol': market['symbol'],
|
|
2140
|
+
'marginMode': this.safeString(marginMode, 'marginMode'),
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2108
2143
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
2109
2144
|
if (response === undefined) {
|
|
2110
2145
|
return undefined; // fallback to default error handler
|
|
@@ -914,6 +914,18 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
914
914
|
return await this.privateDeleteOrdersId(this.extend(request, params));
|
|
915
915
|
}
|
|
916
916
|
calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
|
917
|
+
/**
|
|
918
|
+
* @method
|
|
919
|
+
* @description calculates the presumptive fee that would be charged for an order
|
|
920
|
+
* @param {string} symbol unified market symbol
|
|
921
|
+
* @param {string} type not used by btcmarkets.calculateFee
|
|
922
|
+
* @param {string} side not used by btcmarkets.calculateFee
|
|
923
|
+
* @param {float} amount how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
|
924
|
+
* @param {float} price the price for the order to be filled at, in units of the quote currency
|
|
925
|
+
* @param {string} takerOrMaker 'taker' or 'maker'
|
|
926
|
+
* @param {object} params
|
|
927
|
+
* @returns {object} contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
|
928
|
+
*/
|
|
917
929
|
const market = this.markets[symbol];
|
|
918
930
|
let currency = undefined;
|
|
919
931
|
let cost = undefined;
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -3721,7 +3721,8 @@ class coinbase extends coinbase$1 {
|
|
|
3721
3721
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3722
3722
|
const version = api[0];
|
|
3723
3723
|
const signed = api[1] === 'private';
|
|
3724
|
-
const
|
|
3724
|
+
const isV3 = version === 'v3';
|
|
3725
|
+
const pathPart = (isV3) ? 'api/v3' : 'v2';
|
|
3725
3726
|
let fullPath = '/' + pathPart + '/' + this.implodeParams(path, params);
|
|
3726
3727
|
const query = this.omit(params, this.extractParams(path));
|
|
3727
3728
|
const savedPath = fullPath;
|
|
@@ -3765,8 +3766,17 @@ class coinbase extends coinbase$1 {
|
|
|
3765
3766
|
payload = body;
|
|
3766
3767
|
}
|
|
3767
3768
|
}
|
|
3768
|
-
|
|
3769
|
+
else {
|
|
3770
|
+
if (!isV3) {
|
|
3771
|
+
if (Object.keys(query).length) {
|
|
3772
|
+
payload += '?' + this.urlencode(query);
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
// v3: 'GET' doesn't need payload in the signature. inside url is enough
|
|
3769
3777
|
// https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
|
3778
|
+
// v2: 'GET' require payload in the signature
|
|
3779
|
+
// https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
|
|
3770
3780
|
const auth = timestampString + method + savedPath + payload;
|
|
3771
3781
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256);
|
|
3772
3782
|
headers = {
|
package/dist/cjs/src/delta.js
CHANGED
|
@@ -51,7 +51,8 @@ class delta extends delta$1 {
|
|
|
51
51
|
'fetchLedger': true,
|
|
52
52
|
'fetchLeverage': true,
|
|
53
53
|
'fetchLeverageTiers': false,
|
|
54
|
-
'fetchMarginMode':
|
|
54
|
+
'fetchMarginMode': true,
|
|
55
|
+
'fetchMarginModes': false,
|
|
55
56
|
'fetchMarketLeverageTiers': false,
|
|
56
57
|
'fetchMarkets': true,
|
|
57
58
|
'fetchMarkOHLCV': true,
|
|
@@ -3201,6 +3202,99 @@ class delta extends delta$1 {
|
|
|
3201
3202
|
const position = this.parsePosition(this.safeValue(response, 'result', {}));
|
|
3202
3203
|
return [position];
|
|
3203
3204
|
}
|
|
3205
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
3206
|
+
/**
|
|
3207
|
+
* @method
|
|
3208
|
+
* @name delta#fetchMarginMode
|
|
3209
|
+
* @description fetches the margin mode of a trading pair
|
|
3210
|
+
* @see https://docs.delta.exchange/#get-user
|
|
3211
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
3212
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3213
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
3214
|
+
*/
|
|
3215
|
+
await this.loadMarkets();
|
|
3216
|
+
let market = undefined;
|
|
3217
|
+
if (symbol !== undefined) {
|
|
3218
|
+
market = this.market(symbol);
|
|
3219
|
+
}
|
|
3220
|
+
const response = await this.privateGetProfile(params);
|
|
3221
|
+
//
|
|
3222
|
+
// {
|
|
3223
|
+
// "result": {
|
|
3224
|
+
// "is_password_set": true,
|
|
3225
|
+
// "kyc_expiry_date": null,
|
|
3226
|
+
// "phishing_code": "12345",
|
|
3227
|
+
// "preferences": {
|
|
3228
|
+
// "favorites": []
|
|
3229
|
+
// },
|
|
3230
|
+
// "is_kyc_provisioned": false,
|
|
3231
|
+
// "country": "Canada",
|
|
3232
|
+
// "margin_mode": "isolated",
|
|
3233
|
+
// "mfa_updated_at": "2023-07-19T01:04:43Z",
|
|
3234
|
+
// "last_name": "",
|
|
3235
|
+
// "oauth_apple_active": false,
|
|
3236
|
+
// "pf_index_symbol": null,
|
|
3237
|
+
// "proof_of_identity_status": "approved",
|
|
3238
|
+
// "dob": null,
|
|
3239
|
+
// "email": "abc_123@gmail.com",
|
|
3240
|
+
// "force_change_password": false,
|
|
3241
|
+
// "nick_name": "still-breeze-123",
|
|
3242
|
+
// "oauth_google_active": false,
|
|
3243
|
+
// "phone_verification_status": "verified",
|
|
3244
|
+
// "id": 12345678,
|
|
3245
|
+
// "last_seen": null,
|
|
3246
|
+
// "is_withdrawal_enabled": true,
|
|
3247
|
+
// "force_change_mfa": false,
|
|
3248
|
+
// "enable_bots": false,
|
|
3249
|
+
// "kyc_verified_on": null,
|
|
3250
|
+
// "created_at": "2023-07-19T01:02:32Z",
|
|
3251
|
+
// "withdrawal_blocked_till": null,
|
|
3252
|
+
// "proof_of_address_status": "approved",
|
|
3253
|
+
// "is_password_change_blocked": false,
|
|
3254
|
+
// "is_mfa_enabled": true,
|
|
3255
|
+
// "is_kyc_done": true,
|
|
3256
|
+
// "oauth": null,
|
|
3257
|
+
// "account_name": "Main",
|
|
3258
|
+
// "sub_account_permissions": null,
|
|
3259
|
+
// "phone_number": null,
|
|
3260
|
+
// "tracking_info": {
|
|
3261
|
+
// "ga_cid": "1234.4321",
|
|
3262
|
+
// "is_kyc_gtm_tracked": true,
|
|
3263
|
+
// "sub_account_config": {
|
|
3264
|
+
// "cross": 2,
|
|
3265
|
+
// "isolated": 2,
|
|
3266
|
+
// "portfolio": 2
|
|
3267
|
+
// }
|
|
3268
|
+
// },
|
|
3269
|
+
// "first_name": "",
|
|
3270
|
+
// "phone_verified_on": null,
|
|
3271
|
+
// "seen_intro": false,
|
|
3272
|
+
// "password_updated_at": null,
|
|
3273
|
+
// "is_login_enabled": true,
|
|
3274
|
+
// "registration_date": "2023-07-19T01:02:32Z",
|
|
3275
|
+
// "permissions": {},
|
|
3276
|
+
// "max_sub_accounts_limit": 2,
|
|
3277
|
+
// "country_calling_code": null,
|
|
3278
|
+
// "is_sub_account": false,
|
|
3279
|
+
// "is_kyc_refresh_required": false
|
|
3280
|
+
// },
|
|
3281
|
+
// "success": true
|
|
3282
|
+
// }
|
|
3283
|
+
//
|
|
3284
|
+
const result = this.safeDict(response, 'result', {});
|
|
3285
|
+
return this.parseMarginMode(result, market);
|
|
3286
|
+
}
|
|
3287
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
3288
|
+
let symbol = undefined;
|
|
3289
|
+
if (market !== undefined) {
|
|
3290
|
+
symbol = market['symbol'];
|
|
3291
|
+
}
|
|
3292
|
+
return {
|
|
3293
|
+
'info': marginMode,
|
|
3294
|
+
'symbol': symbol,
|
|
3295
|
+
'marginMode': this.safeString(marginMode, 'margin_mode'),
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3204
3298
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3205
3299
|
const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
|
|
3206
3300
|
let url = this.urls['api'][api] + requestPath;
|