SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Sep 15, 2019 12:48 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Mon Jan 09, 2012 11:18 pm 
Offline

Joined: Sun Oct 30, 2011 12:12 am
Posts: 220
First, for future readers, here's a good post about downloading historical data from IB:
viewtopic.php?f=41&t=6305

Second, some info about my config, which works fine now to download historical bars for FX spot pairs through IB with GetHistoricalBars().

IB Provider settings "Historical Data" tab (not sure all of them are important):
- UseRTH = false
- WhatToShow = BID

FX spot Instrument settings for IB:
- Symbol = "EUR USD" (can be set to anything, it's not used in the messages exchanges between IB and OQ)
- Currency = "USD"
- Exchange = "IDEALPRO"
- AltExchange = "IDEALPRO"
- AltSource = "IB"
- AltSymbol = "EUR"
- PriceFormat = "F5"

Code:
Code:
   public override void OnStrategyStart()
   {
      var end = DateTime.Now;
      var begin = end.AddHours(-13);
      
      Console.WriteLine("getting bars for " + Instrument.Symbol);
      Console.WriteLine("between " + begin + " - "  + end);
      
      var bars = DataManager.GetHistoricalBars("IB", Instrument, begin, end, 3600);
      
      Console.WriteLine("# bars: " + bars.Count);

      foreach (Bar bar in bars)
      {
         Console.WriteLine(bar.ToString());
      }      
   }


:!: IMPORTANT :!:
- The provider set for Market Data in OQ's Options > Configuration > Modes > Live doesn't matter.
- This code requires an instrument to be added to the strategy, created using the above settings.
- If you set IB's "WhatToShow" property to "TRADES", it will return an error as there's no trade reporting in spot FX with IB
- If you set it to "BID_ASK", the bars downloaded will be very strange, they all look like Dojis (open ~= close)


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 11:40 pm 
Offline

Joined: Wed Apr 27, 2005 4:41 pm
Posts: 609
Location: Helsinki, Finland
PBJ wrote:
@eelofi

Thanks for your help.
It works now when I request a smaller amount of data (ie between DateTime.Now.AddDays(-4) and DateTime.Now).
I'll do some tests and reply here.

1- I have a real, live IB account anyway so no big deal. Was just saying that it's strange to require an IB account when you want to be able to trade elsewhere (Integral). Might work with the demo as you suggest.
2- Yes, Quote Monitor is working, that was my first check too. I need 200 hourly bars, which is a bit more than 8 days (not accounting for weekends).
3- How long have you used IB with OQ? Thanks for the feedback
4- The answer is yes: OQ can be set to get live data from Integral (in Options) but at the same time you can call GetHistoricalBars("IB", ...) in the strategy's code, it will connect to IB. You end up connected to Integral AND IB.

Glad to hear you're able to connect with QR! I will certainly be interested in your experience later :)
Feel free to share!


3) I forget. But for a long time already, years. It was a struggle for a long time, but now it's working fine. Setting everything up now and getting all to work is now a piece of cake. I mostly use it in paper trading mode (paper in OQ)and occasionally also live.


Top
 Profile  
 
PostPosted: Wed Jan 11, 2012 7:01 pm 
Offline

Joined: Mon Sep 10, 2007 9:05 pm
Posts: 16
Don´t think Nordnet is ported to QR yet.


Top
 Profile  
 
PostPosted: Tue Jan 24, 2012 12:00 pm 
Offline

Joined: Wed Apr 27, 2005 4:41 pm
Posts: 609
Location: Helsinki, Finland
OK, now I have connection via QR to IB and an Integral broker and it's working fine after the initial problems.

One thing to note, that in OQ and QR the defaults for Integral are different, so you need to pay attention when configuring QR.

BR,
Eelofi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
Powered by phpBB® Forum Software © phpBB Group