Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# self.set_market

strategies.strategy.Strategy.set_market(self, market)

  Set the market for trading hours.

  Setting the market will determine the trading hours for live trading and for Yahoo backtesting. Not applicable to Pandas backtesting.

  Crypto markets are always 24/7. NASDAQ is default.

  Parameters:

    market (str) –

    Short form for the markets. List of markets available are:

    ”MarketCalendar”, “ASX”, “BMF”, “CFE”, “NYSE”, “stock”, “NASDAQ”, “BATS”, “CME_Equity”, “CBOT_Equity”, “CME_Agriculture”, “CBOT_Agriculture”, “COMEX_Agriculture”, “NYMEX_Agriculture”, “CME_Rate”, “CBOT_Rate”, “CME_InterestRate”, “CBOT_InterestRate”, “CME_Bond”, “CBOT_Bond”, “EUREX”, “HKEX”, “ICE”, “ICEUS”, “NYFE”, “JPX”, “LSE”, “OSE”, “SIX”, “SSE”, “TSX”, “TSXV”, “BSE”, “TASE”, “TradingCalendar”, “ASEX”, “BVMF”, “CMES”, “IEPA”, “XAMS”, “XASX”, “XBKK”, “XBOG”, “XBOM”, “XBRU”, “XBUD”, “XBUE”, “XCBF”, “XCSE”, “XDUB”, “XFRA”, “XETR”, “XHEL”, “XHKG”, “XICE”, “XIDX”, “XIST”, “XJSE”, “XKAR”, “XKLS”, “XKRX”, “XLIM”, “XLIS”, “XLON”, “XMAD”, “XMEX”, “XMIL”, “XMOS”, “XNYS”, “XNZE”, “XOSL”, “XPAR”, “XPHS”, “XPRA”, “XSES”, “XSGO”, “XSHG”, “XSTO”, “XSWX”, “XTAE”, “XTAI”, “XTKS”, “XTSE”, “XWAR”, “XWBO”, “us_futures”, “24/7”, “24/5”,

    (default: NASDAQ)

    The market to set.

  Return type:

    None

  Example

      >>> # Set the market to 24/7
      >>> def initialize(self):
      >>>    # Set the market to 24/7
      >>>    self.set_market('24/7')

      >>> # Set the market to NASDAQ
      >>> self.set_market('NASDAQ')

      >>> # Set the market to NYSE
      >>> self.set_market('NYSE')

      >>> # Set the market to 24/5
      >>> self.set_market('24/5')

      >>> # Set the market to us_futures
      >>> self.set_market('us_futures')

      >>> # Set the market to stock
      >>> self.set_market('stock')

      >>> # Set the market to BATS
      >>> self.set_market('BATS')

      >>> # Set the market to CME_Equity
      >>> self.set_market('CME_Equity')