I'll try to answer your questions...
"How can I get rid of the NaNs when getting prices?" In this particular instance, when getting prices to calculate forward returns, it's best to leave the nans there. The reason for most of them is the security hadn't started trading yet. You can do a spot check to verify by looking at the start_date
attribute of the security. In this case let's check WPX
symbols('WPX').start_date
# the above will display the following. WPX started trading 2011-12-12.
Timestamp('2011-12-12 00:00:00+0000', tz='UTC')
The get_pricing
method was run with a start date of 2010 so this security didn't exist then and therefor returns nan for pricing. Don't worry, Alphalens will simply not look at those securities when there is a nan for price and forward returns. One hint the issue is with the securities not having existed yet... the nans are in the last columns of the get_pricing
dataframe. Why is that? The assets (ie columns) are returned sorted by SID. The Quantopian SIDs are sequentially assigned so as a new security is listed, it is assigned to the next sequential number. Therefore all the columns for securities after WPX will have a SID larger than WPX and therefore must have a start_date after that of WPX.
What is a good value of Alpha?. Like so many things, the answer is 'it depends'. Alpha needs to be viewed in conjunction with beta and general expectation for the market. This is especially true if the beta is very negative. The general assumption is the market goes up, so a negative beta implies ones strategy is going down unless offset by a some alpha. If one had a market neutral strategy with a beta of 0, a good alpha would be over .05. That would imply about 5% return on a strategy with very low correlation to the market. If you are looking for a market like strategy with a beta close to 1, then maybe a smaller alpha would be acceptable since one is assuming some returns come from the market.
Hope that helps. Very nicely laid out code buy the way.
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.