Profile Picture

Historical Bars

Posted By isaacvictorbabani 2 Years Ago
Message
Posted Thursday January 29 2015
Hi,
Is RE able to pull historical bars from Interactive Brokers directly?  Or must the bars have been loaded into the DB (during live trading) and subsequently pulled from the database?  
I would like to be able to pull historical 5-minute bars from IB and add them to a dictionary, which I then use throughout my trading session. What is the best way to do this?
Thank you.
Posted Sunday February 01 2015
I don't think there's a way to do this without writing it yourself.

Is this for live trading?  Is the reason you want the historical bars because they are different from what you are getting via ticks (as mentioned in your other post)?

If you don't need tick data, one possibility would be to modify the TWS plugin so it doesn't send live data based on the ticks from TWS but rather from the historical bar data that is available.  I'm not sure how soon after the end of a bar that it would be available via the TWS historical bar API, so this might also introduce too much latency.

Thanks,
Daniel
Posted Sunday February 01 2015
It is for live trading.  All I trying to do is pull the 4pm close from the prior business day.  For this strategy, I do not need any other historical data.  My strategy only executes from 9am-11am, so i didn't want to leave the data feed running until 4pm solely to be able to record the price at that time.  Can you opine on the best way to obtain the 4pm price from the prior day?  Is it possible to do this without needing to leave the data feed open until 4pm?

Thank you.
Posted Wednesday February 04 2015
You shouldn't need to keep the feed running until 4 pm.  I think the simplest thing would be to download the historical data into RightEdge's database.  Do this before starting your live system each day, and you'll have the previous day's data available.

You could also make a call directly to IB to get the previous day's close in your system startup, but I think that would be more complicated and wouldn't work well with historical simulations.

Thanks,
Daniel
Posted Friday February 06 2015
Thank you.
Could you please tell me what I need to do to download the historical data into the RE database?  And just for my own education, how would I call IB directly?  Can you provide me a code snippet to show the proper method call/syntax? 
Posted Tuesday February 10 2015
Hi Daniel,
Could you please tell me how to download the historical data into the RE database?  
How would I call IB directly?  Can you provide me a code snippet to show the proper method call/syntax and obtain the prior day's 4pm close?
Thank you. 
Posted Tuesday February 10 2015
Hi Isaac,

To download the historical data into the RE database, set up the data source, and then check the symbol in the watch list and click the button to update historical data.

If you want to call IB directly from your code, the code for the RightEdge IB plugin is included in the samples under Samples\RightEdgePlugins\TWSCSharpPlugin.  Instead of rewriting that code it would probably be easier to just reference the plugin DLL from your system, create an instance of the TWSPlugin class, and call Initialize(), Connect(), and then RetrieveData() to download the recent bars.

Thanks,
Daniel
Posted Wednesday February 11 2015
Thank you.
Posted Wednesday February 11 2015
Daniel,
Apologies for a dumb question, but in order to add a reference to the plugin, don't I need a DLL file to add? There is no DLL file in the Samples folder.  
Also - do you happen to have a code sample referencing the plugin so that I may see the necessary arguments for the RetrieveData method (for pulling the 4pm close from the prior day)?  

Thank you. 
Posted Wednesday February 11 2015
The DLL to reference will be in the Plugins directory under the RightEdge installation folder.

The source code for the plugin is in the sample folder.  With that code you could see how to connect to TWS without going through the RightEdge plugin.  You can also see how the plugin is implemented to understand how to call it directly (for example what arguments to pass to RetrieveData).

Sorry, I don't have a separate sample of calling RetrieveData directly.

Thanks,
Daniel




Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems