From 8cd4daad0ad1e511f95c7881d18713a54897567a Mon Sep 17 00:00:00 2001 From: mrzdev <106373816+mrzdev@users.noreply.github.com> Date: Sun, 21 Aug 2022 17:43:40 +0200 Subject: [PATCH] Feat/freqai rl dev (#7) * access trades through get_trades_proxy method to allow backtesting --- freqtrade/freqai/RL/BaseReinforcementLearningModel.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqai/RL/BaseReinforcementLearningModel.py b/freqtrade/freqai/RL/BaseReinforcementLearningModel.py index 9cada2bf0..a0d5425d3 100644 --- a/freqtrade/freqai/RL/BaseReinforcementLearningModel.py +++ b/freqtrade/freqai/RL/BaseReinforcementLearningModel.py @@ -123,7 +123,7 @@ class BaseReinforcementLearningModel(IFreqaiModel): return def get_state_info(self, pair): - open_trades = Trade.get_trades(trade_filter=Trade.is_open.is_(True)) + open_trades = Trade.get_trades_proxy(is_open=True) market_side = 0.5 current_profit = 0 for trade in open_trades: @@ -137,8 +137,7 @@ class BaseReinforcementLearningModel(IFreqaiModel): current_profit = current_value / openrate - 1 total_profit = 0 - closed_trades = Trade.get_trades( - trade_filter=[Trade.is_open.is_(False), Trade.pair == pair]) + closed_trades = Trade.get_trades_proxy(pair = pair, is_open=False) for trade in closed_trades: total_profit += trade.close_profit