Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
A question to calculating the 'market cap' in Lecture:Fundamental Factor Models

I read recently the lecture:Fundamental Factor Models and find followings:

class MarketCap(CustomFactor):
# Here's the data we need for this factor
inputs = [morningstar.valuation.shares_outstanding, USEquityPricing.close]
# Only need the most recent values for both series
window_length = 1

def compute(self, today, assets, out, shares, close_price):  
    # Shares * price/share = total price = market cap  
    out[:] = shares * close_price

I wonder why it's so "complicated" to calculate the 'market cap'? In the 'Fundamental Reference' there is 'market_cap'. Why hasn't done as follow:

class MarketCap(CustomFactor):
inputs = [morningstar.valuation.market_cap]
window_length = 1

def compute(self, today, assets, out, mkt_cap):  
    out[:] = mkt_cap

I am wondering...

3 responses

Hi Thomas,

This calculated version of market cap using shares outstanding and the daily price is useful for the time period of 2002 - June 2014 on Quantopian.

What's so special about that time frame as compared to June 2014 to present day? June 2014 is about when we started processing data from Morningstar for market cap and shares outstanding. For data prior to that date, we used a historical file to populate the data from 2002 - 2014. That historical file provided data with a monthly frequency. So for that time period, market cap is updated on a monthly basis.

After June 2014, market cap is updated daily by Morningstar.

So if, in a backtest, you wish to have a daily value for market cap, that custom factor is the required approach because we simply don't have the data delivered by Morningstar for it.

Hope that helps,
Josh

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.

Hi Josh,

Does this mean, if I use the get_fundamental() to get the market_cap by back testing priod of June 2014, the values I get is monthly (end of the last month), and after June 2014 they are daily?

Cheers

Thomas

Correct.