ccxt 4.3.77 → 4.3.79
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.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +62 -40
- package/dist/cjs/src/binance.js +40 -70
- package/dist/cjs/src/bingx.js +0 -1
- package/dist/cjs/src/bitget.js +1 -0
- package/dist/cjs/src/bitteam.js +0 -1
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/kraken.js +10 -11
- package/dist/cjs/src/kuna.js +0 -1
- package/dist/cjs/src/pro/binance.js +17 -6
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/paradex.js +2 -0
- package/dist/cjs/src/pro/vertex.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/pro/woofipro.js +1 -1
- package/dist/cjs/src/vertex.js +7 -4
- package/dist/cjs/src/woo.js +4 -0
- package/dist/cjs/src/woofipro.js +4 -0
- package/dist/cjs/src/xt.js +0 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +62 -40
- package/js/src/binance.js +40 -70
- package/js/src/bingx.js +0 -1
- package/js/src/bitget.js +1 -0
- package/js/src/bitteam.js +0 -1
- package/js/src/gate.js +2 -2
- package/js/src/kraken.js +10 -11
- package/js/src/kuna.js +0 -1
- package/js/src/pro/binance.js +17 -6
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/paradex.js +2 -0
- package/js/src/pro/vertex.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/pro/woofipro.js +1 -1
- package/js/src/vertex.js +7 -4
- package/js/src/woo.js +4 -0
- package/js/src/woofipro.js +4 -0
- package/js/src/xt.js +0 -1
- package/package.json +1 -1
|
@@ -912,7 +912,7 @@ class woofipro extends woofipro$1 {
|
|
|
912
912
|
const client = this.client(url);
|
|
913
913
|
this.setPositionsCache(client, symbols);
|
|
914
914
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
915
|
-
const awaitPositionsSnapshot = this.
|
|
915
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
916
916
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
917
917
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
918
918
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/dist/cjs/src/vertex.js
CHANGED
|
@@ -665,6 +665,13 @@ class vertex extends vertex$1 {
|
|
|
665
665
|
let amount = undefined;
|
|
666
666
|
let side = undefined;
|
|
667
667
|
let fee = undefined;
|
|
668
|
+
const feeCost = this.convertFromX18(this.safeString(trade, 'fee'));
|
|
669
|
+
if (feeCost !== undefined) {
|
|
670
|
+
fee = {
|
|
671
|
+
'cost': feeCost,
|
|
672
|
+
'currency': undefined,
|
|
673
|
+
};
|
|
674
|
+
}
|
|
668
675
|
const id = this.safeString2(trade, 'trade_id', 'submission_idx');
|
|
669
676
|
const order = this.safeString(trade, 'digest');
|
|
670
677
|
const timestamp = this.safeTimestamp(trade, 'timestamp');
|
|
@@ -682,10 +689,6 @@ class vertex extends vertex$1 {
|
|
|
682
689
|
const subOrder = this.safeDict(trade, 'order', {});
|
|
683
690
|
price = this.convertFromX18(this.safeString(subOrder, 'priceX18'));
|
|
684
691
|
amount = this.convertFromX18(this.safeString(trade, 'base_filled'));
|
|
685
|
-
fee = {
|
|
686
|
-
'cost': this.convertFromX18(this.safeString(trade, 'fee')),
|
|
687
|
-
'currency': undefined,
|
|
688
|
-
};
|
|
689
692
|
if (Precise["default"].stringLt(amount, '0')) {
|
|
690
693
|
side = 'sell';
|
|
691
694
|
}
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -607,6 +607,10 @@ class woo extends woo$1 {
|
|
|
607
607
|
const amount = this.safeString(trade, 'executed_quantity');
|
|
608
608
|
const order_id = this.safeString(trade, 'order_id');
|
|
609
609
|
const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
|
|
610
|
+
const feeCost = this.safeString(fee, 'cost');
|
|
611
|
+
if (feeCost !== undefined) {
|
|
612
|
+
fee['cost'] = feeCost;
|
|
613
|
+
}
|
|
610
614
|
const cost = Precise["default"].stringMul(price, amount);
|
|
611
615
|
const side = this.safeStringLower(trade, 'side');
|
|
612
616
|
const id = this.safeString(trade, 'id');
|
package/dist/cjs/src/woofipro.js
CHANGED
|
@@ -680,6 +680,10 @@ class woofipro extends woofipro$1 {
|
|
|
680
680
|
const amount = this.safeString(trade, 'executed_quantity');
|
|
681
681
|
const order_id = this.safeString(trade, 'order_id');
|
|
682
682
|
const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
|
|
683
|
+
const feeCost = this.safeString(fee, 'cost');
|
|
684
|
+
if (feeCost !== undefined) {
|
|
685
|
+
fee['cost'] = feeCost;
|
|
686
|
+
}
|
|
683
687
|
const cost = Precise["default"].stringMul(price, amount);
|
|
684
688
|
const side = this.safeStringLower(trade, 'side');
|
|
685
689
|
const id = this.safeString(trade, 'id');
|
package/dist/cjs/src/xt.js
CHANGED
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.78";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.79';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -844,6 +844,8 @@ export default class Exchange {
|
|
|
844
844
|
};
|
|
845
845
|
safeLiquidation(liquidation: Dict, market?: Market): Liquidation;
|
|
846
846
|
safeTrade(trade: Dict, market?: Market): Trade;
|
|
847
|
+
parsedFeeAndFees(container: any): Dictionary<any>[];
|
|
848
|
+
parseFeeNumeric(fee: any): any;
|
|
847
849
|
findNearestCeiling(arr: number[], providedValue: number): number;
|
|
848
850
|
invertFlatStringDictionary(dict: any): {};
|
|
849
851
|
reduceFeesByCurrency(fees: any): any[];
|
|
@@ -1144,7 +1146,7 @@ export default class Exchange {
|
|
|
1144
1146
|
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position>;
|
|
1145
1147
|
fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
1146
1148
|
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
1147
|
-
parseMarginModifications(response: object[], symbols?:
|
|
1149
|
+
parseMarginModifications(response: object[], symbols?: Strings, symbolKey?: Str, marketType?: MarketType): MarginModification[];
|
|
1148
1150
|
fetchTransfer(id: string, code?: Str, params?: {}): Promise<TransferEntry>;
|
|
1149
1151
|
fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
|
|
1150
1152
|
}
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -2970,48 +2970,61 @@ export default class Exchange {
|
|
|
2970
2970
|
}
|
|
2971
2971
|
cost = Precise.stringMul(multiplyPrice, amount);
|
|
2972
2972
|
}
|
|
2973
|
-
const
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2973
|
+
const [resultFee, resultFees] = this.parsedFeeAndFees(trade);
|
|
2974
|
+
trade['fee'] = resultFee;
|
|
2975
|
+
trade['fees'] = resultFees;
|
|
2976
|
+
trade['amount'] = this.parseNumber(amount);
|
|
2977
|
+
trade['price'] = this.parseNumber(price);
|
|
2978
|
+
trade['cost'] = this.parseNumber(cost);
|
|
2979
|
+
return trade;
|
|
2980
|
+
}
|
|
2981
|
+
parsedFeeAndFees(container) {
|
|
2982
|
+
let fee = this.safeDict(container, 'fee');
|
|
2983
|
+
let fees = this.safeList(container, 'fees');
|
|
2984
|
+
const feeDefined = fee !== undefined;
|
|
2985
|
+
const feesDefined = fees !== undefined;
|
|
2986
|
+
// parsing only if at least one of them is defined
|
|
2987
|
+
const shouldParseFees = (feeDefined || feesDefined);
|
|
2978
2988
|
if (shouldParseFees) {
|
|
2989
|
+
if (feeDefined) {
|
|
2990
|
+
fee = this.parseFeeNumeric(fee);
|
|
2991
|
+
}
|
|
2992
|
+
if (!feesDefined) {
|
|
2993
|
+
// just set it directly, no further processing needed
|
|
2994
|
+
fees = [fee];
|
|
2995
|
+
}
|
|
2996
|
+
// 'fees' were set, so reparse them
|
|
2979
2997
|
const reducedFees = this.reduceFees ? this.reduceFeesByCurrency(fees) : fees;
|
|
2980
2998
|
const reducedLength = reducedFees.length;
|
|
2981
2999
|
for (let i = 0; i < reducedLength; i++) {
|
|
2982
|
-
reducedFees[i]
|
|
2983
|
-
if ('rate' in reducedFees[i]) {
|
|
2984
|
-
reducedFees[i]['rate'] = this.safeNumber(reducedFees[i], 'rate');
|
|
2985
|
-
}
|
|
3000
|
+
reducedFees[i] = this.parseFeeNumeric(reducedFees[i]);
|
|
2986
3001
|
}
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
feeCopy['cost'] = this.safeNumber(feeCopy, 'cost');
|
|
2991
|
-
if ('rate' in feeCopy) {
|
|
2992
|
-
feeCopy['rate'] = this.safeNumber(feeCopy, 'rate');
|
|
2993
|
-
}
|
|
2994
|
-
reducedFees.push(feeCopy);
|
|
2995
|
-
}
|
|
2996
|
-
if (parseFees) {
|
|
2997
|
-
trade['fees'] = reducedFees;
|
|
3002
|
+
fees = reducedFees;
|
|
3003
|
+
if (reducedLength === 1) {
|
|
3004
|
+
fee = reducedFees[0];
|
|
2998
3005
|
}
|
|
2999
|
-
if (
|
|
3000
|
-
|
|
3001
|
-
}
|
|
3002
|
-
const tradeFee = this.safeValue(trade, 'fee');
|
|
3003
|
-
if (tradeFee !== undefined) {
|
|
3004
|
-
tradeFee['cost'] = this.safeNumber(tradeFee, 'cost');
|
|
3005
|
-
if ('rate' in tradeFee) {
|
|
3006
|
-
tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
|
|
3007
|
-
}
|
|
3008
|
-
trade['fee'] = tradeFee;
|
|
3006
|
+
else if (reducedLength === 0) {
|
|
3007
|
+
fee = undefined;
|
|
3009
3008
|
}
|
|
3010
3009
|
}
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3010
|
+
// in case `fee & fees` are undefined, set `fees` as empty array
|
|
3011
|
+
if (fee === undefined) {
|
|
3012
|
+
fee = {
|
|
3013
|
+
'cost': undefined,
|
|
3014
|
+
'currency': undefined,
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
if (fees === undefined) {
|
|
3018
|
+
fees = [];
|
|
3019
|
+
}
|
|
3020
|
+
return [fee, fees];
|
|
3021
|
+
}
|
|
3022
|
+
parseFeeNumeric(fee) {
|
|
3023
|
+
fee['cost'] = this.safeNumber(fee, 'cost'); // ensure numeric
|
|
3024
|
+
if ('rate' in fee) {
|
|
3025
|
+
fee['rate'] = this.safeNumber(fee, 'rate');
|
|
3026
|
+
}
|
|
3027
|
+
return fee;
|
|
3015
3028
|
}
|
|
3016
3029
|
findNearestCeiling(arr, providedValue) {
|
|
3017
3030
|
// i.e. findNearestCeiling ([ 10, 30, 50], 23) returns 30
|
|
@@ -3085,12 +3098,13 @@ export default class Exchange {
|
|
|
3085
3098
|
const reduced = {};
|
|
3086
3099
|
for (let i = 0; i < fees.length; i++) {
|
|
3087
3100
|
const fee = fees[i];
|
|
3088
|
-
const
|
|
3101
|
+
const code = this.safeString(fee, 'currency');
|
|
3102
|
+
const feeCurrencyCode = code !== undefined ? code : i.toString();
|
|
3089
3103
|
if (feeCurrencyCode !== undefined) {
|
|
3090
3104
|
const rate = this.safeString(fee, 'rate');
|
|
3091
|
-
const cost = this.
|
|
3092
|
-
if (
|
|
3093
|
-
// omit
|
|
3105
|
+
const cost = this.safeString(fee, 'cost');
|
|
3106
|
+
if (cost === undefined) {
|
|
3107
|
+
// omit undefined cost, as it does not make sense, however, don't omit '0' costs, as they still make sense
|
|
3094
3108
|
continue;
|
|
3095
3109
|
}
|
|
3096
3110
|
if (!(feeCurrencyCode in reduced)) {
|
|
@@ -3102,7 +3116,7 @@ export default class Exchange {
|
|
|
3102
3116
|
}
|
|
3103
3117
|
else {
|
|
3104
3118
|
reduced[feeCurrencyCode][rateKey] = {
|
|
3105
|
-
'currency':
|
|
3119
|
+
'currency': code,
|
|
3106
3120
|
'cost': cost,
|
|
3107
3121
|
};
|
|
3108
3122
|
if (rate !== undefined) {
|
|
@@ -3143,7 +3157,15 @@ export default class Exchange {
|
|
|
3143
3157
|
change = Precise.stringSub(last, open);
|
|
3144
3158
|
}
|
|
3145
3159
|
if (average === undefined) {
|
|
3146
|
-
|
|
3160
|
+
let precision = 18;
|
|
3161
|
+
if (market !== undefined && this.isTickPrecision()) {
|
|
3162
|
+
const marketPrecision = this.safeDict(market, 'precision');
|
|
3163
|
+
const precisionPrice = this.safeString(marketPrecision, 'price');
|
|
3164
|
+
if (precisionPrice !== undefined) {
|
|
3165
|
+
precision = this.precisionFromString(precisionPrice);
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
average = Precise.stringDiv(Precise.stringAdd(last, open), '2', precision);
|
|
3147
3169
|
}
|
|
3148
3170
|
}
|
|
3149
3171
|
if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && Precise.stringGt(open, '0')) {
|
package/js/src/binance.js
CHANGED
|
@@ -3556,7 +3556,7 @@ export default class binance extends Exchange {
|
|
|
3556
3556
|
//
|
|
3557
3557
|
// futures (fapi)
|
|
3558
3558
|
//
|
|
3559
|
-
//
|
|
3559
|
+
// fapiPrivateV3GetAccount
|
|
3560
3560
|
//
|
|
3561
3561
|
// {
|
|
3562
3562
|
// "feeTier":0,
|
|
@@ -9000,6 +9000,7 @@ export default class binance extends Exchange {
|
|
|
9000
9000
|
* @see https://developers.binance.com/docs/wallet/asset/trade-fee
|
|
9001
9001
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
|
|
9002
9002
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
9003
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config
|
|
9003
9004
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9004
9005
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
9005
9006
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
@@ -9017,7 +9018,7 @@ export default class binance extends Exchange {
|
|
|
9017
9018
|
response = await this.sapiGetAssetTradeFee(params);
|
|
9018
9019
|
}
|
|
9019
9020
|
else if (isLinear) {
|
|
9020
|
-
response = await this.
|
|
9021
|
+
response = await this.fapiPrivateGetAccountConfig(params);
|
|
9021
9022
|
}
|
|
9022
9023
|
else if (isInverse) {
|
|
9023
9024
|
response = await this.dapiPrivateGetAccount(params);
|
|
@@ -10322,6 +10323,7 @@ export default class binance extends Exchange {
|
|
|
10322
10323
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
10323
10324
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V2
|
|
10324
10325
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Position-Information
|
|
10326
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V3
|
|
10325
10327
|
* @param {string[]} [symbols] list of unified market symbols
|
|
10326
10328
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10327
10329
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
|
|
@@ -10453,6 +10455,7 @@ export default class binance extends Exchange {
|
|
|
10453
10455
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Position-Information
|
|
10454
10456
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-UM-Position-Information
|
|
10455
10457
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-CM-Position-Information
|
|
10458
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V3
|
|
10456
10459
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
10457
10460
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10458
10461
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
|
|
@@ -10870,6 +10873,7 @@ export default class binance extends Exchange {
|
|
|
10870
10873
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
10871
10874
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail
|
|
10872
10875
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Account-Detail
|
|
10876
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
|
|
10873
10877
|
* @param {string[]} [symbols] a list of unified market symbols
|
|
10874
10878
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10875
10879
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
@@ -10889,7 +10893,7 @@ export default class binance extends Exchange {
|
|
|
10889
10893
|
response = await this.papiGetUmAccount(params);
|
|
10890
10894
|
}
|
|
10891
10895
|
else {
|
|
10892
|
-
response = await this.
|
|
10896
|
+
response = await this.fapiPrivateGetSymbolConfig(params);
|
|
10893
10897
|
}
|
|
10894
10898
|
}
|
|
10895
10899
|
else if (this.isInverse(type, subType)) {
|
|
@@ -10903,7 +10907,10 @@ export default class binance extends Exchange {
|
|
|
10903
10907
|
else {
|
|
10904
10908
|
throw new NotSupported(this.id + ' fetchLeverages() supports linear and inverse contracts only');
|
|
10905
10909
|
}
|
|
10906
|
-
|
|
10910
|
+
let leverages = this.safeList(response, 'positions', []);
|
|
10911
|
+
if (Array.isArray(response)) {
|
|
10912
|
+
leverages = response;
|
|
10913
|
+
}
|
|
10907
10914
|
return this.parseLeverages(leverages, symbols, 'symbol');
|
|
10908
10915
|
}
|
|
10909
10916
|
parseLeverage(leverage, market = undefined) {
|
|
@@ -10913,6 +10920,10 @@ export default class binance extends Exchange {
|
|
|
10913
10920
|
if (marginModeRaw !== undefined) {
|
|
10914
10921
|
marginMode = marginModeRaw ? 'isolated' : 'cross';
|
|
10915
10922
|
}
|
|
10923
|
+
const marginTypeRaw = this.safeStringLower(leverage, 'marginType');
|
|
10924
|
+
if (marginTypeRaw !== undefined) {
|
|
10925
|
+
marginMode = (marginTypeRaw === 'crossed') ? 'cross' : 'isolated';
|
|
10926
|
+
}
|
|
10916
10927
|
const side = this.safeStringLower(leverage, 'positionSide');
|
|
10917
10928
|
let longLeverage = undefined;
|
|
10918
10929
|
let shortLeverage = undefined;
|
|
@@ -12792,6 +12803,7 @@ export default class binance extends Exchange {
|
|
|
12792
12803
|
* @description fetches margin modes ("isolated" or "cross") that the market for the symbol in in, with symbol=undefined all markets for a subType (linear/inverse) are returned
|
|
12793
12804
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
12794
12805
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
|
|
12806
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
|
|
12795
12807
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
12796
12808
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12797
12809
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
@@ -12807,70 +12819,17 @@ export default class binance extends Exchange {
|
|
|
12807
12819
|
[subType, params] = this.handleSubTypeAndParams('fetchMarginMode', market, params);
|
|
12808
12820
|
let response = undefined;
|
|
12809
12821
|
if (subType === 'linear') {
|
|
12810
|
-
response = await this.
|
|
12822
|
+
response = await this.fapiPrivateGetSymbolConfig(params);
|
|
12811
12823
|
//
|
|
12812
|
-
//
|
|
12813
|
-
//
|
|
12814
|
-
//
|
|
12815
|
-
//
|
|
12816
|
-
//
|
|
12817
|
-
//
|
|
12818
|
-
//
|
|
12819
|
-
//
|
|
12820
|
-
//
|
|
12821
|
-
// totalMaintMargin: '5.90847101',
|
|
12822
|
-
// totalWalletBalance: '4345.15626338',
|
|
12823
|
-
// totalUnrealizedProfit: '376.45220224',
|
|
12824
|
-
// totalMarginBalance: '4721.60846562',
|
|
12825
|
-
// totalPositionInitialMargin: '425.45252687',
|
|
12826
|
-
// totalOpenOrderInitialMargin: '12.85881664',
|
|
12827
|
-
// totalCrossWalletBalance: '4345.15626338',
|
|
12828
|
-
// totalCrossUnPnl: '376.45220224',
|
|
12829
|
-
// availableBalance: '4281.84764041',
|
|
12830
|
-
// maxWithdrawAmount: '4281.84764041',
|
|
12831
|
-
// assets: [
|
|
12832
|
-
// {
|
|
12833
|
-
// asset: 'ETH',
|
|
12834
|
-
// walletBalance: '0.00000000',
|
|
12835
|
-
// unrealizedProfit: '0.00000000',
|
|
12836
|
-
// marginBalance: '0.00000000',
|
|
12837
|
-
// maintMargin: '0.00000000',
|
|
12838
|
-
// initialMargin: '0.00000000',
|
|
12839
|
-
// positionInitialMargin: '0.00000000',
|
|
12840
|
-
// openOrderInitialMargin: '0.00000000',
|
|
12841
|
-
// maxWithdrawAmount: '0.00000000',
|
|
12842
|
-
// crossWalletBalance: '0.00000000',
|
|
12843
|
-
// crossUnPnl: '0.00000000',
|
|
12844
|
-
// availableBalance: '1.26075574',
|
|
12845
|
-
// marginAvailable: true,
|
|
12846
|
-
// updateTime: '0'
|
|
12847
|
-
// },
|
|
12848
|
-
// ...
|
|
12849
|
-
// ],
|
|
12850
|
-
// positions: [
|
|
12851
|
-
// {
|
|
12852
|
-
// symbol: 'SNTUSDT',
|
|
12853
|
-
// initialMargin: '0',
|
|
12854
|
-
// maintMargin: '0',
|
|
12855
|
-
// unrealizedProfit: '0.00000000',
|
|
12856
|
-
// positionInitialMargin: '0',
|
|
12857
|
-
// openOrderInitialMargin: '0',
|
|
12858
|
-
// leverage: '20',
|
|
12859
|
-
// isolated: false,
|
|
12860
|
-
// entryPrice: '0.0',
|
|
12861
|
-
// breakEvenPrice: '0.0',
|
|
12862
|
-
// maxNotional: '25000',
|
|
12863
|
-
// positionSide: 'BOTH',
|
|
12864
|
-
// positionAmt: '0',
|
|
12865
|
-
// notional: '0',
|
|
12866
|
-
// isolatedWallet: '0',
|
|
12867
|
-
// updateTime: '0',
|
|
12868
|
-
// bidNotional: '0',
|
|
12869
|
-
// askNotional: '0'
|
|
12870
|
-
// },
|
|
12871
|
-
// ...
|
|
12872
|
-
// ]
|
|
12873
|
-
// }
|
|
12824
|
+
// [
|
|
12825
|
+
// {
|
|
12826
|
+
// "symbol": "BTCUSDT",
|
|
12827
|
+
// "marginType": "CROSSED",
|
|
12828
|
+
// "isAutoAddMargin": "false",
|
|
12829
|
+
// "leverage": 21,
|
|
12830
|
+
// "maxNotionalValue": "1000000",
|
|
12831
|
+
// }
|
|
12832
|
+
// ]
|
|
12874
12833
|
//
|
|
12875
12834
|
}
|
|
12876
12835
|
else if (subType === 'inverse') {
|
|
@@ -12927,17 +12886,28 @@ export default class binance extends Exchange {
|
|
|
12927
12886
|
else {
|
|
12928
12887
|
throw new BadRequest(this.id + ' fetchMarginModes () supports linear and inverse subTypes only');
|
|
12929
12888
|
}
|
|
12930
|
-
|
|
12889
|
+
let assets = this.safeList(response, 'positions', []);
|
|
12890
|
+
if (Array.isArray(response)) {
|
|
12891
|
+
assets = response;
|
|
12892
|
+
}
|
|
12931
12893
|
return this.parseMarginModes(assets, symbols, 'symbol', 'swap');
|
|
12932
12894
|
}
|
|
12933
12895
|
parseMarginMode(marginMode, market = undefined) {
|
|
12934
12896
|
const marketId = this.safeString(marginMode, 'symbol');
|
|
12935
12897
|
market = this.safeMarket(marketId, market);
|
|
12936
|
-
const
|
|
12898
|
+
const marginModeRaw = this.safeBool(marginMode, 'isolated');
|
|
12899
|
+
let reMarginMode = undefined;
|
|
12900
|
+
if (marginModeRaw !== undefined) {
|
|
12901
|
+
reMarginMode = marginModeRaw ? 'isolated' : 'cross';
|
|
12902
|
+
}
|
|
12903
|
+
const marginTypeRaw = this.safeStringLower(marginMode, 'marginType');
|
|
12904
|
+
if (marginTypeRaw !== undefined) {
|
|
12905
|
+
reMarginMode = (marginTypeRaw === 'crossed') ? 'cross' : 'isolated';
|
|
12906
|
+
}
|
|
12937
12907
|
return {
|
|
12938
12908
|
'info': marginMode,
|
|
12939
12909
|
'symbol': market['symbol'],
|
|
12940
|
-
'marginMode':
|
|
12910
|
+
'marginMode': reMarginMode,
|
|
12941
12911
|
};
|
|
12942
12912
|
}
|
|
12943
12913
|
async fetchOption(symbol, params = {}) {
|
package/js/src/bingx.js
CHANGED
package/js/src/bitget.js
CHANGED
package/js/src/bitteam.js
CHANGED
|
@@ -1940,7 +1940,6 @@ export default class bitteam extends Exchange {
|
|
|
1940
1940
|
const fee = {
|
|
1941
1941
|
'currency': this.safeCurrencyCode(feeCurrencyId),
|
|
1942
1942
|
'cost': feeCost,
|
|
1943
|
-
'rate': undefined,
|
|
1944
1943
|
};
|
|
1945
1944
|
const intTs = this.parseToInt(timestamp);
|
|
1946
1945
|
return this.safeTrade({
|
package/js/src/gate.js
CHANGED
|
@@ -3470,8 +3470,8 @@ export default class gate extends Exchange {
|
|
|
3470
3470
|
const side = this.safeString2(trade, 'side', 'type', contractSide);
|
|
3471
3471
|
const orderId = this.safeString(trade, 'order_id');
|
|
3472
3472
|
const feeAmount = this.safeString(trade, 'fee');
|
|
3473
|
-
const gtFee = this.safeString(trade, 'gt_fee');
|
|
3474
|
-
const pointFee = this.safeString(trade, 'point_fee');
|
|
3473
|
+
const gtFee = this.omitZero(this.safeString(trade, 'gt_fee'));
|
|
3474
|
+
const pointFee = this.omitZero(this.safeString(trade, 'point_fee'));
|
|
3475
3475
|
const fees = [];
|
|
3476
3476
|
if (feeAmount !== undefined) {
|
|
3477
3477
|
const feeCurrencyId = this.safeString(trade, 'fee_currency');
|
package/js/src/kraken.js
CHANGED
|
@@ -1385,7 +1385,7 @@ export default class kraken extends Exchange {
|
|
|
1385
1385
|
* @method
|
|
1386
1386
|
* @name kraken#createMarketOrderWithCost
|
|
1387
1387
|
* @description create a market order by providing the symbol, side and cost
|
|
1388
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
|
|
1388
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
|
|
1389
1389
|
* @param {string} symbol unified symbol of the market to create an order in (only USD markets are supported)
|
|
1390
1390
|
* @param {string} side 'buy' or 'sell'
|
|
1391
1391
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
@@ -1402,7 +1402,7 @@ export default class kraken extends Exchange {
|
|
|
1402
1402
|
* @method
|
|
1403
1403
|
* @name kraken#createMarketBuyOrderWithCost
|
|
1404
1404
|
* @description create a market buy order by providing the symbol, side and cost
|
|
1405
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
|
|
1405
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
|
|
1406
1406
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1407
1407
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1408
1408
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1415,7 +1415,7 @@ export default class kraken extends Exchange {
|
|
|
1415
1415
|
/**
|
|
1416
1416
|
* @method
|
|
1417
1417
|
* @name kraken#createOrder
|
|
1418
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
|
|
1418
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
|
|
1419
1419
|
* @description create a trade order
|
|
1420
1420
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1421
1421
|
* @param {string} type 'market' or 'limit'
|
|
@@ -1554,6 +1554,8 @@ export default class kraken extends Exchange {
|
|
|
1554
1554
|
// "status": "ok",
|
|
1555
1555
|
// "txid": "OAW2BO-7RWEK-PZY5UO",
|
|
1556
1556
|
// "originaltxid": "OXL6SS-UPNMC-26WBE7",
|
|
1557
|
+
// "newuserref": 1234,
|
|
1558
|
+
// "olduserref": 123,
|
|
1557
1559
|
// "volume": "0.00075000",
|
|
1558
1560
|
// "price": "13500.0",
|
|
1559
1561
|
// "orders_cancelled": 1,
|
|
@@ -1697,7 +1699,7 @@ export default class kraken extends Exchange {
|
|
|
1697
1699
|
const txid = this.safeList(order, 'txid');
|
|
1698
1700
|
id = this.safeString(txid, 0);
|
|
1699
1701
|
}
|
|
1700
|
-
const clientOrderId = this.
|
|
1702
|
+
const clientOrderId = this.safeString2(order, 'userref', 'newuserref');
|
|
1701
1703
|
const rawTrades = this.safeValue(order, 'trades', []);
|
|
1702
1704
|
const trades = [];
|
|
1703
1705
|
for (let i = 0; i < rawTrades.length; i++) {
|
|
@@ -1853,7 +1855,7 @@ export default class kraken extends Exchange {
|
|
|
1853
1855
|
const extendedPostFlags = (flags !== undefined) ? flags + ',post' : 'post';
|
|
1854
1856
|
request['oflags'] = extendedPostFlags;
|
|
1855
1857
|
}
|
|
1856
|
-
if ((flags !== undefined) && (
|
|
1858
|
+
if ((flags !== undefined) && !('oflags' in request)) {
|
|
1857
1859
|
request['oflags'] = flags;
|
|
1858
1860
|
}
|
|
1859
1861
|
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
|
|
@@ -1864,7 +1866,7 @@ export default class kraken extends Exchange {
|
|
|
1864
1866
|
* @method
|
|
1865
1867
|
* @name kraken#editOrder
|
|
1866
1868
|
* @description edit a trade order
|
|
1867
|
-
* @see https://docs.kraken.com/rest/#tag/Trading/operation/editOrder
|
|
1869
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/editOrder
|
|
1868
1870
|
* @param {string} id order id
|
|
1869
1871
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1870
1872
|
* @param {string} type 'market' or 'limit'
|
|
@@ -1926,8 +1928,8 @@ export default class kraken extends Exchange {
|
|
|
1926
1928
|
await this.loadMarkets();
|
|
1927
1929
|
const clientOrderId = this.safeValue2(params, 'userref', 'clientOrderId');
|
|
1928
1930
|
const request = {
|
|
1929
|
-
'trades': true,
|
|
1930
|
-
|
|
1931
|
+
'trades': true,
|
|
1932
|
+
'txid': id, // do not comma separate a list of ids - use fetchOrdersByIds instead
|
|
1931
1933
|
// 'userref': 'optional', // restrict results to given user reference id (optional)
|
|
1932
1934
|
};
|
|
1933
1935
|
let query = params;
|
|
@@ -1935,9 +1937,6 @@ export default class kraken extends Exchange {
|
|
|
1935
1937
|
request['userref'] = clientOrderId;
|
|
1936
1938
|
query = this.omit(params, ['userref', 'clientOrderId']);
|
|
1937
1939
|
}
|
|
1938
|
-
else {
|
|
1939
|
-
request['txid'] = id;
|
|
1940
|
-
}
|
|
1941
1940
|
const response = await this.privatePostQueryOrders(this.extend(request, query));
|
|
1942
1941
|
//
|
|
1943
1942
|
// {
|
package/js/src/kuna.js
CHANGED