Skip to content

How to aggregate trade ticks to timebars? #689

Answered by graceyangfan
graceyangfan asked this question in Q&A
Discussion options

You must be logged in to vote

fellow suggestions from @cjdsellers add clock.advance_time :

        # Arrange
        clock = TestClock()
        bar_store = ObjectStorer()
        handler = bar_store.store
        instrument = AUDUSD_SIM
        bar_spec = BarSpecification(10, BarAggregation.SECOND, PriceType.LAST)
        bar_type = BarType(instrument.id, bar_spec)
        aggregator = TimeBarAggregator(
            AUDUSD_SIM,
            bar_type,
            handler,
            clock,
            Logger(clock),
        )

        tick1 = TradeTick(
            instrument_id=instrument.id,
            price=Price.from_str("1.00001"),
            size=Quantity.from_int(3000),
            aggressor_side=AggressorSid…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by graceyangfan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
1 participant