|
What are the the different objects from stats from bt.run()? I found _trades very useful, what is in _values? what are other useful objects to debug the trades and strategy actions |
Replies: 1 comment
|
The easiest way to inspect what is available is: stats = bt.run()
print(stats.index.tolist())
print(stats)The most useful ones for debugging are usually: trades = stats['_trades'] # DataFrame: one row per closed trade
equity = stats['_equity_curve'] # DataFrame: equity/drawdown over time
strategy = stats['_strategy'] # the strategy instance used for the run
I would not treat For quick diagnostics, I often use something like: stats = bt.run()
print(stats[['Return [%]', 'Sharpe Ratio', 'Max. Drawdown [%]', '# Trades']])
print(stats['_trades'].tail())
print(stats['_equity_curve'].tail())If you need custom per-bar debugging, another practical pattern is to store your own values on |
statsis apandas.Series. Most entries are ordinary scalar performance metrics, and a few underscore-prefixed entries contain richer objects from the run.The easiest way to inspect what is available is:
The most useful ones for debugging are usually:
_tradesis usually the first place to look when debugging entries, exits, SL/TP behavior, duration, P/L, etc._equity_curveis useful when you want to understand dr…