SmartQuant Discussion
http://www.smartquant.com/forums/

Creating a dynamic list of BarSeries
http://www.smartquant.com/forums/viewtopic.php?f=44&t=9851
Page 1 of 1

Author:  ivb73077 [ Wed Dec 28, 2011 7:02 pm ]
Post subject:  Creating a dynamic list of BarSeries

Hello,

I need to loop through a set of instruments in InstrumentManager and create BarSeries for these instruments. I want to retain the BarSeries after pulling in historical bars and append new (5M) bars throughout the trading session. Therefore, I need the BarSeries objects to retain their scope outside the foreach loop. The number of instruments I need to pull from InstrumentManager will changes periodically, so I need a set of BarSeries that can grow dynamically. I am not exactly sure how to do this within OQ.

As an example, say I have:
foreach (Instrument instrument in InstrumentManager)
{
BarSeries bs = GetHistoricalBars(...);
}


Can I create a List of BarSeries? Say something like:

List<BarSeries> bsList = new List<BarSeries>();
foreach (Instrument instrument in InstrumentManager)
{
BarSeries bs = GetHistoricalBars(...);
bsList.Add(bs);
}


Any help on the proper syntax would be very useful. Thank you.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/