Skip to content

Commit

Permalink
Remove the extra verbose per-trade backtest execution logging
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Jul 21, 2024
1 parent 343cbdb commit a246afb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tradeexecutor/backtest/backtest_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ def execute_trades(self,
try:
executed_quantity, executed_reserve, executed_collateral_allocation, executed_collateral_consumption = self.simulate_trade(ts, state, idx, trade)
except Exception as e:
logger.error("Simulating %d. trade %s failed: %s", idx+1, trade.get_short_label(), e)
logger.exception(e)
logger.info("Simulating %d. trade %s failed: %s", idx+1, trade.get_short_label(), e)
#logger.exception(e)
raise BacktestExecutionFailed(f"Trade #{idx+1} out of {len(trades)} trades failed") from e

# TODO: Use colleteral values here
Expand Down
6 changes: 5 additions & 1 deletion tradeexecutor/backtest/grid_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,10 @@ def perform_grid_search(


def create_grid_search_failed_result(combination, state, exception: Exception) -> GridSearchResult:
"""Create a result for a crashed backtest."""
"""Create a result for a crashed backtest.
- The whole backtest is invalid - invalidate results and create empty returns
"""

# A lot of dance to avoid division by zero errors when creating metrics table
index = pd.DatetimeIndex([pd.Timestamp(1970, 1, 1), pd.Timestamp(1970, 1, 2)])
Expand Down Expand Up @@ -1225,6 +1228,7 @@ def run_grid_search_backtest(
max_workers: int = 0,
ignore_wallet_errors=False,
) -> GridSearchResult:
"""Run a single backtest grid search/optimiser."""
assert isinstance(universe, TradingStrategyUniverse), f"Received {universe}"

if name is None:
Expand Down

0 comments on commit a246afb

Please sign in to comment.