Skip to content

How to stream 3-minute or 1-hour aggregated bars? #13

@yiqianghan

Description

@yiqianghan

Hello there, thank you for providing this awesome tool, it works really well with backtrader with minute bar streaming.

I would like to know whether you have any suggestions for getting data streaming in other timeframes. I know Alpaca trade API provides REST API with different timeframe options, but I thought backtrader live mode works only with streamed data feed?

Here are some more contexts of my question:

  • In my backtrader algo, I have some calculations regarding longer timeframe that are done in every next() call, therefore, if I stream 1-minute bar and try to resample it on the fly while processing the 3 minutes information in every next(), it will mess up with my calculation.

  • In backtrader backtesting mode, I compared results using 3 minutes data vs. 1-minute data with 3-minute resampling, the results are different, and the results with 3-minute aggregated data are what I wanted.

  • In paper trade mode, I need to make sure the streamed raw data is in the 3-minute timeframe so I do not have to worry about the local resampling issue. So far, I haven't figured out this using the alpaca stream class.

Do you have any suggestions that we can do within the alpaca proxy agent framework? TIA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions