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

Method fetch_trading_fee

python/ccxt/upbit.py:953–1017  ·  view source on GitHub ↗

https://docs.upbit.com/kr/reference/available-order-information https://global-docs.upbit.com/reference/available-order-information fetch the trading fees for a market :param str symbol: unified market symbol :param dict [params]: extra parameters specific

(self, symbol: str, params={})

Source from the content-addressed store, hash-verified

951 return self.parse_trades(response, market, since, limit)
952
953 def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
954 """
955
956 https://docs.upbit.com/kr/reference/available-order-information
957 https://global-docs.upbit.com/reference/available-order-information
958
959 fetch the trading fees for a market
960 :param str symbol: unified market symbol
961 :param dict [params]: extra parameters specific to the exchange API endpoint
962 :returns dict: a `fee structure <https://docs.ccxt.com/?id=fee-structure>`
963 """
964 self.load_markets()
965 market = self.market(symbol)
966 request = {
967 'market': market['id'],
968 }
969 response = self.privateGetOrdersChance(self.extend(request, params))
970 #
971 # {
972 # "bid_fee": "0.0005",
973 # "ask_fee": "0.0005",
974 # "maker_bid_fee": "0.0005",
975 # "maker_ask_fee": "0.0005",
976 # "market": {
977 # "id": "KRW-BTC",
978 # "name": "BTC/KRW",
979 # "order_types": ["limit"],
980 # "order_sides": ["ask", "bid"],
981 # "bid": {"currency": "KRW", "price_unit": null, "min_total": 5000},
982 # "ask": {"currency": "BTC", "price_unit": null, "min_total": 5000},
983 # "max_total": "1000000000.0",
984 # "state": "active"
985 # },
986 # "bid_account": {
987 # "currency": "KRW",
988 # "balance": "0.34202415",
989 # "locked": "4999.99999922",
990 # "avg_buy_price": "0",
991 # "avg_buy_price_modified": True,
992 # "unit_currency": "KRW"
993 # },
994 # "ask_account": {
995 # "currency": "BTC",
996 # "balance": "0.00048",
997 # "locked": "0.0",
998 # "avg_buy_price": "20870000",
999 # "avg_buy_price_modified": False,
1000 # "unit_currency": "KRW"
1001 # }
1002 # }
1003 #
1004 askFee = self.safe_string(response, 'ask_fee')
1005 bidFee = self.safe_string(response, 'bid_fee')
1006 taker = Precise.string_max(askFee, bidFee)
1007 makerAskFee = self.safe_string(response, 'maker_ask_fee')
1008 makerBidFee = self.safe_string(response, 'maker_bid_fee')
1009 maker = Precise.string_max(makerAskFee, makerBidFee)
1010 return {

Callers

nothing calls this directly

Calls 7

safe_stringMethod · 0.80
string_maxMethod · 0.80
parse_numberMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected