Don't hardcode fee, but use fee from the very first iteration.
This commit is contained in:
@@ -48,6 +48,7 @@ class LookaheadAnalysis:
|
|||||||
self.entry_varHolders: List[VarHolder] = []
|
self.entry_varHolders: List[VarHolder] = []
|
||||||
self.exit_varHolders: List[VarHolder] = []
|
self.exit_varHolders: List[VarHolder] = []
|
||||||
self.exchange: Optional[Any] = None
|
self.exchange: Optional[Any] = None
|
||||||
|
self._fee = None
|
||||||
|
|
||||||
# pull variables the scope of the lookahead_analysis-instance
|
# pull variables the scope of the lookahead_analysis-instance
|
||||||
self.local_config = deepcopy(config)
|
self.local_config = deepcopy(config)
|
||||||
@@ -145,8 +146,13 @@ class LookaheadAnalysis:
|
|||||||
str(self.dt_to_timestamp(varholder.to_dt)))
|
str(self.dt_to_timestamp(varholder.to_dt)))
|
||||||
prepare_data_config['exchange']['pair_whitelist'] = pairs_to_load
|
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)
|
backtesting = Backtesting(prepare_data_config, self.exchange)
|
||||||
self.exchange = backtesting.exchange
|
self.exchange = backtesting.exchange
|
||||||
|
self._fee = backtesting.fee
|
||||||
backtesting._set_strategy(backtesting.strategylist[0])
|
backtesting._set_strategy(backtesting.strategylist[0])
|
||||||
|
|
||||||
varholder.data, varholder.timerange = backtesting.load_bt_data()
|
varholder.data, varholder.timerange = backtesting.load_bt_data()
|
||||||
@@ -198,7 +204,7 @@ class LookaheadAnalysis:
|
|||||||
self.prepare_data(exit_varHolder, [result_row['pair']])
|
self.prepare_data(exit_varHolder, [result_row['pair']])
|
||||||
|
|
||||||
# now we analyze a full trade of full_varholder and look for analyze its bias
|
# 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 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):
|
if result_row.close_date == self.dt_to_timestamp(self.full_varHolder.to_dt):
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -137,10 +137,6 @@ class LookaheadAnalysisSubFunctions:
|
|||||||
'just to avoid false positives')
|
'just to avoid false positives')
|
||||||
config['dry_run_wallet'] = min_dry_run_wallet
|
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:
|
if 'timerange' not in config:
|
||||||
# setting a timerange is enforced here
|
# setting a timerange is enforced here
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
|
|||||||
Reference in New Issue
Block a user