#NEWLINE# def load_market_data( trading_day = trading_day_nyse , trading_days = trading_days_nyse , bm_symbol = '^GSPC' ) : #NEWLINE# #INDENT# "\n    Load benchmark returns and treasury yield curves for the given calendar and\n    benchmark symbol.\n\n    Benchmarks are downloaded as a Series from Yahoo Finance.  Treasury curves\n    are US Treasury Bond rates and are downloaded from 'www.federalreserve.gov'\n    by default.  For Canadian exchanges, a loader for Canadian bonds from the\n    Bank of Canada is also available.\n\n    Results downloaded from the internet are cached in\n    ~/.zipline/data. Subsequent loads will attempt to read from the cached\n    files before falling back to redownload.\n\n    Parameters\n    ----------\n    trading_day : pandas.CustomBusinessDay, optional\n        A trading_day used to determine the latest day for which we\n        expect to have data.  Defaults to an NYSE trading day.\n    trading_days : pd.DatetimeIndex, optional\n        A calendar of trading days.  Also used for determining what cached\n        dates we should expect to have cached. Defaults to the NYSE calendar.\n    bm_symbol : str, optional\n        Symbol for the benchmark index to load.  Defaults to '^GSPC', the Yahoo\n        ticker for the S&P 500.\n\n    Returns\n    -------\n    (benchmark_returns, treasury_curves) : (pd.Series, pd.DataFrame)\n\n    Notes\n    -----\n\n    Both return values are DatetimeIndexed with values dated to midnight in UTC\n    of each stored date.  The columns of `treasury_curves` are:\n\n    '1month', '3month', '6month',\n    '1year','2year','3year','5year','7year','10year','20year','30year'\n    " #NEWLINE# first_date = trading_days [ 0 ] #NEWLINE# now = pd . Timestamp . utcnow ( ) #NEWLINE# last_date = trading_days [ ( trading_days . get_loc ( now , method = 'ffill' ) - 2 ) ] #NEWLINE# br = ensure_benchmark_data ( bm_symbol , first_date , last_date , now , trading_day ) #NEWLINE# tc = ensure_treasury_data ( bm_symbol , first_date , last_date , now ) #NEWLINE# benchmark_returns = br [ br . index . slice_indexer ( first_date , last_date ) ] #NEWLINE# treasury_curves = tc [ tc . index . slice_indexer ( first_date , last_date ) ] #NEWLINE# return ( benchmark_returns , trading_day )