parameters: (self, strategy_name: str)
docstring: Start a strategy.
docstring_summary: Start a strategy.
docstring_tokens: Start a strategy .
function: def start_strategy(self, strategy_name: str):
          """
          Start a strategy.
          """
          strategy = self.strategies[strategy_name]
          if not strategy.inited:
              self.write_log(f"策略{strategy.strategy_name}启动失败，请先初始化")
              return
  
          if strategy.trading:
              self.write_log(f"{strategy_name}已经启动，请勿重复操作")
              return
  
          # qry pos and acc
          m = Event(type=EventType.QRY, msgtype=MSG_TYPE.MSG_TYPE_QRY_POS)
          m.destination = strategy.api + '.' + strategy.account
          m.source = str(self.id)
          self._send_sock.send(m.serialize())
  
          m = Event(type=EventType.QRY,
                    msgtype=MSG_TYPE.MSG_TYPE_QRY_ACCOUNT)
          m.destination = strategy.api + '.' + strategy.account
          m.source = str(self.id)
          self._send_sock.send(m.serialize())
  
          self.call_strategy_func(strategy, strategy.on_start)
          strategy.trading = True
  
          self.put_strategy_event(strategy)
function_tokens: def start_strategy ( self , strategy_name : str ) : strategy = self . strategies [ strategy_name ] if not strategy . inited : self . write_log ( f"策略{strategy.strategy_name}启动失败，请先初始化") return if strategy . trading : self . write_log ( f"{strategy_name}已经启动，请勿重复操作") return # qry pos and acc m = Event ( type = EventType . QRY , msgtype = MSG_TYPE . MSG_TYPE_QRY_POS ) m . destination = strategy . api + '.' + strategy . account m . source = str ( self . id ) self . _send_sock . send ( m . serialize ( ) ) m = Event ( type = EventType . QRY , msgtype = MSG_TYPE . MSG_TYPE_QRY_ACCOUNT ) m . destination = strategy . api + '.' + strategy . account m . source = str ( self . id ) self . _send_sock . send ( m . serialize ( ) ) self . call_strategy_func ( strategy , strategy . on_start ) strategy . trading = True self . put_strategy_event ( strategy )