Skip to content

Commit

Permalink
Fix the print location
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Jan 16, 2025
1 parent 5d55e31 commit 98d3c4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 7 additions & 0 deletions tradeexecutor/backtest/backtest_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import sys
from pathlib import Path

import pandas as pd

from tradeexecutor.analysis.pair import display_strategy_universe
from tradeexecutor.backtest.backtest_runner import run_backtest, setup_backtest_for_universe, BacktestResult
from tradeexecutor.state.state import State
from tradeexecutor.strategy.execution_context import standalone_backtest_execution_context
Expand Down Expand Up @@ -88,6 +91,10 @@ def run_backtest_for_module(
universe_options,
)

with pd.option_context('display.max_rows', None, 'display.max_columns', None, 'display.width', 140):
universe_df = display_strategy_universe(universe)
print("Loaded strategy universe pairs are:\n%s", str(universe_df))

initial_cash = mod.initial_cash
assert initial_cash is not None, f"Strategy module does not set initial_cash needed to backtest"
assert mod.backtest_start, f"Strategy module does not set backtest_start"
Expand Down
4 changes: 0 additions & 4 deletions tradeexecutor/cli/commands/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ def loop():
state = result.state
universe = result.strategy_universe

with pd.option_context('display.max_rows', None, 'display.max_columns', None, 'display.width', 140):
universe_df = display_strategy_universe(universe)
print("Loaded strategy universe pairs are:\n%s", str(universe_df))

# We should not be able let unnamed backtests through
assert state.name

Expand Down

0 comments on commit 98d3c4f

Please sign in to comment.