Notebook
In [1]:
from quantopian.pipeline import Pipeline, CustomFactor
from quantopian.pipeline.filters import QTradableStocksUS, StaticSids
from quantopian.pipeline.data import Fundamentals
from quantopian.research import run_pipeline
import numpy as np

Number of unique asof_dates for each Fundamental factor

This notebook reveals the total number of unique asof_dates for each and every Fundamental factor for all assets in the QTradableStocksUS universe. Window_size is set to 10, so we should expect 10 unique dates for factors that change daily, and 1 unique date for most factors that change less frequently. However, the results do not match expectations.

In [ ]:
universe = QTradableStocksUS()

class Unique(CustomFactor):
    mask = universe
    def compute(self, today, assets, out, inputs):
        out[:] = np.array([np.unique(a).shape[0] for a in inputs.T])
def make_pipeline():
    return Pipeline(
        columns = {
            x.name[:-10]: Unique(
                inputs=[x,],
                window_length = 10
            )
            for x in Fundamentals.columns if x.name.endswith('_asof_date')
        },
        screen = universe
    )
start_date, end_date = '2018-03-19', '2018-03-19'
df = run_pipeline(make_pipeline(), start_date, end_date)
df.index = df.index.levels[1]
df

Listed here are all factors that are updated daily for every asset. Clearly, most all of these are all fixed and should never be updated. The daily asof_dates for fixed values creates uncertainty, as will be discussed in the next section.

In [ ]:
print '\n'.join(df.sum(0).pipe(lambda s: s[s == 21550]).index)

AAPL Daily asof_dates

Problems arise when we have daily asof_dates, yet cannot be sure if the values are supposed to change.

For AAPL we have daily asof_date for all the following factors. Clearly, many of these factors are only set one time, like 'cik'. Some, if they do change, we'd like to easily determine when they changed, like 'exchange_id'. But unfortunately the only way to know when any of these values changed is to scan the actual value for every date and detect changes in the values.

Even worse, values that might change daily must not only be guessed from the daily asof_dates, but also confirmed by checking that the actual values change daily as well. For instance, 'cf_yield' looks like it would update daily, but does it? We'd have to check that the actual values change. What if on some days the values change and others they do not? Does that mean the values are updated only occasionally?

In [ ]:
print '\n'.join(df.iloc[1].pipe(lambda s: s[s==10]).index)

To further illustrate the issue, we have here for AAPL a financial ratio determined from the quarterly balance sheet, but it is shown to be updated daily by its asof_dates. This raises the question of what happens with a stock split? I guess the asof_date would continue updating daily, but would the value reflect the stock split? Probably not, since this is a balance sheet ratio. But the why list it as having a daily asof_date.

In [ ]:
def make_pipeline():
    return Pipeline(
        columns = {
            'factor': Fundamentals.book_value_per_share.latest,
            '_asof_date': Fundamentals.book_value_per_share_asof_date.latest,
        },
        screen = StaticSids([24])
    )
start_date, end_date = '2018-03-12', '2018-03-19'
run_pipeline(make_pipeline(), start_date, end_date)

Number of changed values for each Fundamental quantitative factor

In [8]:
universe = QTradableStocksUS()
# universe = StaticSids([2,24])

class Changes(CustomFactor):
    mask = universe
    def compute(self, today, assets, out, inputs):
        # shift and compare
        a = np.empty_like( inputs )
        a[0,:] = np.nan
        a[1:] = inputs[:-1]
        out[:] = ( np.isfinite( a ) &  ( a != inputs ) ).sum(0)
def make_pipeline():
    return Pipeline(
        columns = {
            x.name: Changes(
                inputs=[x,],
                window_length = 11
            )
            for x in Fundamentals.columns if x.dtype in [ np.dtype('float64'), np.dtype('int64') ]
        },
        screen = universe
    )
start_date, end_date = '2018-03-19', '2018-03-19'
df = run_pipeline(make_pipeline(), start_date, end_date)
df.index = df.index.levels[1]
df
Out[8]:
accounts_payable accounts_receivable accretion_on_preferred_stock accrued_interest_receivable accrued_investment_income accrued_liabilities_total accrued_preferred_stock_dividends accruedand_deferred_income accruedand_deferred_income_current accruedand_deferred_income_non_current ... water_production work_in_process work_performedby_entityand_capitalized working_capital working_capital_per_share working_capital_per_share3_yr_avg working_capital_per_share5_yr_avg working_capital_turnover_ratio write_down write_off
Equity(2 [ARNC]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(24 [AAPL]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(31 [ABAX]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0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MATX]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(300 [ALK]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(301 [ALKS]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(311 [ALOG]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0
Equity(337 [AMAT]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(351 [AMD]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
Equity(50690 [CJ]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(50713 [GOOS]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 10.0 0.0 0.0 0.0 0.0 0.0
Equity(50716 [DXC]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(50718 [PUMP]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(50719 [MULE]) 0.0 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.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(50910 [JHG]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(50968 [GPMT]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Equity(50970 [ATUS]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0
Equity(50990 [APRN]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

2155 rows × 1064 columns

In [9]:
df.describe().T.sort_values('mean', ascending=False)
Out[9]:
count mean std min 25% 50% 75% max
pe_ratio3_yr_avg 2155.0 9.980510 0.388544 0.0 10.0 10.0 10.0 10.0
pb_ratio3_yr_avg 2155.0 9.978190 0.365641 0.0 10.0 10.0 10.0 10.0
pfcf_ratio3_yr_avg 2155.0 9.967517 0.569141 0.0 10.0 10.0 10.0 10.0
ps_ratio3_yr_avg 2155.0 9.862181 1.110026 0.0 10.0 10.0 10.0 10.0
market_cap 2155.0 9.819026 0.468814 5.0 10.0 10.0 10.0 10.0
price_change1_m 2155.0 9.810673 0.521922 0.0 10.0 10.0 10.0 10.0
e_vto_total_assets 2155.0 9.754060 0.839389 0.0 10.0 10.0 10.0 10.0
ps_ratio 2155.0 9.660325 1.304118 0.0 10.0 10.0 10.0 10.0
ps_ratio1_year_growth 2155.0 9.654292 1.800579 0.0 10.0 10.0 10.0 10.0
book_value_yield 2155.0 9.647332 0.933234 0.0 10.0 10.0 10.0 10.0
e_vto_revenue 2155.0 9.627842 1.411508 0.0 10.0 10.0 10.0 10.0
sales_yield 2155.0 9.554988 1.390750 0.0 10.0 10.0 10.0 10.0
pb_ratio 2155.0 9.372622 2.089433 0.0 10.0 10.0 10.0 10.0
pb_ratio1_year_growth 2155.0 9.274710 2.571482 0.0 10.0 10.0 10.0 10.0
cf_yield 2155.0 9.238051 1.331512 0.0 9.0 10.0 10.0 10.0
p_cash_ratio3_yr_avg 2155.0 9.064501 2.905030 0.0 10.0 10.0 10.0 10.0
enterprise_value 2155.0 8.920650 2.878653 0.0 10.0 10.0 10.0 10.0
priceto_cash_ratio 2155.0 8.895128 2.910639 0.0 10.0 10.0 10.0 10.0
ps_ratio3_year_growth 2155.0 8.851508 3.080812 0.0 10.0 10.0 10.0 10.0
ps_ratio3_yr_avg_change 2155.0 8.851508 3.080812 0.0 10.0 10.0 10.0 10.0
fcf_yield 2155.0 8.800000 1.811036 0.0 8.0 9.0 10.0 10.0
pcf_ratio 2155.0 8.796288 3.033056 0.0 10.0 10.0 10.0 10.0
earning_yield 2155.0 8.696984 1.844857 0.0 8.0 9.0 10.0 10.0
pb_ratio3_yr_avg_change 2155.0 8.530858 3.450317 0.0 10.0 10.0 10.0 10.0
pb_ratio3_year_growth 2155.0 8.530858 3.450317 0.0 10.0 10.0 10.0 10.0
ps_ratio5_year_growth 2155.0 8.012993 3.963367 0.0 10.0 10.0 10.0 10.0
normalized_pe_ratio 2155.0 7.857077 3.944719 0.0 9.0 10.0 10.0 10.0
ev_to_forward_revenue 2155.0 7.825986 3.969226 0.0 9.0 10.0 10.0 10.0
forward_earning_yield 2155.0 7.775406 3.462982 0.0 8.0 9.0 10.0 10.0
e_vto_pre_tax_income 2155.0 7.702088 4.070111 0.0 9.0 10.0 10.0 10.0
... ... ... ... ... ... ... ... ...
finance_lease_receivables_current 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fcf_ratio_price_multiple_ratios 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fcf_sales_ratio 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
federal_funds_purchased 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
federal_funds_purchased_and_securities_sold_under_agreement_to_repurchase 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
federal_funds_sold 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
federal_funds_sold_and_securities_purchase_under_agreements_to_resell 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
federal_home_loan_bank_stock 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fee_revenue_and_other_income 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fees 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fees_and_commissions 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
feesand_commission_expense 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
feesand_commission_income 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
finance_lease_receivables 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
finance_lease_receivables_non_current 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fixed_maturities_held_to_maturity 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_assets 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_assets_designatedas_fair_value_through_profitor_loss_total 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_instruments_sold_under_agreements_to_repurchase 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_leverage 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_liabilities_current 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_liabilities_designatedas_fair_value_through_profitor_loss_total 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_liabilities_measuredat_amortized_cost_total 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_liabilities_non_current 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financial_or_derivative_investment_current_liabilities 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
financing_cash_flow 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
finished_goods 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fix_assets_turonver 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
fixed_maturities_available_for_sale 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0
write_off 2155.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0

1064 rows × 8 columns

In [11]:
def make_pipeline():
    return Pipeline(
        columns = {
            'factor': Fundamentals.pe_ratio3_yr_avg.latest,
        },
        screen = StaticSids([24])
    )
start_date, end_date = '2018-03-12', '2018-03-19'
run_pipeline(make_pipeline(), start_date, end_date)
Out[11]:
factor
2018-03-12 00:00:00+00:00 Equity(24 [AAPL]) 14.733241
2018-03-13 00:00:00+00:00 Equity(24 [AAPL]) 14.730898
2018-03-14 00:00:00+00:00 Equity(24 [AAPL]) 14.733369
2018-03-15 00:00:00+00:00 Equity(24 [AAPL]) 14.738114
2018-03-16 00:00:00+00:00 Equity(24 [AAPL]) 14.742875
2018-03-19 00:00:00+00:00 Equity(24 [AAPL]) 14.744833