When choosing stocks from the dollar volume universe via
history, my algo will error when I try to order a stock that isn't in data. I have to add a line if security in data: as a safeguard. Is this normal?
When choosing stocks from the dollar volume universe via
history, my algo will error when I try to order a stock that isn't in data. I have to add a line if security in data: as a safeguard. Is this normal?
It's normal, but very, very tedious. The fact that it is impossible to place the first trade of the day in a stock is very frustrating, if your algo runs into the issue.
There's a discussion on the help page:
https://www.quantopian.com/help#overview-checkingdata
To me, it is not exactly clear, and I think one always has to guard against encountering a stock that is tradeable (at or beyond its
start_date, https://www.quantopian.com/help#api-sidinfo), but cannot be transacted via Quantopian due to the weirdness described by Simon. I think the rule is that upon introducing a stock to your algo's universe (i.e. adding it to data), you need to wait until the first trade comes along in the feed (either from the backtest database or from Nanex). Once the feed is established, the platform starts forward-filling the gaps (relative to the most frequently traded security). For a discussion, see https://www.quantopian.com/posts/thinly-traded-stocks-why-no-gaps.
Or maybe the problem only applies to the first day of trading for a given stock (its start_date)?
Either way, you have to code a guard into your algo to prevent an error.