Exemplo n.º 1
0
        public bool UpdateRealProperties(DisplayRealData displayData)
        {
            try
            {
                this.CodeInfo.Code   = displayData.Code;
                this.CodeInfo.Name   = displayData.Name;
                this.Position        = displayData.ChiCangLiang;
                this.BidHand[0]      = displayData.StBuyCount;
                this.BidPrice[0]     = displayData.StBuyPrice;
                this.AskHand[0]      = displayData.StSellCount;
                this.AskPrice[0]     = displayData.StSellPrice;
                this.LowerLimitPrice = displayData.DownStopPrice;
                this.Sum             = displayData.I64Sum;

                this.SettlmentPrice      = displayData.ISettlementPrice;
                this.PrevSettlementPrice = displayData.PrevSettleMent;
                this.UpperLimitPrice     = displayData.UpStopPrice;
                this.Hand = displayData.CurrentHand;

                this.ClosePrice = displayData.IClose;

                this.MaxPrice = displayData.IMaxPrice;
                this.MinPrice = displayData.IMinPrice;
                this.NewPrice = displayData.INewPrice;

                this.OpenPrice = displayData.Open;

                this.PrevClose = displayData.PrevClose;

                this.Volumn            = displayData.Volumn;
                this.CodeInfo.ExchCode = CodeSetManager.ExNameToCtp(displayData.Market);
                this.PrevPosition      = displayData.PreChicang;
                this.PrevClose         = displayData.PrevClose;
                this.UpdateTime        = displayData.UpdateTime;
                return(true);
            }
            catch (Exception ex)
            {
                Util.Log_Error("exception: " + ex.Message);
                Util.Log_Error("exception: " + ex.StackTrace);
                return(false);
            }
        }
        public void InitProperties(DisplayRealData realData, int flipPrice)
        {
            this.ExecutePrice = realData.PrevSettleMent + flipPrice * 5;
            this.Code         = realData.Code;

            this.Code_C     = Code.Replace("IF", "IO") + "-C-" + ExecutePrice;
            this.Code_P     = Code.Replace("IF", "IO") + "-P-" + ExecutePrice;
            this.Hycs       = realData.Hycs;
            this.Code       = realData.Code;
            this.UiTime     = realData.UiTime;
            this.LogMessage = realData.LogMessage;
            this.Name       = realData.Name;

            double basePrice = realData.INewPrice - this.ExecutePrice;

            this.ChiCangLiang_C     = realData.ChiCangLiang + (ulong)r.Next(100) * 100;
            this.StBuyCount_C       = realData.StBuyCount + (uint)r.Next(10);
            this.StBuyPrice_C       = realData.StBuyPrice - this.ExecutePrice + r.NextDouble() * 10;
            this.StSellCount_C      = realData.StSellCount + (uint)r.Next(10);
            this.StSellPrice_C      = realData.StSellPrice - this.ExecutePrice + r.NextDouble() * 10;
            this.DownStopPrice_C    = (basePrice + 10) * 1.1;
            this.I64Sum_C           = realData.I64Sum + (ulong)r.Next(100);
            this.ICurrentSu_C       = realData.ICurrentSum + r.Next(100);
            this.ISettlementPrice_C = basePrice + r.NextDouble() * 10;
            this.PrevSettleMent_C   = basePrice + r.NextDouble() * 10;
            this.UpStopPrice_C      = (basePrice - 10) * 0.9;
            this.CurrentHand_C      = realData.CurrentHand + (uint)r.Next(100);
            this.I64Outside_C       = realData.I64Outside + r.Next(100);
            this.IClose_C           = basePrice + r.Next(100);
            this.IDealNumber_C      = realData.IDealNumber + r.Next(100);
            this.IMaxPrice_C        = realData.IMaxPrice - realData.PrevSettleMent;
            this.IMinPrice_C        = realData.IMinPrice - realData.PrevSettleMent;
            this.INewPrice_C        = basePrice + r.Next(100);
            this.LastINewPrice_C    = this.INewPrice_C + r.Next(-2, 1);

            this.Open_C           = realData.Open - realData.PrevSettleMent + r.Next(100);
            this.NTime_C          = realData.NTime;
            this.PrevClose_C      = realData.PrevClose - realData.PrevSettleMent + r.Next(100);
            this.UsUpdateNumber_C = realData.UsUpdateNumber;
            this.Volumn_C         = realData.Volumn + (ulong)r.Next(100);


            this.ChiCangLiang_P     = realData.ChiCangLiang + (ulong)r.Next(100) * 100;
            this.StBuyCount_P       = realData.StBuyCount + (uint)r.Next(10);
            this.StBuyPrice_P       = realData.StBuyPrice - this.ExecutePrice + r.NextDouble() * 10;
            this.StSellCount_P      = realData.StSellCount + (uint)r.Next(10);
            this.StSellPrice_P      = realData.StSellPrice - this.ExecutePrice + r.NextDouble() * 10;
            this.DownStopPrice_P    = (basePrice + 10) * 1.1;
            this.I64Sum_P           = realData.I64Sum + (ulong)r.Next(100);
            this.ICurrentSu_P       = realData.ICurrentSum + r.Next(100);
            this.ISettlementPrice_P = basePrice + r.NextDouble() * 10;
            this.PrevSettleMent_P   = basePrice + r.NextDouble() * 10;
            this.UpStopPrice_P      = (basePrice - 10) * 0.9;
            this.CurrentHand_P      = realData.CurrentHand + (uint)r.Next(100);
            this.I64Outside_P       = realData.I64Outside + r.Next(100);
            this.IClose_P           = basePrice + r.Next(100);
            this.IDealNumber_P      = realData.IDealNumber + r.Next(100);
            this.IMaxPrice_P        = realData.IMaxPrice - realData.PrevSettleMent;
            this.IMinPrice_P        = realData.IMinPrice - realData.PrevSettleMent;
            this.INewPrice_P        = basePrice + r.Next(100);
            this.LastINewPrice_P    = this.INewPrice_P + r.Next(-2, 1);
            this.Open_P             = realData.Open - realData.PrevSettleMent + r.Next(100);
            this.NTime_P            = realData.NTime;
            this.PrevClose_P        = realData.PrevClose - realData.PrevSettleMent + r.Next(100);
            this.UsUpdateNumber_P   = realData.UsUpdateNumber;
            this.Volumn_P           = realData.Volumn + (ulong)r.Next(100);
        }