code: def build_order_from_open_order(openOrder, instrumentTraits):
      if openOrder.isBuy():
          action = broker.Order.Action.BUY
      elif openOrder.isSell():
          action = broker.Order.Action.SELL
      else:
          raise Exception("Invalid order type")
  
      ret = broker.LimitOrder(
          action,
          common.btc_symbol,
          openOrder.getPrice(),
          openOrder.getAmount(),
          instrumentTraits,
      )
      ret.setSubmitted(openOrder.getId(), openOrder.getDateTime())
      ret.setState(broker.Order.State.ACCEPTED)
      return ret
  
imports: import threading
  import time
  from six.moves import queue
  from pyalgotrade import broker
  from pyalgotrade.bitstamp import httpclient
  from pyalgotrade.bitstamp import common
label_desc: Use image node_id 1 for calling a global function with example usage: build_order_from_open_order(openOrder, instrumentTraits) and returns: ret