MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_trading_fees

Method fetch_trading_fees

python/ccxt/binance.py:9295–9462  ·  view source on GitHub ↗

fetch the trading fees for multiple markets https://developers.binance.com/docs/wallet/asset/trade-fee https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2 https://developers.binance.com/docs/derivatives/coin-

(self, params={})

Source from the content-addressed store, hash-verified

9293 return self.parse_trading_fee(data, market)
9294
9295 def fetch_trading_fees(self, params={}) -> TradingFees:
9296 """
9297 fetch the trading fees for multiple markets
9298
9299 https://developers.binance.com/docs/wallet/asset/trade-fee
9300 https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
9301 https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information
9302 https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config
9303
9304 :param dict [params]: extra parameters specific to the exchange API endpoint
9305 :param str [params.subType]: "linear" or "inverse"
9306 :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/?id=fee-structure>` indexed by market symbols
9307 """
9308 self.load_markets()
9309 type = None
9310 type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
9311 subType = None
9312 subType, params = self.handle_sub_type_and_params('fetchTradingFees', None, params, 'linear')
9313 isSpotOrMargin = (type == 'spot') or (type == 'margin')
9314 isLinear = self.is_linear(type, subType)
9315 isInverse = self.is_inverse(type, subType)
9316 response = None
9317 if isSpotOrMargin:
9318 response = self.sapiGetAssetTradeFee(params)
9319 elif isLinear:
9320 response = self.fapiPrivateGetAccountConfig(params)
9321 elif isInverse:
9322 response = self.dapiPrivateGetAccount(params)
9323 #
9324 # sapi / spot
9325 #
9326 # [
9327 # {
9328 # "symbol": "ZRXBNB",
9329 # "makerCommission": "0.001",
9330 # "takerCommission": "0.001"
9331 # },
9332 # {
9333 # "symbol": "ZRXBTC",
9334 # "makerCommission": "0.001",
9335 # "takerCommission": "0.001"
9336 # },
9337 # ]
9338 #
9339 # fapi / future / linear
9340 #
9341 # {
9342 # "feeTier": 0, # account commisssion tier
9343 # "canTrade": True, # if can trade
9344 # "canDeposit": True, # if can transfer in asset
9345 # "canWithdraw": True, # if can transfer out asset
9346 # "updateTime": 0,
9347 # "totalInitialMargin": "0.00000000", # total initial margin required with current mark price(useless with isolated positions), only for USDT asset
9348 # "totalMaintMargin": "0.00000000", # total maintenance margin required, only for USDT asset
9349 # "totalWalletBalance": "23.72469206", # total wallet balance, only for USDT asset
9350 # "totalUnrealizedProfit": "0.00000000", # total unrealized profit, only for USDT asset
9351 # "totalMarginBalance": "23.72469206", # total margin balance, only for USDT asset
9352 # "totalPositionInitialMargin": "0.00000000", # initial margin required for positions with current mark price, only for USDT asset

Callers

nothing calls this directly

Calls 11

is_linearMethod · 0.95
is_inverseMethod · 0.95
sapiGetAssetTradeFeeMethod · 0.95
dapiPrivateGetAccountMethod · 0.95
parse_trading_feeMethod · 0.95
safe_integerMethod · 0.80
rangeFunction · 0.50
load_marketsMethod · 0.45

Tested by

no test coverage detected