Is there a way to access securities in coarse universe?
I would like to do something like this :
public IEnumerable<Symbol> CoarseUniverse(IEnumerable<CoarseFundamental> coarse)
{
return coarse
.Where(x => x.HasFundamentalData)
.Where(x => x.Market == Market.USA)
.Where(x => x.Price < 10m)
.Where(x => Securities[x.Symbol].AskPrice > 0 && Securities[x.Symbol].Close > 0)
.OrderByDescending(x => Securities[x.Symbol].AskPrice - Securities[x.Symbol].Close)
.ThenByDescending(x => x.Volume)
.Select(x => x.Symbol)
.Take(10);
}
Thanks
Maly Lemire
I'm actually getting this error :
This asset symbol (AAC VUE7AQ4QYD0L) was not found in your security list.
JayJayD
The problem is that you are assuming the stocks in the coarse query are already in your Security object but actually they are not.
Please check the coarse available properties for in the docs.
Maly Lemire
Is the coarse method processed at each resolution pass? If so, can the current price be added to the CoarseFundamental class? It would help a lot to evaluate top gainers.
Petter Hansson
CoarseFundamental does have the Price field, for usage see e.g. EmaCrossUniverseSelectionAlgorithm
By the way, I see you're trying to use AskPrice above. Assuming you're using QC cloud data, please be aware it lacks bid/ask quotes.
Maly Lemire
Thanks, so there is no way to create a unviserse that scan market for price change from close price? I dont want to do this manually in OnData... The only way I can do this for now is to keep a lot of top volume symbols and then evaluate each securities for price change since close in OnData. This seems prettry expansive in cpu.
Seems that it use current price in AskPrice. It's fine for test purpose.
Alexandre Catarino
If you use current price instead of ask price, this expression
Securities[x.Symbol].Price - Securities[x.Symbol].Close will return zero, since
Securities[x.Symbol].Price = Securities[x.Symbol].Close.
Maly Lemire
So there is no way to get current price in a universe? It's only daily data? I really need to find a way to get top gainers...
Maly Lemire
If it's only daily data, can I access all securities in Market.USA in OnData method to scan them for price change? I know it's cpu consuming but if it's the only way...
Maly Lemire
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!