Example #1
0
        public void GetHashCode_ReturnsSameHasCode_ForSameTradeDates()
        {
            TradeDate tradeDateOne = new TradeDate(new DateTime(2018, 12, 31), true, true, true);
            TradeDate tradeDateTwo = new TradeDate(new DateTime(2018, 12, 31), true, true, true);

            var hashCodeOne = tradeDateOne.GetHashCode();
            var hashCodeTwo = tradeDateTwo.GetHashCode();

            hashCodeTwo.Should().Be(hashCodeOne);
        }
Example #2
0
        public void GetHashCode_ReturnsDifferentHashCode_ForTwoDifferentTradeDates()
        {
            TradeDate tradeDateOne = new TradeDate(new DateTime(2018, 12, 30), false, false, false);
            TradeDate tradeDateTwo = new TradeDate(new DateTime(2018, 12, 31), true, true, true);

            var hashCodeOne = tradeDateOne.GetHashCode();
            var hashCodeTwo = tradeDateTwo.GetHashCode();

            hashCodeOne.Should().NotBe(hashCodeTwo);
        }
Example #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 29 + Symbol.GetHashCode();
         hash = hash * 29 + CorrectionType.GetHashCode();
         hash = hash * 29 + TradeDate.GetHashCode();
         hash = hash * 29 + TradeTime.GetHashCode();
         hash = hash * 29 + TradePrice.GetHashCode();
         hash = hash * 29 + TradeSize.GetHashCode();
         hash = hash * 29 + TickId.GetHashCode();
         hash = hash * 29 + TradeConditions.GetHashCode();
         hash = hash * 29 + TradeMarketCentre.GetHashCode();
         return(hash);
     }
 }
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 17;
                hash = hash * 29 + RequestId != null?RequestId.GetHashCode() : 0;

                hash = hash * 29 + Symbol.GetHashCode();
                hash = hash * 29 + ExchangeId.GetHashCode();
                hash = hash * 29 + SecurityType.GetHashCode();
                hash = hash * 29 + (Last.HasValue ? Last.GetHashCode() : 0);
                hash = hash * 29 + (TradeSize.HasValue ? TradeSize.GetHashCode() : 0);
                hash = hash * 29 + (TradedMarket.HasValue ? TradedMarket.GetHashCode() : 0);
                hash = hash * 29 + (TradeDate.HasValue ? TradeDate.GetHashCode() : 0);
                hash = hash * 29 + (TradeTime.HasValue ? TradeTime.GetHashCode() : 0);
                hash = hash * 29 + (Open.HasValue ? Open.GetHashCode() : 0);
                hash = hash * 29 + (High.HasValue ? High.GetHashCode() : 0);
                hash = hash * 29 + (Low.HasValue ? Low.GetHashCode() : 0);
                hash = hash * 29 + (Close.HasValue ? Close.GetHashCode() : 0);
                hash = hash * 29 + (Bid.HasValue ? Bid.GetHashCode() : 0);
                hash = hash * 29 + (BidMarket.HasValue ? BidMarket.GetHashCode() : 0);
                hash = hash * 29 + (BidSize.HasValue ? BidSize.GetHashCode() : 0);
                hash = hash * 29 + (Ask.HasValue ? Ask.GetHashCode() : 0);
                hash = hash * 29 + (AskMarket.HasValue ? AskMarket.GetHashCode() : 0);
                hash = hash * 29 + (AskSize.HasValue ? AskSize.GetHashCode() : 0);
                hash = hash * 29 + (Volume.HasValue ? Volume.GetHashCode() : 0);
                hash = hash * 29 + (PDayVolume.HasValue ? PDayVolume.GetHashCode() : 0);
                hash = hash * 29 + (UpVolume.HasValue ? UpVolume.GetHashCode() : 0);
                hash = hash * 29 + (DownVolume.HasValue ? DownVolume.GetHashCode() : 0);
                hash = hash * 29 + (NeutralVolume.HasValue ? NeutralVolume.GetHashCode() : 0);
                hash = hash * 29 + (TradeCount.HasValue ? TradeCount.GetHashCode() : 0);
                hash = hash * 29 + (UpTrades.HasValue ? UpTrades.GetHashCode() : 0);
                hash = hash * 29 + (DownTrades.HasValue ? DownTrades.GetHashCode() : 0);
                hash = hash * 29 + (NeutralTrades.HasValue ? NeutralTrades.GetHashCode() : 0);
                hash = hash * 29 + (VWAP.HasValue ? VWAP.GetHashCode() : 0);
                hash = hash * 29 + (MutualDiv.HasValue ? MutualDiv.GetHashCode() : 0);
                hash = hash * 29 + (SevenDayYield.HasValue ? SevenDayYield.GetHashCode() : 0);
                hash = hash * 29 + (OpenInterest.HasValue ? OpenInterest.GetHashCode() : 0);
                hash = hash * 29 + (Settlement.HasValue ? Settlement.GetHashCode() : 0);
                hash = hash * 29 + (SettlementDate.HasValue ? SettlementDate.GetHashCode() : 0);
                hash = hash * 29 + (ExpirationDate.HasValue ? ExpirationDate.GetHashCode() : 0);
                hash = hash * 29 + (Strike.HasValue ? Strike.GetHashCode() : 0);
                return(hash);
            }
        }
Example #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (InvestorId.Length != 0)
            {
                hash ^= InvestorId.GetHashCode();
            }
            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (OrderRef.Length != 0)
            {
                hash ^= OrderRef.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (Direction != 0)
            {
                hash ^= Direction.GetHashCode();
            }
            if (OffsetFlag != 0)
            {
                hash ^= OffsetFlag.GetHashCode();
            }
            if (HedgeFlag != 0)
            {
                hash ^= HedgeFlag.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (Volume != 0)
            {
                hash ^= Volume.GetHashCode();
            }
            if (TradeDate.Length != 0)
            {
                hash ^= TradeDate.GetHashCode();
            }
            if (TradeTime.Length != 0)
            {
                hash ^= TradeTime.GetHashCode();
            }
            if (OrderLocalId.Length != 0)
            {
                hash ^= OrderLocalId.GetHashCode();
            }
            if (TradingDay.Length != 0)
            {
                hash ^= TradingDay.GetHashCode();
            }
            if (BrokerOrderSeq != 0)
            {
                hash ^= BrokerOrderSeq.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }