@check_is_trading
@export_as_api
@ExecutionContext.enforce_phase(EXECUTION_PHASE.HANDLE_BAR, EXECUTION_PHASE.SCHEDULED)
def order_shares(id_or_ins, amount, style=None):
 order_book_id = assure_order_book_id(id_or_ins)
 if (amount == 0):
  user_log.error(_('order_shares {order_book_id} amount is 0.').format(order_book_id=order_book_id))
  return
 round_lot = int(get_data_proxy().instrument(order_book_id).round_lot)
 amount = ((int(amount) // round_lot) * round_lot)
 bar_dict = ExecutionContext.get_current_bar_dict()
 order = get_simu_exchange().create_order(bar_dict, order_book_id, amount, style)
 return order.order_id

@ check_is_trading @ export_as_api @ ExecutionContext . enforce_phase ( EXECUTION_PHASE . HANDLE_BAR , EXECUTION_PHASE . SCHEDULED ) def order_shares ( id_or_ins , amount , style = None ) : order_book_id = assure_order_book_id ( id_or_ins ) if ( amount == 0 ) : user_log . error ( _ ( 'order_shares {order_book_id} amount is 0.' ) . format ( order_book_id = order_book_id ) ) return round_lot = int ( get_data_proxy ( ) . instrument ( order_book_id ) . round_lot ) amount = ( ( int ( amount ) // round_lot ) * round_lot ) bar_dict = ExecutionContext . get_current_bar_dict ( ) order = get_simu_exchange ( ) . create_order ( bar_dict , order_book_id , amount , style ) return order . order_id
place an order by specified number of shares .