Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect exit_time in PositionExit event during backtesting #47

Closed
ahmedxfn opened this issue Sep 6, 2024 · 1 comment
Closed

Incorrect exit_time in PositionExit event during backtesting #47

ahmedxfn opened this issue Sep 6, 2024 · 1 comment

Comments

@ahmedxfn
Copy link

ahmedxfn commented Sep 6, 2024

When listening to engine events during backtesting, I've encountered an issue where the PositionNew event correctly reports the entry time. However, for the PositionExit event, the exit_time field is always set to the current time instead of the actual exit time from the past.

Expected Behavior:

The exit_time in the PositionExit event should reflect the exact time when the position was exited, as recorded in the backtest, rather than the current time.

@just-a-stream
Copy link
Member

Hey @ahmedxfn, thanks for opening this. It's a valid point.

I've re-written the whole of barter now so there is a new trait EngineClock that begins to handle this "backtest time" problem via it's HistoricalClock implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@ahmedxfn @just-a-stream and others