Update trading_fee naming
This commit is contained in:
parent
9b8a2435f8
commit
f5578aba48
@ -93,6 +93,7 @@ class Exchange:
|
|||||||
self._api: ccxt.Exchange = None
|
self._api: ccxt.Exchange = None
|
||||||
self._api_async: ccxt_async.Exchange = None
|
self._api_async: ccxt_async.Exchange = None
|
||||||
self._markets: Dict = {}
|
self._markets: Dict = {}
|
||||||
|
self._trading_fees: Dict[str, Any] = {}
|
||||||
self._leverage_tiers: Dict[str, List[Dict]] = {}
|
self._leverage_tiers: Dict[str, List[Dict]] = {}
|
||||||
self.loop = asyncio.new_event_loop()
|
self.loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(self.loop)
|
asyncio.set_event_loop(self.loop)
|
||||||
@ -453,7 +454,7 @@ class Exchange:
|
|||||||
self._load_async_markets()
|
self._load_async_markets()
|
||||||
self._last_markets_refresh = arrow.utcnow().int_timestamp
|
self._last_markets_refresh = arrow.utcnow().int_timestamp
|
||||||
if self._ft_has['needs_trading_fees']:
|
if self._ft_has['needs_trading_fees']:
|
||||||
self.trading_fees = self.fetch_trading_fees()
|
self._trading_fees = self.fetch_trading_fees()
|
||||||
|
|
||||||
except ccxt.BaseError:
|
except ccxt.BaseError:
|
||||||
logger.exception('Unable to initialize markets.')
|
logger.exception('Unable to initialize markets.')
|
||||||
|
@ -57,7 +57,7 @@ class Gateio(Exchange):
|
|||||||
# An alternative also contianing fees would be
|
# An alternative also contianing fees would be
|
||||||
# privateFuturesGetSettleAccountBook({"settle": "usdt"})
|
# privateFuturesGetSettleAccountBook({"settle": "usdt"})
|
||||||
|
|
||||||
pair_fees = self.trading_fees.get(pair, {})
|
pair_fees = self._trading_fees.get(pair, {})
|
||||||
if pair_fees and pair_fees['taker'] is not None:
|
if pair_fees and pair_fees['taker'] is not None:
|
||||||
order['fee'] = {
|
order['fee'] = {
|
||||||
'currency': self.get_pair_quote_currency(pair),
|
'currency': self.get_pair_quote_currency(pair),
|
||||||
|
@ -1664,8 +1664,8 @@ def test_fetch_trading_fees(default_conf, mocker):
|
|||||||
mocker.patch('freqtrade.exchange.Exchange.exchange_has', return_value=True)
|
mocker.patch('freqtrade.exchange.Exchange.exchange_has', return_value=True)
|
||||||
exchange = get_patched_exchange(mocker, default_conf, api_mock, id=exchange_name)
|
exchange = get_patched_exchange(mocker, default_conf, api_mock, id=exchange_name)
|
||||||
|
|
||||||
assert '1INCH/USDT:USDT' in exchange.trading_fees
|
assert '1INCH/USDT:USDT' in exchange._trading_fees
|
||||||
assert 'ETH/USDT:USDT' in exchange.trading_fees
|
assert 'ETH/USDT:USDT' in exchange._trading_fees
|
||||||
assert api_mock.fetch_trading_fees.call_count == 1
|
assert api_mock.fetch_trading_fees.call_count == 1
|
||||||
|
|
||||||
api_mock.fetch_trading_fees.reset_mock()
|
api_mock.fetch_trading_fees.reset_mock()
|
||||||
|
@ -101,7 +101,7 @@ def test_fetch_order_gateio(mocker, default_conf):
|
|||||||
'amount': 1, # 1 contract
|
'amount': 1, # 1 contract
|
||||||
})
|
})
|
||||||
exchange = get_patched_exchange(mocker, default_conf, api_mock=api_mock, id='gateio')
|
exchange = get_patched_exchange(mocker, default_conf, api_mock=api_mock, id='gateio')
|
||||||
exchange.trading_fees = tick
|
exchange._trading_fees = tick
|
||||||
order = exchange.fetch_order('22255', 'ETH/USDT:USDT')
|
order = exchange.fetch_order('22255', 'ETH/USDT:USDT')
|
||||||
|
|
||||||
assert order['fee']
|
assert order['fee']
|
||||||
|
Loading…
Reference in New Issue
Block a user