Merge pull request #3596 from freqtrade/fix/0fee

Allow 0 fee value by correctly checking for None
This commit is contained in:
hroff-1902 2020-07-15 20:52:32 +03:00 committed by GitHub
commit 18a5822a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -101,7 +101,7 @@ class Backtesting:
if len(self.pairlists.whitelist) == 0: if len(self.pairlists.whitelist) == 0:
raise OperationalException("No pair in whitelist.") raise OperationalException("No pair in whitelist.")
if config.get('fee'): if config.get('fee', None) is not None:
self.fee = config['fee'] self.fee = config['fee']
else: else:
self.fee = self.exchange.get_fee(symbol=self.pairlists.whitelist[0]) self.fee = self.exchange.get_fee(symbol=self.pairlists.whitelist[0])

View File

@ -308,6 +308,11 @@ def test_data_with_fee(default_conf, mocker, testdatadir) -> None:
assert backtesting.fee == 0.1234 assert backtesting.fee == 0.1234
assert fee_mock.call_count == 0 assert fee_mock.call_count == 0
default_conf['fee'] = 0.0
backtesting = Backtesting(default_conf)
assert backtesting.fee == 0.0
assert fee_mock.call_count == 0
def test_data_to_dataframe_bt(default_conf, mocker, testdatadir) -> None: def test_data_to_dataframe_bt(default_conf, mocker, testdatadir) -> None:
patch_exchange(mocker) patch_exchange(mocker)