class_docstr: Applies some basic trade analysis for a trading strategy (as defined by TradingModel). Use PyFolio to create some
  basic trading statistics. Also allows you test multiple parameters for a specific strategy (like TC).
class_docstr_tok: ["Applies","some","basic","trade","analysis","for","a","trading","strategy","(","as","defined","by","TradingModel",")",".","Use","PyFolio","to","create","some","basic","trading","statistics",".","Also","allows","you","test","multiple","parameters","for","a","specific","strategy","(","like","TC",")","."]
docstr: run_excel_trade_report - Creates an Excel spreadsheet with model returns and latest trades
  
  Parameters
  ----------
  trading_model : TradingModel
      defining trading strategy (can be a list)
docstr_tok: ["run_excel_trade_report","-","Creates","an","Excel","spreadsheet","with","model","returns","and","latest","trades","Parameters","--","--","--","--","--","trading_model",":","TradingModel","defining","trading","strategy","(","can","be","a","list",")"]
code: def run_excel_trade_report(
      self, trading_model, excel_file="model.xlsx"
  ):
      """
      run_excel_trade_report - Creates an Excel spreadsheet with model returns and latest trades
  
      Parameters
      ----------
      trading_model : TradingModel
          defining trading strategy (can be a list)
  
      """
  
      trading_model_list = trading_model
  
      if not (isinstance(trading_model_list, list)):
          trading_model_list = [trading_model]
  
      writer = pandas.ExcelWriter(excel_file, engine="xlsxwriter")
  
      for tm in trading_model_list:
          strategy_name = tm.FINAL_STRATEGY
          returns = tm.strategy_group_benchmark_pnl()
  
          returns.to_excel(
              writer,
              sheet_name=strategy_name + " rets",
              engine="xlsxwriter",
          )
  
          # write raw position/trade sizes
          self.save_positions_trades(
              tm,
              tm.strategy_signal(),
              tm.strategy_trade(),
              "pos",
              "trades",
              writer,
          )
  
          if hasattr(tm, "_strategy_signal_notional"):
              signal_notional = tm.strategy_signal_notional()
              trading_notional = tm.strategy_signal_notional()
  
              if (
                  signal_notional is not None
                  and trading_notional is not None
              ):
                  # write position/trade sizes scaled by notional
                  self.save_positions_trades(
                      tm,
                      signal_notional,
                      trading_notional,
                      "pos - Not",
                      "trades - Not",
                      writer,
                  )
  
          if hasattr(tm, "_strategy_signal_contracts"):
              signal_contracts = tm.strategy_signal_contracts()
              trade_contracts = tm.strategy_trade_contracts()
  
              if (
                  signal_contracts is not None
                  and trade_contracts is not None
              ):
                  # write position/trade sizes in terms of contract sizes
                  self.save_positions_trades(
                      tm,
                      signal_contracts,
                      trade_contracts,
                      "pos - Cont",
                      "trades - Cont",
                      writer,
                  )
  
      # TODO Add summary sheet comparing return statistics for all the different models in the list
  
      writer.save()
      writer.close()
  
imports: import datetime
  import pandas
  import copy
  from chartpy import Chart, Style, ChartConstants
  from findatapy.timeseries import Calculations, Timezone
  from findatapy.util.loggermanager import LoggerManager
  from finmarketpy.backtest import Backtest
  from finmarketpy.util.marketconstants import MarketConstants
  from findatapy.util.swimpool import SwimPool
label_desc: Use image node_id 3 for calling the TradeAnalysis obj's underlying member method code with example usage: obj.run_excel_trade_report(trading_model, excel_file) without return types