internal void UpdateBestBuySell(Quotation newQuotation)
        {
            bool isNormal = this._Instrument.IsNormal;
            BSStatus bSStatus = this.BSStatus;

            this.Origin = newQuotation.Origin;
            if (this._BSStatus == BSStatus.Both)
            {
                this._BestBuyString = this.Ask;
                this._BestSellString = this.Bid;
                this.BestBuy = this.BestSell = this.GetBestBuySellString(this.Ask, this.Bid);
                this.AnswerPrice = this.BestBuy;
            }
            else
            {
                if (this._Instrument.IsNormal ^ (this._BSStatus == BSStatus.Buy))
                {
                    this.BestBuy = newQuotation.Bid;
                    this.AnswerPrice = this.BestSell;
                }
                else
                {
                    this.BestSell = newQuotation.Ask;
                    this.AnswerPrice = this.BestBuy;
                }
            }
        }
예제 #2
0
 public QuoteQuotation(Quotation quotation)
     : this()
 {
     this.Ask = quotation.Ask;
     this.Bid = quotation.Bid;
     this.High = quotation.High;
     this.InstrumentId = quotation.InstrumentId;
     this.LastConfirmOrigin = quotation.LastConfirmOrigin;
     this.Low = quotation.Low;
     this.Origin = quotation.Origin;
 }
예제 #3
0
        public static Quotation Create(double adjust, double origin, int numeratorUnit,
           int denominator, int autoPoint, int spread)
        {
            string validInt = @"^-?\d+$";
            Price originPrice;
            if (Regex.IsMatch(adjust.ToString(), validInt))
            {
                originPrice = Price.CreateInstance(origin, numeratorUnit, denominator);
                originPrice = Price.Adjust(originPrice, (int)adjust);
            }
            else
            {
                originPrice = Price.CreateInstance(adjust, numeratorUnit, denominator);
            }

            Quotation baseQuotation = new Quotation();
            if (originPrice != null)
            {
                baseQuotation.Origin = originPrice.ToPriceEntity().normalizedPrice;

                baseQuotation.Bid = (originPrice + autoPoint).ToPriceEntity().normalizedPrice;
                baseQuotation.Ask = (originPrice + autoPoint + spread).ToPriceEntity().normalizedPrice;
            }
            return baseQuotation;
        }
예제 #4
0
        public static Quotation Create(string quotationString)
        {
            Quotation baseQuotation = new Quotation();
            string[] contents = quotationString.Split('|');
            if (contents.Length == 6)
            {
                Guid instrumentId;
                if (Guid.TryParse(contents[0], out instrumentId))
                {
                    baseQuotation.InstrumentId = instrumentId;
                }
                baseQuotation.Origin = contents[1];
                baseQuotation.LastConfirmOrigin = contents[2];
                baseQuotation.Bid = contents[3];
                baseQuotation.Ask = contents[4];
                long ticks;
                if (long.TryParse(contents[5], out ticks))
                {
                    baseQuotation.TimeStamp = new DateTime(ticks);
                }
            }

            return baseQuotation;
        }