Fidelity Partial Bars
Author: Panache
Creation Date: 1/20/2017 3:34 PM
profile picture

Panache

#1
Is it possible to download a partial bar for Fidelity daily data for the current trading day? (I know that is an option for Yahoo data.) Specifically, I would like one of my daily Strategies to be able to use the current day's Open.
profile picture

Eugene

#2
As far as I know, there's no support for partial OHLC in Fidelity data. Fortunately, there is a built-in method for requesting the current bar's Open: GetSessionOpen.
profile picture

Panache

#3
Thanks, but it's not working for me.

CODE:
Please log in to see this code.


runs for several seconds and then gives me a runtime error: Index was out of range . . . .

I have Fidelity set as my Streaming Data Provider. I tried checking On Demand Updates, but that didn't make any difference. I also tried running it on 3 years of data and 1/1/2013 to 12/31/2017, but that didn't make any difference either.
profile picture

KGo

#4
This works for Fidelity streaming data on the primary symbol.
CODE:
Please log in to see this code.
profile picture

Panache

#5
QUOTE:
This works for Fidelity streaming data on the primary symbol.

There must be some other setting in Wealth-Lab Pro that I need to change, because your code gives me the same runtime error. On my computer, the problem is the sessionOpen line. I commented out everything else, and still get the runtime error.
profile picture

Eugene

#6
You're running it as implied (on Daily scale in static mode), are you?

At any rate, you can use this feature on Yahoo! data.
profile picture

KGo

#7

Try this without SessionOpen. I don't use SessionOpen because it is slow. It takes up to 12 seconds the first time on this simple program. It doesn't offer HLC. Plus it always returns a value which might be the open of the last completed bar. In fact in static mode it disregards the end date for the simulation and always returns the open of the the last real session. That's all manageable but PartialValue is preferable to me.

PartialValue will return OHLC anytime during the market session. Otherwise it returns NaN (Not a Number). Test for validity.
CODE:
Please log in to see this code.
profile picture

Eugene

#8
QUOTE:
In fact in static mode it disregards the end date for the simulation and always returns the open of the the last real session.

...which is exactly as it was designed. Quoting the QuickRef: Returns current trading session's opening price for the specifed symbol.
profile picture

Cone

#9
QUOTE:
I don't use SessionOpen because it is slow. It takes up to 12 seconds the first time on this simple program.
True, it's slow because it requests and caches the Opening price for all the symbols in the DataSet. If you need to trade only one symbol, it would work well to put that symbol in its own DataSet.
profile picture

Panache

#10
Thanks all. My problem was that I didn't have Streaming active. With that changed, both of KGo's codes work.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).