Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Symbol.Length != 0)
            {
                hash ^= Symbol.GetHashCode();
            }
            if (EuityMarket.Length != 0)
            {
                hash ^= EuityMarket.GetHashCode();
            }
            if (OrderDirection.Length != 0)
            {
                hash ^= OrderDirection.GetHashCode();
            }
            if (PriceType.Length != 0)
            {
                hash ^= PriceType.GetHashCode();
            }
            if (Size != 0)
            {
                hash ^= Size.GetHashCode();
            }
            if (EqtOrFut != false)
            {
                hash ^= EqtOrFut.GetHashCode();
            }
            if (FutureFlag.Length != 0)
            {
                hash ^= FutureFlag.GetHashCode();
            }
            if (FutureAccountType.Length != 0)
            {
                hash ^= FutureAccountType.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 2
0
        public PBMsgTrader.PBMsgOrderInsert CreateOrder(FutureFlag futureFlag)
        {
            PBMsgOrderInsert pb = new PBMsgOrderInsert();

            //pb.SetMsgId((int)MsgIdOrder.ID_ORDER_REQ_NEW);
            pb.InstrumentID        = mSymbolID;
            pb.VolumeTotalOriginal = mSize;

            switch (mOrderDirection)
            {
            case OrderDirection.Buy:
                pb.Direction = "0";
                break;

            case OrderDirection.Sell:
                pb.Direction = "1";
                break;

            case OrderDirection.Unknown:
                break;

            default:
                break;
            }

            switch (mExecuteType)
            {
            case ExecuteType.Market:
                pb.OrderPriceType      = ("1");
                pb.ContingentCondition = ("1");
                pb.TimeCondition       = ("1");
                LimitPrice             = 0.0;
                break;

            case ExecuteType.Limit:
                pb.OrderPriceType      = ("2");
                pb.ContingentCondition = ("1");
                pb.TimeCondition       = ("3");
                break;

            //case ExecuteType.STOP:
            //    pb.SetContingentCondition("2");
            //    pb.SetOrderPriceType("4");
            //    break;
            //case ExecuteType.STOPLIMIT:
            //    pb.SetOrderPriceType("2");
            //    pb.SetContingentCondition("2");
            //    break;
            default:
                pb.OrderPriceType      = ("4");
                pb.ContingentCondition = ("1");
                break;
            }

            pb.StopPrice  = (StopPrice);
            pb.LimitPrice = (LimitPrice);

            //开平
            switch (futureFlag)
            {
            case FutureFlag.Open:
                pb.CombOffsetFlag = ("0");
                break;

            case FutureFlag.Close:
                pb.CombOffsetFlag = ("1");
                break;

            case FutureFlag.Closetoday:
                pb.CombOffsetFlag = ("3");
                break;

            default:
                pb.CombOffsetFlag = ("0");
                break;
            }

            return(pb);
        }