fix bug with database url during backtesting. comment out example trade db analysis.

This commit is contained in:
robcaulk 2022-08-03 16:17:57 +02:00
parent 95d3009a95
commit eae82d0222
2 changed files with 9 additions and 8 deletions

View File

@ -85,7 +85,8 @@ class FreqaiDataKitchen:
config["freqai"]["backtest_period_days"],
)
db_url = self.config.get('db_url', None)
if self.live:
db_url = self.config.get('db_url', 'sqlite://')
self.database_path = '' if db_url == 'sqlite://' else str(db_url).split('///')[1]
self.trade_database_df: DataFrame = pd.DataFrame()

View File

@ -615,11 +615,11 @@ class IFreqaiModel(ABC):
they will format themselves into the dataframe as an additional column in the user
strategy. User has access to the current trade database in dk.trade_database_df.
"""
if dk.trade_database_df.empty:
logger.warning(f'No trades found for {pair} to analyze DB')
return
# if dk.trade_database_df.empty:
# logger.warning(f'No trades found for {pair} to analyze DB')
# return
total_profit = dk.trade_database_df['close_profit_abs'].sum()
dk.data['extra_returns_per_train']['total_profit'] = total_profit
# total_profit = dk.trade_database_df['close_profit_abs'].sum()
# dk.data['extra_returns_per_train']['total_profit'] = total_profit
return