Back to Community
Help with Fundamentals and getting ebit from the past 12 months

Hey guys, I was building my algo and I am having some trouble with Fundamentals. I'm trying to get from the last 12 months the EBIT value of the companies. However, the command "Fundamentals.ebit" shows only quarterly values for EBIT. How can I get the EBIT from the latest 12 months?

3 responses

The Morningstar EBIT values, as most of their data, is quarterly. To get the last twelve month EBIT data, the simplest is to use the FactSet dataset and reference the ebit_oper_ltm field ( (see https://www.quantopian.com/docs/data-reference/factset_fundamentals#ebit-oper-af-ebit-oper-ltm-ebit-oper-qf-ebit-oper-saf ).

The Morningstar data can be used, but one must write a small custom factor to sum up the last four quarters of data. There is a good post on this which includes code for several approaches. Check it out here https://www.quantopian.com/posts/is-there-any-method-to-get-ttm-data.

Good luck

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.

Thank you for your answer Dan, you really helped me to build my first algos. I've just used your tips to build it, and it worked! Im attaching my notebook for you to take a look in my code, and If you have any other tips/feedbacks feel free to commment :). I know this is not a good strategy, I'm just playing around with the indicators.

However, I'm having some issues:

  1. How can I get rid of this NaN when getting prices?

  2. What is a good value of Alpha? My annualized alphas are around 0.020~0.022. However, I don't know what is a good number for alpha. Is there a benchmark or something like this?

Loading notebook preview...

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.