def obtain_executed_order_info(self): order = Order() order.item_code = self.get_chejan_data(FID.ITEM_CODE) if order.item_code[0] == 'A': order.item_code = order.item_code[1:] order.item_name = self.get_item_name(order.item_code) order.executed_time = self.get_chejan_data(FID.ORDER_EXECUTED_TIME) order.order_amount = self.get_chejan_data(FID.ORDER_AMOUNT, number=True) order.executed_amount = self.get_chejan_data(FID.UNIT_EXECUTED_AMOUNT, number=True) order.executed_amount_sum = self.get_chejan_data(FID.EXECUTED_AMOUNT, number=True) order.open_amount = self.get_chejan_data(FID.OPEN_AMOUNT, number=True) order.order_number = self.get_chejan_data(FID.ORDER_NUMBER) order.original_order_number = self.get_chejan_data(FID.ORIGINAL_ORDER_NUMBER) order.executed_order_number = self.get_chejan_data(FID.EXECUTED_ORDER_NUMBER) order.order_price = self.get_chejan_data(FID.ORDER_PRICE, number=True) order.executed_price = self.get_chejan_data(FID.UNIT_EXECUTED_PRICE, number=True) order.executed_price_avg = self.get_chejan_data(FID.EXECUTED_PRICE, number=True) order.order_position = self.get_chejan_data(FID.ORDER_POSITION) order.current_price = abs(self.get_chejan_data(FID.CURRENT_PRICE, number=True)) order.order_state = self.get_chejan_data(FID.ORDER_STATE) order.order_type = self.get_chejan_data(FID.ORDER_POSITION) order.transaction_type = self.get_chejan_data(FID.TRANSACTION_TYPE) order.transaction_price = self.get_chejan_data(FID.EXECUTED_PRICE, number=True) # order.volume = self.get_chejan_data(FID.VOLUME, number=True) # order.transaction_fee = self.get_chejan_data(FID.TRANSACTION_FEE, number=True) # order.tax = self.get_chejan_data(FID.TRANSACTION_TAX, number=True) if order.order_position in (SELL, CORRECT_SELL): order.executed_amount = -abs(order.executed_amount) self.update_execution_info(order)
def get_order_history(self, sTrCode, sRecordName, sScrNo, sPrevNext): number_of_order = self.get_repeat_count(sTrCode, sRecordName) if sPrevNext == '0': self.order_history.clear() for count in range(number_of_order): get_comm_data = self.new_get_comm_data(sTrCode, sRecordName, count) order = Order() order.item_code = str(get_comm_data(ITEM_CODE)) order.item_name = get_comm_data(ITEM_NAME) order.executed_time = get_comm_data(TIME) order.order_amount = get_comm_data(ORDER_AMOUNT) order.executed_amount_sum = get_comm_data(EXECUTED_ORDER_AMOUNT) order.open_amount = get_comm_data(OPEN_AMOUNT) order.order_number = get_comm_data(ORDER_NUMBER) order.original_order_number = get_comm_data(ORIGINAL_ORDER_NUMBER) order.order_price = get_comm_data(ORDER_PRICE) order.executed_price_avg = get_comm_data(EXECUTED_ORDER_PRICE) order.order_position = get_comm_data(ORDER_POSITION) order.order_state = get_comm_data(ORDER_STATE) self.order_history[order.order_number] = order if order.open_amount != 0: self.open_orders[order.order_number] = order if sPrevNext == '2': self.request_order_history('', sPrevNext) else: self.trader.display_order_history() self.trader.display_open_orders() self.info('Order history information') self.init_screen(sScrNo)