Improve backtest performance
This commit is contained in:
@@ -10,7 +10,7 @@ import arrow
|
||||
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT
|
||||
from freqtrade.exceptions import DependencyException
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.persistence import LocalTrade, Trade
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
|
||||
@@ -66,9 +66,14 @@ class Wallets:
|
||||
"""
|
||||
# Recreate _wallets to reset closed trade balances
|
||||
_wallets = {}
|
||||
closed_trades = Trade.get_trades_proxy(is_open=False)
|
||||
open_trades = Trade.get_trades_proxy(is_open=True)
|
||||
tot_profit = sum([trade.close_profit_abs for trade in closed_trades])
|
||||
# If not backtesting...
|
||||
# TODO: potentially remove the ._log workaround to determine backtest mode.
|
||||
if self._log:
|
||||
closed_trades = Trade.get_trades_proxy(is_open=False)
|
||||
tot_profit = sum([trade.close_profit_abs for trade in closed_trades])
|
||||
else:
|
||||
tot_profit = LocalTrade.total_profit
|
||||
tot_in_trades = sum([trade.stake_amount for trade in open_trades])
|
||||
|
||||
current_stake = self.start_cap + tot_profit - tot_in_trades
|
||||
|
Reference in New Issue
Block a user