/// <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 :) hashCode = hashCode * 59 + Direction.GetHashCode(); if (ReduceOnly != null) { hashCode = hashCode * 59 + ReduceOnly.GetHashCode(); } if (Triggered != null) { hashCode = hashCode * 59 + Triggered.GetHashCode(); } if (OrderId != null) { hashCode = hashCode * 59 + OrderId.GetHashCode(); } if (Price != null) { hashCode = hashCode * 59 + Price.GetHashCode(); } hashCode = hashCode * 59 + TimeInForce.GetHashCode(); if (Api != null) { hashCode = hashCode * 59 + Api.GetHashCode(); } hashCode = hashCode * 59 + OrderState.GetHashCode(); if (Implv != null) { hashCode = hashCode * 59 + Implv.GetHashCode(); } hashCode = hashCode * 59 + Advanced.GetHashCode(); if (PostOnly != null) { hashCode = hashCode * 59 + PostOnly.GetHashCode(); } if (Usd != null) { hashCode = hashCode * 59 + Usd.GetHashCode(); } if (StopPrice != null) { hashCode = hashCode * 59 + StopPrice.GetHashCode(); } hashCode = hashCode * 59 + OrderType.GetHashCode(); if (LastUpdateTimestamp != null) { hashCode = hashCode * 59 + LastUpdateTimestamp.GetHashCode(); } hashCode = hashCode * 59 + OriginalOrderType.GetHashCode(); if (MaxShow != null) { hashCode = hashCode * 59 + MaxShow.GetHashCode(); } if (ProfitLoss != null) { hashCode = hashCode * 59 + ProfitLoss.GetHashCode(); } if (IsLiquidation != null) { hashCode = hashCode * 59 + IsLiquidation.GetHashCode(); } if (FilledAmount != null) { hashCode = hashCode * 59 + FilledAmount.GetHashCode(); } if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (Commission != null) { hashCode = hashCode * 59 + Commission.GetHashCode(); } if (Amount != null) { hashCode = hashCode * 59 + Amount.GetHashCode(); } hashCode = hashCode * 59 + Trigger.GetHashCode(); if (InstrumentName != null) { hashCode = hashCode * 59 + InstrumentName.GetHashCode(); } if (CreationTimestamp != null) { hashCode = hashCode * 59 + CreationTimestamp.GetHashCode(); } if (AveragePrice != null) { hashCode = hashCode * 59 + AveragePrice.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Order instances are equal /// </summary> /// <param name="other">Instance of Order to be compared</param> /// <returns>Boolean</returns> public bool Equals(Order other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Direction == other.Direction || Direction.Equals(other.Direction) ) && ( ReduceOnly == other.ReduceOnly || ReduceOnly != null && ReduceOnly.Equals(other.ReduceOnly) ) && ( Triggered == other.Triggered || Triggered != null && Triggered.Equals(other.Triggered) ) && ( OrderId == other.OrderId || OrderId != null && OrderId.Equals(other.OrderId) ) && ( Price == other.Price || Price != null && Price.Equals(other.Price) ) && ( TimeInForce == other.TimeInForce || TimeInForce.Equals(other.TimeInForce) ) && ( Api == other.Api || Api != null && Api.Equals(other.Api) ) && ( OrderState == other.OrderState || OrderState.Equals(other.OrderState) ) && ( Implv == other.Implv || Implv != null && Implv.Equals(other.Implv) ) && ( Advanced == other.Advanced || Advanced.Equals(other.Advanced) ) && ( PostOnly == other.PostOnly || PostOnly != null && PostOnly.Equals(other.PostOnly) ) && ( Usd == other.Usd || Usd != null && Usd.Equals(other.Usd) ) && ( StopPrice == other.StopPrice || StopPrice != null && StopPrice.Equals(other.StopPrice) ) && ( OrderType == other.OrderType || OrderType.Equals(other.OrderType) ) && ( LastUpdateTimestamp == other.LastUpdateTimestamp || LastUpdateTimestamp != null && LastUpdateTimestamp.Equals(other.LastUpdateTimestamp) ) && ( OriginalOrderType == other.OriginalOrderType || OriginalOrderType.Equals(other.OriginalOrderType) ) && ( MaxShow == other.MaxShow || MaxShow != null && MaxShow.Equals(other.MaxShow) ) && ( ProfitLoss == other.ProfitLoss || ProfitLoss != null && ProfitLoss.Equals(other.ProfitLoss) ) && ( IsLiquidation == other.IsLiquidation || IsLiquidation != null && IsLiquidation.Equals(other.IsLiquidation) ) && ( FilledAmount == other.FilledAmount || FilledAmount != null && FilledAmount.Equals(other.FilledAmount) ) && ( Label == other.Label || Label != null && Label.Equals(other.Label) ) && ( Commission == other.Commission || Commission != null && Commission.Equals(other.Commission) ) && ( Amount == other.Amount || Amount != null && Amount.Equals(other.Amount) ) && ( Trigger == other.Trigger || Trigger.Equals(other.Trigger) ) && ( InstrumentName == other.InstrumentName || InstrumentName != null && InstrumentName.Equals(other.InstrumentName) ) && ( CreationTimestamp == other.CreationTimestamp || CreationTimestamp != null && CreationTimestamp.Equals(other.CreationTimestamp) ) && ( AveragePrice == other.AveragePrice || AveragePrice != null && AveragePrice.Equals(other.AveragePrice) )); }