SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Thu Nov 23, 2017 4:17 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Dec 20, 2016 12:09 am 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 203
Dear all,

in OQ2014 - when I connect to IQFeed to download historical data, and I have the UseExtended Trades = false, how come, the plugin downloads data beyond the regular trading session for the bars? I requested 60s and 86400s bars.

It downloads for the whole history all trading sessions and not just the regular session.

Thanks
Mike


Top
 Profile  
 
PostPosted: Fri Dec 23, 2016 10:11 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 386
IQFeed not sends additional info of bar, so it cannot be filtered for RTH.


Top
 Profile  
 
PostPosted: Thu Jan 19, 2017 12:30 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 203
ok. I see that.

You could ammend it though in a way, that you give the user the starttime preference and endtime preference to pass that to IQ feed. Since OQ2014 can specify that in the history commands for the download of time bars:
Below is the request string for historical bars:
// request in the format:
// HIT,SYMBOL,INTERVAL,BEGINDATE BEGINTIME,ENDDATE ENDTIME,,BEGINFILTERTIME,ENDFILTERTIME,DIRECTION,REQUESTID,DATAPOINTSPERSEND,INTERVALTYPE<CR><LF>

Thanks
Mike


Top
 Profile  
 
PostPosted: Thu Jan 19, 2017 1:46 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 386
You can do it programatically:
Code:
         var iqfeed = ProviderManager.GetHistoricalDataProvider(ProviderId.IQFeed);
         var instrument = InstrumentManager.Instruments["AAPL"];
         var date = new DateTime(2017, 01, 17);
         var time1 = new TimeSpan(09, 30, 00);
         var time2 = new TimeSpan(17, 00, 00);
         
         while(!iqfeed.IsConnected)
         {
            iqfeed.Connect();
            System.Threading.Thread.Sleep(1000);
         }
         
         var bars = DataManager.GetHistoricalBars(iqfeed, instrument, date.Add(time1), date.AddDays(-1).Add(time2), BarType.Time, 60);
         
         if (bars != null)
         {
            int barsToShow = 5;
            
            Console.WriteLine("bars loaded: {0}", bars.Count);
            Console.WriteLine("last {0} bars", barsToShow);
            
            for (int i = bars.Count - 1; i >= 0 && i >= bars.Count - barsToShow; i--)
               Console.WriteLine(bars[i]);
         }


result:
Code:
last 5 bars
Bar [1/17/2017 16:59:00.000 - 1/17/2017 17:00:00.000] Instrument=0 Type=Time Size=60 Open=119.97 High=119.99 Low=119.97 Close=119.97 Volume=20100
Bar [1/17/2017 16:58:00.000 - 1/17/2017 16:59:00.000] Instrument=0 Type=Time Size=60 Open=119.97 High=119.99 Low=119.97 Close=119.99 Volume=10150
Bar [1/17/2017 16:57:00.000 - 1/17/2017 16:58:00.000] Instrument=0 Type=Time Size=60 Open=119.98 High=119.98 Low=119.98 Close=119.98 Volume=700
Bar [1/17/2017 16:56:00.000 - 1/17/2017 16:57:00.000] Instrument=0 Type=Time Size=60 Open=119.97 High=119.97 Low=119.97 Close=119.97 Volume=4900
Bar [1/17/2017 16:53:00.000 - 1/17/2017 16:54:00.000] Instrument=0 Type=Time Size=60 Open=119.97 High=119.97 Low=119.97 Close=119.97 Volume=5000


and for time2 = new TimeSpan(18, 30, 00);
Code:
last 5 bars
Bar [1/17/2017 18:13:00.000 - 1/17/2017 18:14:00.000] Instrument=0 Type=Time Size=60 Open=119.97 High=119.97 Low=119.97 Close=119.97 Volume=200
Bar [1/17/2017 18:08:00.000 - 1/17/2017 18:09:00.000] Instrument=0 Type=Time Size=60 Open=119.92 High=119.92 Low=119.92 Close=119.92 Volume=100
Bar [1/17/2017 18:06:00.000 - 1/17/2017 18:07:00.000] Instrument=0 Type=Time Size=60 Open=119.92 High=119.92 Low=119.92 Close=119.92 Volume=100
Bar [1/17/2017 17:58:00.000 - 1/17/2017 17:59:00.000] Instrument=0 Type=Time Size=60 Open=119.91 High=119.91 Low=119.91 Close=119.91 Volume=170
Bar [1/17/2017 17:55:00.000 - 1/17/2017 17:56:00.000] Instrument=0 Type=Time Size=60 Open=119.92 High=119.92 Low=119.92 Close=119.92 Volume=100


PS You should load bars by one day per request otherwise you will load all data outside rth


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group