public Order GetOrder(int CurrentOrderID) { try { Order order = new Order(); if (BuyrOrderStatus.Equals(ApplicationHelper.EMPTY)) { BuyOrderID = CurrentOrderID; order = ApplicationHelper.MarketOrder(CurrentOrderID, ApplicationHelper.BUY, ContractQuantity); BuyrOrderStatus = ApplicationHelper.Order_status_PreSubmitted; return(order); //ibClient.placeOrder(CurrentOrderID, contract,order); } if (BuyrOrderStatus.Equals(ApplicationHelper.Order_status_Filled)) { TrailingOrderID = CurrentOrderID; order = ApplicationHelper.TralingStop(CurrentOrderID, ApplicationHelper.BUY, ContractQuantity, 0, TrailingStopPrice); TrailingOrderStatus = ApplicationHelper.Order_status_PreSubmitted; return(order); //ibClient.placeOrder(CurrentOrderID, contract, order); } order.OrderId = 0; return(order); } catch (Exception ex) { throw ex; } }
private void Submit() { try { if (BuyrOrderStatus.Equals(ApplicationHelper.EMPTY)) { Order order = ApplicationHelper.MarketOrder(CurrentOrderID, ApplicationHelper.BUY, ContractQuantity); ibClient.placeOrder(CurrentOrderID, contract, order); } if (BuyrOrderStatus.Equals(ApplicationHelper.FILLED)) { Order order = ApplicationHelper.TralingStop(CurrentOrderID, ApplicationHelper.BUY, ContractQuantity, 0, TrailingStopPrice); ibClient.placeOrder(CurrentOrderID, contract, order); } } catch (Exception ex) { throw ex; } }