code: def _execute(position, order, size, price, partial):
      # Find position and do a real update - accounting happens here
      pprice_orig = position.price
      psize, pprice, opened, closed = position.update(size, price)
  
      comminfo = order.comminfo
      closedvalue = comminfo.getoperationcost(closed, pprice_orig)
      closedcomm = comminfo.getcommission(closed, price)
  
      openedvalue = comminfo.getoperationcost(opened, price)
      openedcomm = comminfo.getcommission(opened, price)
  
      pnl = comminfo.profitandloss(-closed, pprice_orig, price)
      margin = comminfo.getvaluesize(size, price)
  
      order.execute(
          order.data.datetime[0],
          size,
          price,
          closed,
          closedvalue,
          closedcomm,
          opened,
          openedvalue,
          openedcomm,
          margin,
          pnl,
          psize,
          pprice,
      )  # pnl
  
      if partial:
          order.partial()
      else:
          order.completed()
  
file_path: backtrader/tests/test_order.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import backtrader
  from backtrader import Order, Position
label_desc: Use image node_id 1 for calling a global function with example usage: _execute(position, order, size, price, partial) without return types