We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7a7812 commit 431ec32Copy full SHA for 431ec32
backtesting/_stats.py
@@ -103,7 +103,7 @@ def _round_timedelta(value, _period=_data_period(index)):
103
s.loc['Duration'] = s.End - s.Start
104
105
have_position = np.repeat(0, len(index))
106
- for t in trades_df.itertuples(index=False):
+ for t in trades_df[['EntryBar', 'ExitBar']].itertuples(index=False):
107
have_position[t.EntryBar:t.ExitBar + 1] = 1
108
109
s.loc['Exposure Time [%]'] = have_position.mean() * 100 # In "n bars" time, not index time
0 commit comments