code: def load_crypto_market_data(
      trading_day=None,
      trading_days=None,
      bm_symbol=None,
      bundle=None,
      bundle_data=None,
      environ=None,
      exchange=None,
      start_dt=None,
      end_dt=None,
  ):
      if trading_day is None:
          trading_day = get_calendar("OPEN").trading_day
  
      # TODO: consider making configurable
      bm_symbol = "btc_usd"
      # if trading_days is None:
      #    trading_days = get_calendar('OPEN').schedule
  
      # if start_dt is None:
      start_dt = get_calendar("OPEN").first_trading_session
  
      if end_dt is None:
          end_dt = pd.Timestamp.utcnow()
  
      # We expect to have benchmark and treasury data that's current up until
      # **two** full trading days prior to the most recently completed trading
      # day.
      # Example:
      # On Thu Oct 22 2015, the previous completed trading day is Wed Oct 21.
      # However, data for Oct 21 doesn't become available until the early morning
      # hours of Oct 22.  This means that there are times on the 22nd at which we
      # cannot reasonably expect to have data for the 21st available.  To be
      # conservative, we instead expect that at any time on the 22nd, we can
      # download data for Tuesday the 20th, which is two full trading days prior
      # to the date on which we're running a test.
  
      # We'll attempt to download new data if the latest entry in our cache is
      # before this date.
      """
      if(bundle_data):
          # If we are using the bundle to retrieve the cryptobenchmark, find
          # the last date for which there is trading data in the bundle
          asset = bundle_data.asset_finder.lookup_symbol(
                      symbol=bm_symbol,as_of_date=None)
          ix = bundle_data.daily_bar_reader._last_rows[asset.sid]
          last_date = pd.to_datetime(
                      bundle_data.daily_bar_reader._spot_col('day')[ix],unit='s')
      else:
          last_date = trading_days[trading_days.get_loc(now, method='ffill') - 2]
      """
      last_date = trading_days[
          trading_days.get_loc(end_dt, method="ffill") - 1
      ]
  
      if exchange is None:
          # This is exceptional, since placing the import at the module scope
          #  breaks things and it's only needed here
          from catalyst.exchange.utils.factory import get_exchange
  
          exchange = get_exchange(
              exchange_name="bitfinex", quote_currency="usd"
          )
          exchange.init()
  
      benchmark_asset = exchange.get_asset(bm_symbol)
  
      # exchange.get_history_window() already ensures that we have the right data
      # for the right dates
      br = exchange.get_history_window_with_bundle(
          assets=[benchmark_asset],
          end_dt=last_date,
          bar_count=pd.Timedelta(last_date - start_dt).days,
          frequency="1d",
          field="close",
          data_frequency="daily",
          force_auto_ingest=True,
      )
      br.columns = ["close"]
      br = br.pct_change(1).iloc[1:]
      br.loc[start_dt] = 0
      br = br.sort_index()
  
      # Override first_date for treasury data since we have it for many more
      # years and is independent of crypto data
      first_date_treasury = pd.Timestamp("1990-01-02", tz="UTC")
      tc = ensure_treasury_data(
          bm_symbol,
          first_date_treasury,
          last_date,
          end_dt,
          environ,
      )
      benchmark_returns = br[
          br.index.slice_indexer(start_dt, last_date)
      ]
      treasury_curves = tc[
          tc.index.slice_indexer(first_date_treasury, last_date)
      ]
      return benchmark_returns, treasury_curves
  
imports: import os
  from collections import OrderedDict
  import logbook
  import pandas
  import pytz
  from pandas_datareader.data import DataReader
  from six import iteritems
  from six.moves.urllib_error import HTTPError
  from catalyst.constants import LOG_LEVEL
  from catalyst.utils.calendars import get_calendar
  from .None import treasuries, treasuries_can
  from .benchmarks import get_benchmark_returns
  from ..utils.deprecate import deprecated
  from ..utils.paths import cache_root, data_root
label_desc: Use image node_id 6 for calling a global function with example usage: load_crypto_market_data(trading_day, trading_days, bm_symbol, bundle, bundle_data, environ, exchange, start_dt, end_dt) and returns: benchmark_returns,  treasury_curves