Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Notebook API 'get_pricing' stopped working

'get_pricing' API is used to be working but today I can't load the price data with exactly the same code.

price_df = get_pricing(stock_universe, start_date = time_range[0], end_date = time_range[-1]), handle_missing='ignore')

================================================================================

my 'stock_universe' contains about 1,200 stocks, some example stocks are like:

[Equity(2, symbol=u'ARNC', asset_name=u'ARCONIC INC', exchange=u'NYSE', start_date=u'Tue, 01 Jan 2002 00:00:00 GMT', end_date=u'Mon, 03 Apr 2017 00:00:00 GMT', first_traded=None, auto_close_date=u'Thu, 06 Apr 2017 00:00:00 GMT', exchange_full=u'NEW YORK STOCK EXCHANGE'), Equity(48487, symbol=u'EURN', asset_name=u'EURONAX SA', exchange=u'NYSE', start_date=u'Fri, 23 Jan 2015 00:00:00 GMT', end_date=u'Mon, 03 Apr 2017 00:00:00 GMT', first_traded=None, auto_close_date=u'Thu, 06 Apr 2017 00:00:00 GMT', exchange_full=u'NEW YORK STOCK EXCHANGE'),
... ...]

================================================================================

The error and call stack I am getting is as follows:

TypeErrorTraceback (most recent call last)
in ()
----> 1 price_df = get_pricing(stock_universe)

/build/src/qexec_repo/qexec/research/api.py in get_pricing(symbols, start_date, end_date, symbol_reference_date, frequency, fields, handle_missing) 229 asset_data_dir=asset_data_dir,
230 findata_dir=findata_dir,
--> 231 user_id=user_id,
232 )
233

/build/src/qexec_repo/qexec/research/api.pyc in inner_get_pricing(symbols, start_date, end_date, symbol_reference_date, frequency, fields, handle_missing, asset_data_dir, findata_dir, user_id) 635
636 asset
specific_data = get_pricing_internal(
--> 637 data_portal, assets, pinched
start, pinched_end, frequency, fields,
638 )
639

/build/src/qexec_repo/qexec/research/trades.pyc in get_pricing_internal(data_portal, assets, start_date, end_date, frequency, fields) 102 start_date=ensure_timestamp(startdate),
103 end_date=ensure_timestamp(end_date),
--> 104 data_frequency=frequency,
105 )

/build/src/qexec_repo/qexec/sources/ohlcv_panel.pyc in ohlcv_panel_from_source(data_portal, sids, start_date, end_date, date_index, data_frequency, fields) 100 len(query_index),
101 freq,
--> 102 _field)
103 # For date_indexes which extend past the last available dt, reindex
104 # to provide nans after the last available dt.

/build/src/qexec_repo/zipline_repo/zipline/data/data_portal.pyc in get_history_window(self, assets, end_dt, bar_count, frequency, field, ffill) 946 dt=last_traded,
947 perspective_dt=history_end,
--> 948 data_frequency=data_frequency,
949 )
950 )

/build/src/qexec_repo/zipline_repo/zipline/data/data_portal.pyc in get_adjusted_value(self, asset, field, dt, perspective_dt, data_frequency, spot_value) 641 else:
642 spot_value = self.get_spot_value(asset, field, dt,
--> 643 data_frequency)
644
645 if isinstance(asset, Equity):

/build/src/qexec_repo/zipline_repo/zipline/data/data_portal.pyc in get_spot_value(self, assets, field, dt, data_frequency) 526
527 if assets_is_scalar:
--> 528 return get_single_asset_value(assets)
529 else:
530 return list(map(get_single_asset_value, assets))

/build/src/qexec_repo/zipline_repo/zipline/data/data_portal.pyc in get_single_asset_value(asset) 494 raise KeyError("Invalid column: " + str(field))
495
--> 496 if dt < asset.start_date or \
497 (data_frequency == "daily" and
498 session_label > asset.end_date) or \

pandas/tslib.pyx in pandas.tslib.Timestamp.richcmp_ (pandas/tslib.c:18619)()

TypeError: Cannot compare type 'Timestamp' with type 'unicode'

================================================================================

BTW, it didn't give me error if I simply load a symbol like this:
price_df = get_pricing('MSFT', start_date = time_range[0], end_date = time_range[-1])

I am guessing the error is because of some broken data for some of the stocks in my 'stock_universe' within the given time period.

How am I able to get rid of this and load the price data? Many thanks!

4 responses

I have the same error. get_pricing stopped working for me as well.

Thanks for reporting this. Unfortunately I haven't been able to reproduce the issue on my end. Any chance one of you could share a notebook that runs into the issue?

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 Jamie,

Thanks for looking into this. I've attached a snippet of my code, please kindly find it. Let me know if you need anything else.

Thanks,
Tony

Thanks Tony, that's very helpful. It appears as though get_pricing is failing when passed Equity objects returned from get_fundamentals. I have made our engineers aware of the issue and they are looking into it. I'll post here when I know more.