fix bug with database url during backtesting. comment out example trade db analysis.
This commit is contained in:
parent
95d3009a95
commit
eae82d0222
@ -85,9 +85,10 @@ class FreqaiDataKitchen:
|
|||||||
config["freqai"]["backtest_period_days"],
|
config["freqai"]["backtest_period_days"],
|
||||||
)
|
)
|
||||||
|
|
||||||
db_url = self.config.get('db_url', None)
|
if self.live:
|
||||||
self.database_path = '' if db_url == 'sqlite://' else str(db_url).split('///')[1]
|
db_url = self.config.get('db_url', 'sqlite://')
|
||||||
self.trade_database_df: DataFrame = pd.DataFrame()
|
self.database_path = '' if db_url == 'sqlite://' else str(db_url).split('///')[1]
|
||||||
|
self.trade_database_df: DataFrame = pd.DataFrame()
|
||||||
|
|
||||||
self.data['extra_returns_per_train'] = self.freqai_config.get('extra_returns_per_train', {})
|
self.data['extra_returns_per_train'] = self.freqai_config.get('extra_returns_per_train', {})
|
||||||
|
|
||||||
|
@ -615,11 +615,11 @@ class IFreqaiModel(ABC):
|
|||||||
they will format themselves into the dataframe as an additional column in the user
|
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.
|
strategy. User has access to the current trade database in dk.trade_database_df.
|
||||||
"""
|
"""
|
||||||
if dk.trade_database_df.empty:
|
# if dk.trade_database_df.empty:
|
||||||
logger.warning(f'No trades found for {pair} to analyze DB')
|
# logger.warning(f'No trades found for {pair} to analyze DB')
|
||||||
return
|
# return
|
||||||
|
|
||||||
total_profit = dk.trade_database_df['close_profit_abs'].sum()
|
# total_profit = dk.trade_database_df['close_profit_abs'].sum()
|
||||||
dk.data['extra_returns_per_train']['total_profit'] = total_profit
|
# dk.data['extra_returns_per_train']['total_profit'] = total_profit
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user