The biggest reason why calculated ratios are not always the same as the retrieved values is because the individual data (used for calculations) is quarterly while the ratios are Trailing Twelve Month (TTM) data. Generally all the Morningstar data is quarterly, based on the latest 10Q, except for the Valuation Ratios which are TTM values.
Addressing some of the questions from above....
1. Are my calculations correct? Not entirely. The field
Fundamentals.pb_ratio are trailing twelve month (TTM) values while the
Fundamentals.diluted_eps_earnings_reports are only the latest quarter numbers. One needs to get the trailing twelve months of data to compare to the Morningstar PE ratios. Moreover, one cannot really add the data unless the number of shares outstanding remained the same. To be correct, one would also need to calculate the weighted average number of common shares outstanding for the period. However, generally the calculated PE value will be about 4x the Morningstar field value. There may be times though, when the TTM earnings is negative while the latest quarter values are not (or vice versa). This leads to no values in the
pe_ratio field but values for the calculated version (or vice versa). Generally the PB values will be the same as calculated except in cases where a company issues or buys back a lot of stock. If one sees a big delta in PB it's often because of this (one reason why companies like stock repurchases).
2. Can the morningstar data feed be trusted? Yes, Morningstar data is generally very good. There will always be 'issues' but that is true of any data source. The numbers presented on Yahoo or Google or other sites are no more or less certain than those presented by Morningstar. When in doubt, look at the company 10Qs.
Is the Morningstar data feed quality controlled by Quantopian? Generally no. Quantopian doesn't check or modify the data we receive from Morningstar. This is a typical feed one would get from them as an individual or institutional client.
3. Is it a mistake to use the closing price from pipeline when calculating Price to ... ratios? Due to the adjustments as of backtesting date? Is it better to use the get_pricing feed? Use the pipeline data. That is as of the same day as the fundamentals and therefore won't include any future splits and adjustments which haven't occurred yet. However, as noted above, one will typically need to take into account changes in shares when getting TTM data.
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.