Back

How can I log a list of my subscribed universe?

If I add my securities

        self.AddEquity("SPY")
        self.AddEquity("BAC")
        self.AddEquity("IBM")

They are added to the hidden(correct name?) universe. I'd like to create a list of securities built off of my subscribed universe. The ultimate goal is to be able to use 

self.AddUniverse(self.Universe.DollarVolume.Top(50))

and then create a list off of this universe.

 

Thank you.

Update Backtest








If working with manuallly added(AddX) portfolio, you can try to loop through Securities like:

self.Log(",".join([str(security.Symbol) for security in self.Securities.Values]))

Would give, for example:

2013-10-12 00:00:00 BAC, IBM, SPY

If you are working with one of the universe examples, you can see how in OnSecuritiesChanged in this example new items in the universe are handled, as well as some logging in CoarseSelectionFunction.

0

Securities in the self.Securities.Values grow forever as they are not remove from the array. This is done to preserve the information of the security (e.g. security fees acrued).

The self.UniverseManager["name of universe"].Members.Values -- there are many different types of universes though and we serve the union of them to the algorithm.

 - We'll make this easier, I'll make a new Github issue.
 - For now the best way would be use the OnSecuritiesChanged to create your own list of the universe securities.

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed