I added a continuous future with daily resolution, but I found that the behaivour of tradebar and open interest is quite different: when a new day begins like 8 Oct, the last day's daily bar (7 Oct) is available which is expected because we hate look-ahead bias. The problem is the open interest of 8 Oct is not of 7 Oct but 8 Oct. How could I know the open interest of 8 Oct before that day ends?

The future I added is “es”, and the raw data is like:

20131007 00:00,1676.75,1679.5,1664.75,1667.5,1582476
20131008 00:00,1667.5,1671.5,1646.5,1654.5,2357542
20131009 00:00,1654.5,1658.25,1640,1652,2441771

Its open interest data:

20131007 00:00,2674467
20131008 00:00,2692235
20131009 00:00,2723644
20131010 00:00,2703379

The backtest will print out the close price & open interest when there is daily bar available as the log below shows. From the log we clearly see that the open interest's date is one day ahead of the daily bar date.


/ES20131220@10/7/2013 8:00:00 PM (10/8/2013 12:00:00 AMUTC): price = 1667.5, oi = 2692235
391

/ES20131220@10/8/2013 8:00:00 PM (10/9/2013 12:00:00 AMUTC): price = 1654.5, oi = 2723644
392

/ES20131220@10/9/2013 8:00:00 PM (10/10/2013 12:00:00 AMUTC): price = 1652, oi = 2703379
393

/ES20131220@10/10/2013 8:00:00 PM (10/11/2013 12:00:00 AMUTC): price = 1682, oi = 2703379

 I attach the backtest to reproduce this issue.