Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
custom universe problem

Hi,

I'm trying to use the custom universe function. For now i just want to specify a simple list of tickers - part of the appeal to me of this is that i don't have to look up sid's by hand for each of the symbols in a basket.

Anyway, i have a sample working successfully my strategy is:

use the fetcher to grab a single column list of tickers
in the "pre" function i insert a data column in the pandas data frame.
(i get the same behavior if this date is in the file btw)

This works great provided that I specify the date to be exactly the start date of my backtest.

If however the date is a date before the start of my backtest, the universe builder doesn't see those tickers. I know this is probably a pain but i would argue that ideally you would now the state of the basket of tickers coming into the first date of the backtest. In other words, to get correct behavior you probably have to run through the entire file to maintain correct state, not just filter it by the start and end date

2 responses

Hi Fred,

Yes you are right, we forward fill the universe data when there are gaps (e.g. set of stocks that updates once per week or month), but it doesn't currently work for dates PRIOR to the backtest start date. I have filed this as an issue to fix on our side. I think the correct behavior would be to give the user the ability to forward fill the data starting from any arbitrary date in the past, so that as long as your fetcher file had data from your backtest start date or earlier you'd be ok.

In the case that you don't specify any dates in the fetcher file, then perhaps the right thing to do is to put those stocks into the data set automatically from the first date of the backtest on.

Does that sounds like how you'd expect/like it to work?

Please let us know as you come across other suggestions or question! Best wishes, Jess

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

yes i think that a simple list of tickers is probably a common use case, so an option to not specify a date is handy
obviously people can shoot themselves in the foot doing that though

on a related note, do you think it would make sense to have access to the backtesting start and end dates (and maybe other stuff like timing resolution) available at INIT time? I thought about filling in the date based on the parameters of the backtest but i dont' think there is any way to get at them.

similarly, it might be cool to be able to pass parameters as part of the back test job that get passed in. apologies if there is already a way to do that.
i'm thinking people might want that to do things like this: http://learning.cs.toronto.edu/cifar/slides/bayesian_optimization_jul_2013.pdf