-
Notifications
You must be signed in to change notification settings - Fork 1k
How to reimplement bar aggregation using BarBuilder #2605
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
Comments
I see a lot of custom implementation in the strategy involving timers and the When I run the strategy MRE, I also see this error:
When adding this attribute, there was also an additional missing attribute error. We can reapply the bug label and continue the investigation once confirmed with a running MRE. |
Hi, @cjdsellers. Thank you for the answer. As I have written in the bug report, with This is rather a part of my testing initiative then incrementally updating bars, as we spoken before. I want to verify, that the aggregation is working fine and have it as a blackbox test to vet new versions of NT, so I can be confident enough, that new version of NT didn't brought any new hidden bug. |
I see, so the attribute error is representing the potential bug where the bar has not yet arrived. |
Possible hypothesis, how this happensThe start of the backtest is delayed for some time (in the range of milliseconds) in the This might make aggregator think, that not the whole range of trade ticks was given for the given period at the beginning and skips the bar. |
I think thats a good theory, it might be this line here, where the condition wouldn't be true so we skip the first non full bar. My initial impression is that this could be tricky to solve, as the backtest will begin from Maybe you could figure out a solution if you're working on aggregation at the moment? |
Hi, @cjdsellers. As discussed in the chat, I think it might be solved by setting the clock at the start of the backtest to the original start_time given through the API. But I am not sure. |
Bug Report
In the given folder, there is a backtest with strategy, its output and the catalog.
Strategy tries to re-implement bar aggregation for 2 seconds and assert it against the current behavior.
The backtest runs with
time_bars_skip_first_non_full_bar=True
and starts exactly at2024-12-01 00:00:00
.I also note that
chunk_size = 1024*32
.Expected Behavior
The first bar is generated, as the start_time
2024-12-01 00:00:00
is dividable by 2 seconds.Actual Behavior
The first bar is not generated.
Note
The strategy depends on the current hook ordering (the clock callbacks are called after the on_bar event). With
time_bars_skip_first_non_full_bar=False
, the assert works fine.Steps to Reproduce the Problem
strategy.py
to the catalog./strategy.py >strategy.out 2>&1
less strategy.out
Specifications
Additional notes
The text was updated successfully, but these errors were encountered: