Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Looking for help with finding a beta for the Canadian market

Hi all,

I'm new to quatopain and need a little help forming my pipeline. I'm calculating the beta of Canadian securities in relation to the "XIU" - Canadian version of the SPY. When I enter XIU into the SimpleBeta function the error i receive is: "failed to find securities matching ['XIU'].

Here is what i got:


from quantopian.pipeline import Pipeline, CustomFactor  
from quantopian.pipeline.data import EquityPricing, factset  
from quantopian.pipeline.factors import Returns, SimpleBeta  
from quantopian.pipeline.domain import CA_EQUITIES  
from quantopian.research import run_pipeline

class MinVolume(CustomFactor):  
    inputs=[EquityPricing.volume]  
    window_length=10  
    def compute(self, today, asset_ids, out, values):  
        out[:] = np.min(values, axis=0)

volume_min = MinVolume()  
volume_filter = (volume_min.percentile_between(50, 100, mask=(volume_min > 0)))

def beta_pipline():  
    XIU = symbols('XIU')  
    beta = SimpleBeta(XIU, 252, allowed_missing_percentage=0.00)  
    return Pipeline(columns={'beta': beta}, screen = volume_filter, domain = CA_EQUITIES)

factor_data = run_pipeline(pipeline = beta_pipline(),start_date='2016-01-01', end_date='2019-09-30')

factor_data.head()


How can i fix this?

Please let me know if you need anymore info!

1 response

For international markets I believe you need to use the SID (Security ID) instead of the ticker. Have a look at Dan’s response and NB to this post.