Skip to content

Refactor bar aggregators to use ts_init instead of ts_event#2924

Merged
cjdsellers merged 3 commits into
developfrom
bar-ts_init
Sep 4, 2025
Merged

Refactor bar aggregators to use ts_init instead of ts_event#2924
cjdsellers merged 3 commits into
developfrom
bar-ts_init

Conversation

@faysou

@faysou faysou commented Sep 2, 2025

Copy link
Copy Markdown
Collaborator

Pull Request

NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.

  • I have reviewed the CONTRIBUTING.md and followed the established practices

Summary

  • Refactor bar aggregators to use ts_init instead of ts_event
  • Modify binance and bybit adapters so the result of historical data requests uses ts_init=ts_event

Related Issues/PRs

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (impacts existing behavior)
  • Documentation update
  • Maintenance / chore

Breaking change details (if applicable)

Documentation

  • Documentation changes follow the style guide (docs/developer_guide/docs.md)

Release notes

  • I added a concise entry to RELEASES.md that follows the existing conventions (when applicable)

Testing

Ensure new or changed logic is covered by tests.

  • Affected code paths are already covered by the test suite
  • I added/updated tests to cover new or changed logic

@faysou faysou changed the title Refactor bar aggregators to use ts_init instead of tst_event Refactor bar aggregators to use ts_init instead of ts_event Sep 2, 2025
@cjdsellers

Copy link
Copy Markdown
Member

Hi @faysou

Thanks for the contribution.

I see it's doing two things:

  1. Standardizing ts_init to ts_event for data requests for a couple of adapters
  2. Changing bar aggregation to use ts_init as the update timestamp instead of ts_event

I think 1) is more logical as ts_init - ts_event latency is not applicable, and if the requested data is used for backtesting at any point then we have well defined ts_inits - being the ts_events for each bar.

Then 2) Is a more subtle change, it's probably the right move to change to ts_init that more accurately represents the arrival of data for aggregation, rather than the time some event happened (potentially outside the system boundary).

@cjdsellers cjdsellers merged commit deb379f into develop Sep 4, 2025
24 of 25 checks passed
@cjdsellers cjdsellers deleted the bar-ts_init branch September 4, 2025 22:25
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

Successfully merging this pull request may close these issues.

2 participants