public string ToJsonHex()
        {
            var data =
                $"['{Nonce.ToHex()}','{GasPrice.ToHex()}','{GasLimit.ToHex()}','{FeeCurrency.ToHex()}','{GatewayFeeRecipient.ToHex()}','{GatewayFee.ToHex()}','{ReceiveAddress.ToHex()}','{Value.ToHex()}','{ToHex(Data)}','{ChainId.ToHex()}','{RHash.ToHex()}','{SHash.ToHex()}'";

            if (Signature != null)
            {
                data = data + $", '{Signature.V.ToHex()}', '{Signature.R.ToHex()}', '{Signature.S.ToHex()}'";
            }
            return(data + "]");
        }
示例#2
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 :)

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

                hashCode = hashCode * 59 + FeeCurrency.GetHashCode();
                if (OrderId != null)
                {
                    hashCode = hashCode * 59 + OrderId.GetHashCode();
                }
                if (Timestamp != null)
                {
                    hashCode = hashCode * 59 + Timestamp.GetHashCode();
                }
                if (Price != null)
                {
                    hashCode = hashCode * 59 + Price.GetHashCode();
                }
                if (Iv != null)
                {
                    hashCode = hashCode * 59 + Iv.GetHashCode();
                }
                if (TradeId != null)
                {
                    hashCode = hashCode * 59 + TradeId.GetHashCode();
                }
                if (Fee != null)
                {
                    hashCode = hashCode * 59 + Fee.GetHashCode();
                }

                hashCode = hashCode * 59 + OrderType.GetHashCode();
                if (TradeSeq != null)
                {
                    hashCode = hashCode * 59 + TradeSeq.GetHashCode();
                }
                if (SelfTrade != null)
                {
                    hashCode = hashCode * 59 + SelfTrade.GetHashCode();
                }

                hashCode = hashCode * 59 + State.GetHashCode();
                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }
                if (IndexPrice != null)
                {
                    hashCode = hashCode * 59 + IndexPrice.GetHashCode();
                }
                if (Amount != null)
                {
                    hashCode = hashCode * 59 + Amount.GetHashCode();
                }
                if (InstrumentName != null)
                {
                    hashCode = hashCode * 59 + InstrumentName.GetHashCode();
                }

                hashCode = hashCode * 59 + TickDirection.GetHashCode();
                if (MatchingId != null)
                {
                    hashCode = hashCode * 59 + MatchingId.GetHashCode();
                }

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

            return
                ((
                     Direction == other.Direction ||

                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     FeeCurrency == other.FeeCurrency ||

                     FeeCurrency.Equals(other.FeeCurrency)
                 ) &&
                 (
                     OrderId == other.OrderId ||
                     OrderId != null &&
                     OrderId.Equals(other.OrderId)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ) &&
                 (
                     Iv == other.Iv ||
                     Iv != null &&
                     Iv.Equals(other.Iv)
                 ) &&
                 (
                     TradeId == other.TradeId ||
                     TradeId != null &&
                     TradeId.Equals(other.TradeId)
                 ) &&
                 (
                     Fee == other.Fee ||
                     Fee != null &&
                     Fee.Equals(other.Fee)
                 ) &&
                 (
                     OrderType == other.OrderType ||

                     OrderType.Equals(other.OrderType)
                 ) &&
                 (
                     TradeSeq == other.TradeSeq ||
                     TradeSeq != null &&
                     TradeSeq.Equals(other.TradeSeq)
                 ) &&
                 (
                     SelfTrade == other.SelfTrade ||
                     SelfTrade != null &&
                     SelfTrade.Equals(other.SelfTrade)
                 ) &&
                 (
                     State == other.State ||

                     State.Equals(other.State)
                 ) &&
                 (
                     Label == other.Label ||
                     Label != null &&
                     Label.Equals(other.Label)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ) &&
                 (
                     TickDirection == other.TickDirection ||

                     TickDirection.Equals(other.TickDirection)
                 ) &&
                 (
                     MatchingId == other.MatchingId ||
                     MatchingId != null &&
                     MatchingId.Equals(other.MatchingId)
                 ) &&
                 (
                     Liquidity == other.Liquidity ||

                     Liquidity.Equals(other.Liquidity)
                 ));
        }