class_docstr: Since the goal is to support multiple exchanges, it makes sense to
  include additional stats in the portfolio object. This fills the role
  of Blotter and Portfolio in live mode.
  
  Instead of relying on the performance tracker, each exchange portfolio
  tracks its own holding. This offers a separation between tracking an
  exchange and the statistics of the algorithm.
docstr: Update the open orders and positions to apply an executed order.
  
  Unlike with backtesting, we do not need to add slippage and fees.
  The executed price includes transaction fees.
  
  Parameters
  ----------
  order: Order
  transaction: Transaction
docstr_tok: ["Update","the","open","orders","and","positions","to","apply","an","executed","order",".","Unlike","with","backtesting",",","we","do","not","need","to","add","slippage","and","fees",".","The","executed","price","includes","transaction","fees",".","Parameters","--","--","--","--","--","order",":","Order","transaction",":","Transaction"]
code: def execute_order(self, order, transaction):
      """
      Update the open orders and positions to apply an executed order.
  
      Unlike with backtesting, we do not need to add slippage and fees.
      The executed price includes transaction fees.
  
      Parameters
      ----------
      order: Order
      transaction: Transaction
  
      """
      log.debug("executing order {}".format(order.id))
      self._remove_open_order(order)
  
      order_position = (
          self.positions[order.asset]
          if order.asset in self.positions
          else None
      )
  
      if order_position is None:
          raise ValueError(
              "Trying to execute order for a position not held:"
              " {}".format(order.id)
          )
  
      self.capital_used += order.amount * transaction.price
  
      if order.amount > 0:
          if order_position.cost_basis > 0:
              order_position.cost_basis = np.average(
                  [order_position.cost_basis, transaction.price],
                  weights=[order_position.amount, order.amount],
              )
          else:
              order_position.cost_basis = transaction.price
  
      log.debug("updated portfolio with executed order")
  
file_path: catalyst/catalyst/exchange/exchange_portfolio.py
imports: import numpy
  from catalyst.constants import LOG_LEVEL
  from catalyst.protocol import Portfolio, Positions, Position
  from logbook import Logger
label_desc: Use image node_id 4 for calling the ExchangePortfolio obj's underlying member method code with example usage: obj.execute_order(order, transaction) without return types