public void UpdateHighLowWithHistoryQuotation(OverridedQuotation overridedQ)
 {
     if (this.high < overridedQ.high)
     {
         this.high = overridedQ.high;
         this.modifyState = ModifyState.Modified;
     }
     if (this.low > overridedQ.low)
     {
         this.low = overridedQ.low;
         this.modifyState = ModifyState.Modified;
     }
     //Update quotePolicy.high,low
     if (this.quotePolicy.OverrideHigh == null || (this.quotePolicy.OverrideHigh != null && this.quotePolicy.OverrideHigh < overridedQ.high))
     {
         this.quotePolicy.OverrideHigh = overridedQ.high;
     }
     if (this.quotePolicy.OverrideLow == null || (this.quotePolicy.OverrideLow != null && this.quotePolicy.OverrideLow > overridedQ.low))
     {
         this.quotePolicy.OverrideLow = overridedQ.low;
     }
 }
        public OverridedQuotation GetChanges(OverridedQuotation oq)
        {
            if (this.high != null && oq.high != null)
            {
                if ((double)this.high == (double)oq.high) this.high = null;
            }
            if (this.low != null && oq.low != null)
            {
                if ((double)this.low == (double)oq.low) this.low = null;
            }

            return this;
        }
        public void UpdateHighLow(OverridedQuotation overridedQ)
        {
            this.high = overridedQ.high;
            this.modifyState = ModifyState.Modified;

            this.low = overridedQ.low;
            this.modifyState = ModifyState.Modified;

            //Update quotePolicy.high,low

            this.quotePolicy.OverrideHigh = overridedQ.high;

            this.quotePolicy.OverrideLow = overridedQ.low;
        }
        public static OverridedQuotation CreateHistoryQuotation(Guid dealerID, Instrument instrument, QuotePolicyDetail quotePolicy, string timestamp, string origin, bool needApplyAutoAdjustPoints, bool highBid, bool lowBid)
        {
            OverridedQuotation overridedQuotation = new OverridedQuotation();
            overridedQuotation.modifyState = ModifyState.Added;

            overridedQuotation.quotePolicy = quotePolicy;
            overridedQuotation.instrument = instrument;
            overridedQuotation.timestamp = DateTime.Parse(timestamp);
            overridedQuotation.origin = Price.CreateInstance(origin, instrument.NumeratorUnit, instrument.Denominator);

            overridedQuotation.dealerID = dealerID;

            overridedQuotation.bid = needApplyAutoAdjustPoints ? overridedQuotation.origin + quotePolicy.AutoAdjustPoints : overridedQuotation.origin;
            overridedQuotation.ask = overridedQuotation.bid + quotePolicy.SpreadPoints;

            overridedQuotation.CalculateHiLo(highBid, lowBid);

            //overridedQuotation.high = highBid ? overridedQuotation.bid : overridedQuotation.ask;
            //overridedQuotation.low = lowBid ? overridedQuotation.bid : overridedQuotation.ask;

            return overridedQuotation;
        }