private void OnOrderFilled(SmartQuant.Order order) { int index = order.Reports.Count - 1; double LastQty = order.Reports[index].LastQty; double LastPrice = order.Reports[index].LastPx; bool IsDone = order.IsDone; OpenCloseType OpenClose = OpenCloseHelper.GetOpenClose(order); MonoPositionRecord record = GetPositionRecord(order.Side, OpenClose); switch (OpenClose) { case OpenCloseType.Open: record.FilledOpen(LastQty, LastPrice); break; case OpenCloseType.Close: record.FilledClose(LastQty, LastPrice); break; case OpenCloseType.CloseToday: record.FilledCloseToday(LastQty, LastPrice); break; default: MessageBox.Show("Filled"); break; } }
private void OnPendingNewOrder(Order order) { double Qty = order.Qty; OpenCloseType OpenClose = OpenCloseHelper.GetOpenClose(order); MonoPositionRecord record = GetPositionRecord(order.Side, OpenClose); switch (OpenClose) { case OpenCloseType.Open: record.NewOrderOpen(Qty); break; case OpenCloseType.Close: record.NewOrderClose(Qty); break; case OpenCloseType.CloseToday: record.NewOrderCloseToday(Qty); break; default: MessageBox.Show("PendingNewOrder"); break; } }
private OpenCloseType OnOrderRejected(Order order) { OpenCloseType OpenClose = OpenCloseHelper.GetOpenClose(order); MonoPositionRecord record = GetPositionRecord(order.Side, OpenClose); double LeavesQty = order.LeavesQty; switch (OpenClose) { case OpenCloseType.Open: record.OrderRejectedOpen(LeavesQty); break; case OpenCloseType.Close: record.OrderRejectedClose(LeavesQty); break; case OpenCloseType.CloseToday: record.OrderRejectedCloseToday(LeavesQty); break; default: MessageBox.Show("OrderRejected"); break; } return(OpenClose); }
private OpenCloseType OnOrderCancelled(Order order) { OpenCloseType OpenClose = OpenCloseHelper.GetOpenClose(order); MonoPositionRecord record = GetPositionRecord(order.Side, OpenClose); ++record.CumCancelCnt; OnOrderRejected(order); return(OpenClose); }