For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

How to get underlying timeframe when using replaydata

  • I have created a custom feed for coinbase data using their websocket interface and am trying to get the replaydata to work. The feed supports both historic and realtime data so if I want to replay ticks on minute bars for example I would do the following

    # Start with 255 mins of historic data before going to LIVE
    hist_start_date = datetime.utcnow() - timedelta(seconds=60*255)
    # Get a tick data feed as the underlying data
    data = CoinbaseProFeed(symbol="BTC-USD",
    # replay the tick feed as minute bars

    However, the feed only sees the timeframe of Minutes (self._timeframe) which is what the strategy would expect, but the feed needs to know that the underlying data is ticks because that's what cerebro is expecting in order to do the minute bar construction over the top.

    I see that there is a self.replaying flag to check that the data is being replayed but I don't see anywhere to fetch the underlying timeframe from.

  • Nevermind, I had taken the idea of using the self._timeframe from the ccxt feed when instead I should have been using self.p.timeframe which doesn't get modified by the replaydata. Works perfectly now.

Log in to reply