class_docstr: Construct total return (spot) indices for FX. In future will also convert assets from local currency to foreign currency
  denomination and construct indices from forwards series.
class_docstr_tok: ["Construct","total","return","(","spot",")","indices","for","FX",".","In","future","will","also","convert","assets","from","local","currency","to","foreign","currency","denomination","and","construct","indices","from","forwards","series","."]
code: def fetch_continuous_time_series(
      self,
      md_request,
      market_data_generator,
      depo_tenor=None,
      construct_via_currency=None,
      output_calculation_fields=None,
      field=None,
  ):
      if market_data_generator is None:
          market_data_generator = self._market_data_generator
      if depo_tenor is None:
          depo_tenor = self._depo_tenor
      if construct_via_currency is None:
          construct_via_currency = self._construct_via_currency
      if output_calculation_fields is None:
          output_calculation_fields = self._output_calculation_fields
      if field is None:
          field = self._field
  
      # Eg. we construct AUDJPY via AUDJPY directly
      if construct_via_currency == "no":
          base_depo_tickers = [
              x[0:3] + self._depo_tenor for x in md_request.tickers
          ]
          terms_depo_tickers = [
              x[3:6] + self._depo_tenor for x in md_request.tickers
          ]
  
          depo_tickers = list(
              set(base_depo_tickers + terms_depo_tickers)
          )
  
          market = Market(market_data_generator=market_data_generator)
  
          # Deposit data for base and terms currency
          md_request_download = MarketDataRequest(md_request=md_request)
  
          md_request_download.tickers = depo_tickers
          md_request_download.category = "base-depos"
          md_request_download.fields = field
          md_request_download.abstract_curve = None
  
          depo_df = market.fetch_market(md_request_download)
  
          # Spot data
          md_request_download.tickers = md_request.tickers
          md_request_download.category = "fx"
  
          spot_df = market.fetch_market(md_request_download)
  
          return self.construct_total_return_index(
              md_request.tickers,
              self._calculations.join([spot_df, depo_df], how="outer"),
              depo_tenor=depo_tenor,
              output_calculation_fields=output_calculation_fields,
              field=field,
          )
      else:
          # eg. we calculate via your domestic currency such as USD, so returns will be in your domestic currency
          # Hence AUDJPY would be calculated via AUDUSD and JPYUSD (subtracting the difference in returns)
          total_return_indices = []
  
          for tick in md_request.tickers:
              base = tick[0:3]
              terms = tick[3:6]
  
              md_request_base = MarketDataRequest(md_request=md_request)
              md_request_base.tickers = base + construct_via_currency
  
              md_request_terms = MarketDataRequest(
                  md_request=md_request
              )
              md_request_terms.tickers = terms + construct_via_currency
  
              base_vals = self.fetch_continuous_time_series(
                  md_request_base,
                  market_data_generator,
                  construct_via_currency="no",
                  field=field,
              )
              terms_vals = self.fetch_continuous_time_series(
                  md_request_terms,
                  market_data_generator,
                  construct_via_currency="no",
                  field=field,
              )
  
              # Special case for USDUSD case (and if base or terms USD are USDUSD
              if (
                  base + terms
                  == construct_via_currency + construct_via_currency
              ):
                  base_rets = self._calculations.calculate_returns(
                      base_vals
                  )
                  cross_rets = pd.DataFrame(
                      0,
                      index=base_rets.index,
                      columns=base_rets.columns,
                  )
              elif (
                  base + construct_via_currency
                  == construct_via_currency + construct_via_currency
              ):
                  cross_rets = -self._calculations.calculate_returns(
                      terms_vals
                  )
              elif (
                  terms + construct_via_currency
                  == construct_via_currency + construct_via_currency
              ):
                  cross_rets = self._calculations.calculate_returns(
                      base_vals
                  )
              else:
                  base_rets = self._calculations.calculate_returns(
                      base_vals
                  )
                  terms_rets = self._calculations.calculate_returns(
                      terms_vals
                  )
  
                  cross_rets = base_rets.sub(
                      terms_rets.iloc[:, 0], axis=0
                  )
  
              # First returns of a time series will by NaN, given we don't know previous point
              cross_rets.iloc[0] = 0
  
              cross_vals = self._calculations.create_mult_index(
                  cross_rets
              )
              cross_vals.columns = [tick + "-tot.close"]
  
              total_return_indices.append(cross_vals)
  
          return self._calculations.join(
              total_return_indices, how="outer"
          )
  
file_path: finmarketpy/finmarketpy/curve/fxspotcurve.py
imports: import pandas
  from numba import guvectorize
  from findatapy.market import Market, MarketDataRequest
  from findatapy.timeseries import Calculations
  from finmarketpy.util.marketconstants import MarketConstants
label_desc: Use image node_id 3 for calling the FXSpotCurve obj's underlying member method code with example usage: obj.fetch_continuous_time_series(md_request, market_data_generator, depo_tenor, construct_via_currency, output_calculation_fields, field) and returns: self, self