I am using Quantopian Research Notebook, which is awesome! Everything runs fine until this Monday (2015-12-21), I try to run the exactly the SAME Notebook as before, but it generates a lot HTTPError: 500 Server Error: INTERNAL SERVER ERROR
when the get_fundamentals
API is called.
The PROBLEM is caused by using query( ).filter(fundamentals.company_reference.primary_symbol.in_(stock_list))
for ONLY SOME set of stock_list
, for example, in the following code segment:
import datetime
today = datetime.datetime.now().strftime('%Y-%m-%d')
fundamentals = init_fundamentals()
good_list = ['AAPL', 'F', 'BABA', 'GE', 'KMI']
bad_list = ['CBD', 'MCI', 'WIT', 'SID', 'GFA', 'ERIC', 'ITUB', 'BWIN_A', 'RBPA_A']
stock_list = bad_list
fund_test_1 = get_fundamentals(
query(fundamentals.valuation_ratios.pe_ratio,
fundamentals.valuation.market_cap)
.filter(fundamentals.company_reference.primary_symbol.in_(stock_list)),
today, '5q')
fund_test_1
#############
# `.filter(fundamentals.company_reference.primary_symbol == stock_symbol)` ALSO CAUSE the same `HTTPError` for SOME `stock_symbol`
stock_symbol = 'CBD' # OR ANY symbol in above `bad_list`
fund_test_2 = get_fundamentals(
query(fundamentals.valuation_ratios.pe_ratio,
fundamentals.valuation.market_cap)
.filter(fundamentals.company_reference.primary_symbol == stock_symbol),
today, '5q')
fund_test_2
stock_list = good_list
: everything just fine.stock_list = bad_list
: thenHTTPError: 500 Server Error: INTERNAL SERVER ERROR
will occur.stock_list = good_list + bad_list
:HTTPError
won't occur, BUTfund_test_1.minor_axis
will only contains those ingood_list
.
Acctually the bad_list
is very long when I was testing, I only list a few here.
This is a VERY strange error because I didn't change anything of my Notebook, it was running without any problem before. But when I re-run the Notebook this week, the error happens.
Please let me know what happens here and how to fix the problem. Thanks!