SmartQuant Discussion

Importing Data Programmatically
Page 1 of 1

Author:  ivb73077 [ Thu Mar 24, 2011 6:08 pm ]
Post subject:  Importing Data Programmatically


I have a strategy that only runs during certain hours (say 12:00 UTC to 17:00 UTC). However, I need the highest and lowest prices for the entire market trading day.

How can I programmatically import all prices (say in 1 minute intervals such that 1bar - 1 minute) into a BarSeries from which I can get the .LowestLow and .HighestHigh properties?

Additionally, is it possible to then chain the day's historicals onto another BarSeries that contains prices during my trading hours? Specifically, can I create a BarSeries that combines the historical prices to the live/current prices?

Thank you.

Author:  Dr. Anton Fokin [ Thu Mar 24, 2011 6:12 pm ]
Post subject:  Re: Importing Data Programmatically


perhaps this may help



Author:  ivb73077 [ Thu Mar 24, 2011 7:20 pm ]
Post subject:  Re: Importing Data Programmatically

That was helpful. I had seen this posting previously.

Perhaps I should explain my question a bit better....I want to import historicals from some starting time to an ending time.

I use:
BarSeries histBarSeries = DataManager.GetHistoricalBars(myInstr,startOfTrdDay,
DateTime.UtcNow.AddSeconds(-1), BarType.Tick,1);

to import the historicals....I set the end time to 1 seconds before Now.

I then create a 1-tick bar:
barSeries_1Tick = GetBars(BarType.Tick,1); //this is our live pricing barSeries

And then try to add the historical bars to the newly created barSeries_1Tick:
for (int i = 0; i<histBarSeries.Count;i++) barSeries_1Tick.Add(histBarSeries[i]);

I then want barSeries_1Tick to remain live and continue adding tick bars as new quotes come in. I am not certain if the code I have used will work properly. Is seems to be working, but I want to make sure it doesn't have subsequent problems. Can you opine whether this code should be fine going forward?

Thank you.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group