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

Len and buflen with resample

  • I´m building my first strategy that uses the resample functions of cerebro. I´m writing out the length and the buflen of each data feed in the next function. When I dont do any resampling, the result is as expected: len increments in every next step while buflen remains constant.
    However, when I resample my data feed from 1 minute to 60 minutes, then the output for len and buflen is the same (both incrementing with each next call).
    I´m trying to figure out what I´m doing wrong... here is my code:

    def next(self):
          finalS=" "
                 for i, d in enumerate(self.datas):
                     dt, dn, dv, dl, db = self.datetime.datetime(), d._name,[0], len(d), d.buflen()
                     finalS=finalS+"|" + " {} {} {} {} {}".format(dt, dn, dv, dl, db)

    And a snapshot of the output with one data feed:
    0_1559508247468_Screen Shot 2019-06-02 at 3.43.25 PM.png
    And with resampling:
    0_1559508318987_Screen Shot 2019-06-02 at 3.45.05 PM.png
    Thanks for the help!

  • administrators

    Resampled data cannot be preloaded, hence the difference.

  • Got it, thanks!

Log in to reply