For whatever reason, storing the open price during NewTick sometimes results in price of 0. Also, there is the issue of obtaining the open price when the system is started after the market has opened.
I was able to use RequestMarketData via the tws interface although the solution took several hours to work out. Which leads me to several questions:
1. Is the broker plugin, e.g. TWSPlugin, instantiated twice, once during the “Start Data Feed” and a second time when the system is started?
2. If yes to #1, can this be simplified into a single instance such as a singleton? This would be advantageous since some members, e.g. “watchedSymbols” are currently not available after the system is started.
3. I’m currently using GetShares to pass in the symbol to the plugin since I can’t access RequestMarketData directly via the system. While the solution works, it adds functionality to an already existing method. To access the broker plugin directly, would it be possible to add a method to the broker interfaces that accepts an object? This will allow the system code to interact directly with the plugin to implement functionality not yet available.
4. Is there a simpler way to obtain open price (for the day) via the system code? I see open price correctly displayed in the Live Data pane but it is different in the system. #3 is still a request because this functionality would be helpful in general.
5. Is the functionality of SystemData.Bars[symbol].PartialItem.Open different between sim and live? In sim, it is pointing to the current day open.
Wednesday April 11 2012 by