示例#1
0
        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;
            }
        }
示例#2
0
        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;
            }
        }
示例#3
0
        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);
        }
示例#4
0
        private OpenCloseType OnOrderCancelled(Order order)
        {
            OpenCloseType      OpenClose = OpenCloseHelper.GetOpenClose(order);
            MonoPositionRecord record    = GetPositionRecord(order.Side, OpenClose);

            ++record.CumCancelCnt;

            OnOrderRejected(order);

            return(OpenClose);
        }