Notebook
In [1]:
# rank(mask=universe)

from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.data import Fundamentals as ms
from quantopian.pipeline.filters import Q3000US
from quantopian.pipeline.factors import SimpleMovingAverage, CustomFactor

from quantopian.research import run_pipeline
import numpy as np


def make_pipeline():

    universe = Q3000US()

    roic_rank = ms.roic.latest.rank(mask=universe)
    ltd_to_eq_rank = ms.long_term_debt_equity_ratio.latest.rank(ascending=True,mask=universe)
    
    cash_return_rank = ms.cash_return.latest.rank(mask=universe)
    fcf_yield_rank = ms.fcf_yield.latest.rank(mask=universe)
    
    value_rank = (cash_return_rank + fcf_yield_rank).rank(mask=universe)
    
    quality_rank = (
        roic_rank + 
        ltd_to_eq_rank +
        value_rank
    )
    
    pipe = Pipeline(
        columns={
            'roic_rank': roic_rank,
            'ltd_to_eq_rank': ltd_to_eq_rank,
            'cash_return_rank': cash_return_rank,
            'fcf_yield_rank': fcf_yield_rank,
            'value_rank': value_rank,
            'quality_rank': quality_rank,
        },
        screen=universe
    )
    return pipe
        
results = run_pipeline(make_pipeline(), '12-08-2019', '12-08-2019')
results.head()

Pipeline Execution Time: 9.78 Seconds
Out[1]:
cash_return_rank fcf_yield_rank ltd_to_eq_rank quality_rank roic_rank value_rank
2019-12-09 00:00:00+00:00 Equity(2 [ARNC]) 432.0 388.0 1536.0 3020.0 1086.0 398.0
Equity(24 [AAPL]) 1531.0 1389.0 1500.0 5187.0 2231.0 1456.0
Equity(41 [ARCB]) 2310.0 2301.0 786.0 4285.0 1181.0 2318.0
Equity(52 [ABM]) 1770.0 1749.0 1022.0 4184.0 1391.0 1771.0
Equity(53 [ABMD]) 996.0 995.0 134.0 2142.0 1037.0 971.0
In [2]:
# rank()

from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.data import Fundamentals as ms
from quantopian.pipeline.filters import Q3000US
from quantopian.pipeline.factors import SimpleMovingAverage, CustomFactor

from quantopian.research import run_pipeline
import numpy as np


def make_pipeline():

    universe = Q3000US()

    roic_rank = ms.roic.latest.rank()
    ltd_to_eq_rank = ms.long_term_debt_equity_ratio.latest.rank(ascending=True)
    
    cash_return_rank = ms.cash_return.latest.rank()
    fcf_yield_rank = ms.fcf_yield.latest.rank()
    
    value_rank = (cash_return_rank + fcf_yield_rank).rank()
    
    quality_rank = (
        roic_rank + 
        ltd_to_eq_rank +
        value_rank
    )
    
    pipe = Pipeline(
        columns={
            'roic_rank': roic_rank,
            'ltd_to_eq_rank': ltd_to_eq_rank,
            'cash_return_rank': cash_return_rank,
            'fcf_yield_rank': fcf_yield_rank,
            'value_rank': value_rank,
            'quality_rank': quality_rank,
        },
        screen=universe
    )
    return pipe
        
results = run_pipeline(make_pipeline(), '12-08-2019', '12-08-2019')
results.head()

Pipeline Execution Time: 3.37 Seconds
Out[2]:
cash_return_rank fcf_yield_rank ltd_to_eq_rank quality_rank roic_rank value_rank
2019-12-09 00:00:00+00:00 Equity(2 [ARNC]) 1630.0 1618.0 3841.0 8538.0 3124.0 1573.0
Equity(24 [AAPL]) 3263.0 3220.0 3778.0 11950.0 5008.0 3164.0
Equity(41 [ARCB]) 4656.0 4912.0 2320.0 10315.0 3308.0 4687.0
Equity(52 [ABM]) 3599.0 3797.0 2866.0 10158.0 3666.0 3626.0
Equity(53 [ABMD]) 2512.0 2632.0 584.0 6086.0 3017.0 2485.0