Don't hardcode fee, but use fee from the very first iteration.

This commit is contained in:
Matthias
2023-08-09 18:36:09 +02:00
parent 25602ceac3
commit 4a62ebbf93
2 changed files with 7 additions and 5 deletions

View File

@@ -48,6 +48,7 @@ class LookaheadAnalysis:
self.entry_varHolders: List[VarHolder] = []
self.exit_varHolders: List[VarHolder] = []
self.exchange: Optional[Any] = None
self._fee = None
# pull variables the scope of the lookahead_analysis-instance
self.local_config = deepcopy(config)
@@ -145,8 +146,13 @@ class LookaheadAnalysis:
str(self.dt_to_timestamp(varholder.to_dt)))
prepare_data_config['exchange']['pair_whitelist'] = pairs_to_load
if self._fee:
# Don't re-calculate fee per pair, as fee might differ per pair.
prepare_data_config['fee'] = self._fee
backtesting = Backtesting(prepare_data_config, self.exchange)
self.exchange = backtesting.exchange
self._fee = backtesting.fee
backtesting._set_strategy(backtesting.strategylist[0])
varholder.data, varholder.timerange = backtesting.load_bt_data()
@@ -198,7 +204,7 @@ class LookaheadAnalysis:
self.prepare_data(exit_varHolder, [result_row['pair']])
# now we analyze a full trade of full_varholder and look for analyze its bias
def analyze_row(self, idx, result_row):
def analyze_row(self, idx: int, result_row):
# if force-sold, ignore this signal since here it will unconditionally exit.
if result_row.close_date == self.dt_to_timestamp(self.full_varHolder.to_dt):
return

View File

@@ -137,10 +137,6 @@ class LookaheadAnalysisSubFunctions:
'just to avoid false positives')
config['dry_run_wallet'] = min_dry_run_wallet
if 'fee' not in config or config['fee'] != 0.02:
logger.info('fee was not set to a fixed value of 0.02. ')
config['fee'] = 0.02
if 'timerange' not in config:
# setting a timerange is enforced here
raise OperationalException(