Exemple #1
0
        public override string ToString()
        {
            var array = new string[] { Date.ToString(), Open.ToString(),
                High.ToString(), Low.ToString(),
                Close.ToString(), AdjClose.ToString(), Volume.ToString() };

            return(string.Join(",", array));
        }
Exemple #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Date.GetHashCode();
         hashCode = (hashCode * 397) ^ Open.GetHashCode();
         hashCode = (hashCode * 397) ^ High.GetHashCode();
         hashCode = (hashCode * 397) ^ Low.GetHashCode();
         hashCode = (hashCode * 397) ^ Close.GetHashCode();
         hashCode = (hashCode * 397) ^ AdjClose.GetHashCode();
         hashCode = (hashCode * 397) ^ Volume.GetHashCode();
         return(hashCode);
     }
 }
Exemple #3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Date != null)
                {
                    hashCode = hashCode * 59 + Date.GetHashCode();
                }
                if (Symbol != null)
                {
                    hashCode = hashCode * 59 + Symbol.GetHashCode();
                }
                if (Exchange != null)
                {
                    hashCode = hashCode * 59 + Exchange.GetHashCode();
                }

                hashCode = hashCode * 59 + Open.GetHashCode();

                hashCode = hashCode * 59 + High.GetHashCode();

                hashCode = hashCode * 59 + Low.GetHashCode();

                hashCode = hashCode * 59 + Close.GetHashCode();

                hashCode = hashCode * 59 + Volume.GetHashCode();

                hashCode = hashCode * 59 + AdjOpen.GetHashCode();

                hashCode = hashCode * 59 + AdjHigh.GetHashCode();

                hashCode = hashCode * 59 + AdjLow.GetHashCode();

                hashCode = hashCode * 59 + AdjClose.GetHashCode();

                hashCode = hashCode * 59 + AdjVolume.GetHashCode();
                return(hashCode);
            }
        }
Exemple #4
0
        /// <summary>
        /// Returns true if OutputMarketIndex instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputMarketIndex to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputMarketIndex other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Symbol == other.Symbol ||
                     Symbol != null &&
                     Symbol.Equals(other.Symbol)
                 ) &&
                 (
                     Exchange == other.Exchange ||
                     Exchange != null &&
                     Exchange.Equals(other.Exchange)
                 ) &&
                 (
                     Open == other.Open ||

                     Open.Equals(other.Open)
                 ) &&
                 (
                     High == other.High ||

                     High.Equals(other.High)
                 ) &&
                 (
                     Low == other.Low ||

                     Low.Equals(other.Low)
                 ) &&
                 (
                     Close == other.Close ||

                     Close.Equals(other.Close)
                 ) &&
                 (
                     Volume == other.Volume ||

                     Volume.Equals(other.Volume)
                 ) &&
                 (
                     AdjOpen == other.AdjOpen ||

                     AdjOpen.Equals(other.AdjOpen)
                 ) &&
                 (
                     AdjHigh == other.AdjHigh ||

                     AdjHigh.Equals(other.AdjHigh)
                 ) &&
                 (
                     AdjLow == other.AdjLow ||

                     AdjLow.Equals(other.AdjLow)
                 ) &&
                 (
                     AdjClose == other.AdjClose ||

                     AdjClose.Equals(other.AdjClose)
                 ) &&
                 (
                     AdjVolume == other.AdjVolume ||

                     AdjVolume.Equals(other.AdjVolume)
                 ));
        }
Exemple #5
0
 private bool Equals(Stock other)
 {
     return(Date.Date.Equals(other.Date.Date) && Open.Equals(other.Open) && High.Equals(other.High) && Low.Equals(other.Low) && Close.Equals(other.Close) && AdjClose.Equals(other.AdjClose) && Volume.Equals(other.Volume));
 }