Problem on multi datafeeds with different time range
-
Hi all,
I tested a strategy feeding two data into cerebro . The first data is from 2017-12-01 to 2017-12-31; the second is from 2017-12-18 to 2017-12-31. Both is daily freq. When I printed both of them day by day, the first data before 2017-12-18 was not printed out. What is the problem?
-
@alicc there is no problem. You (my guess, since no script shown) used
next()
to print something andnext()
is called only when all data delivered. If you want to access earlier data, than useprenext()
. This is perfectly described in the Docs - Strategy. -
@ab_trader Thank u. Actually printing is just a test, what I need is that if I can trade the first data before 2017-12-18. For the reason I may test strategies with thousands of instruments with different date range ,and the strategy requires to do some trade earlier when some of data haven't begun, is there any solution to it?
-
@alicc yes, described above.
-
Your problem it's called "survivorship bias".
And the reason for not getting into
next
is thatnext
is a method in which all buffers are guaranteed to deliver data.There are several entries in the community discussing this, but there is a recent article which touches, amongst others, the topic