Back to Community
Functions in Research Environment for Global Equities

Hi Q,

do the research environment functions such as prices, volume, log_returns work for international equities?

When I run the prices function to get historical daily data and feed in Japanese stocks I am getting this error:

ValueError: At least one valid asset id is required.

Thanks

7 responses

Hi!

Hi have the same problem, but with Swedish equities. SE_EQUITIES
Did you find a fix?

Currently global data is only available through pipeline. Using the methods prices, returns, volumes, etc aren't supported for markets other than US. So one would need to do something like the following to get price and volume data using the EquityPricing dataset. Look here for available fields https://www.quantopian.com/docs/data-reference/daily_pricing#daily-pricing .

# Research environment functions imports  
from quantopian.research import Pipeline, run_pipeline

# Data imports  
from quantopian.pipeline.data import EquityPricing # OHLCV data for Global equity  
from quantopian.pipeline.domain import SE_EQUITIES # Swedish equities


# Pipeline definition  
pipe=Pipeline(  
    columns={   'price':EquityPricing.close.latest,  
                'volume':EquityPricing.volume.latest,  
            },  
            domain=SE_EQUITIES)

# Set time period  
start_period = '2015-01-15'  
end_period= '2016-01-15'


# Execution the Pipeline  
result= run_pipeline(  
                pipe,  
                start_period,  
                end_period)

Note that latest price and volume data returned by pipelines are actuals as of the pipeline date and not split and dividend adjusted for any future splits. Any previous data fetched by using a window_length greater than 1 in a custom factor are adjusted up through the pipeline date as always.

Additionally, maybe look at this post for how to identify global securities. The symbols method only supports the SID as a parameter for non-US assets.

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.

Great! Thanks!

Hi Emil, did the solution work for you? I am working with BR_EQUITIES and for me it didn't. After I have applied the solution above, got another error message, this time regarding timezones...

I have tried applying tz_convert and/or tz_localize, unstacking and re-stacking... but nothing worked.

Dan, can you help? Tks.


AttributeError Traceback (most recent call last)
in ()
2 prices=result,
3 quantiles=10,
----> 4 periods=periods
5 )
6

/venvs/py35/lib/python3.5/site-packages/alphalens/utils.py in get_clean_factor_and_forward_returns(factor, prices, groupby, binning_by_group, quantiles, bins, periods, filter_zscore, groupby_labels, max_loss, zero_aware, cumulative_returns) 830 periods,
831 filter_zscore,
--> 832 cumulative_returns,
833 )
834

/venvs/py35/lib/python3.5/site-packages/alphalens/utils.py in compute_forward_returns(factor, prices, periods, filter_zscore, cumulative_returns) 261
262 factor_dateindex = factor.index.levels[0]
--> 263 if factor_dateindex.tz != prices.index.tz:
264 raise NonMatchingTimezoneError("The timezone of 'factor' is not the "
265 "same as the timezone of 'prices'. See "

AttributeError: 'MultiIndex' object has no attribute 'tz'

@Vinicius van der Put What specifically are you trying to do? Attached is above code but with BR_EQUITIES. Both the unstack and tz_convert methods work as shown.

Loading notebook preview...

Dan, I have done all procedures as told, but no matter what get_clean_factor_and_forward_returns still returns AttributeError: 'MultiIndex' object has no attribute 'tz'.

Loading notebook preview...

In order to test whether this was an isolated BR_EQUITIES issue, I tried to run on SE_EQUITIES, JP, etc. None worked. Same error.