Exemple #1
0
        /// <summary>Check this order against the limits given in 'pair'</summary>
        public Exception Validate(TradePair pair)
        {
            if (PriceQ2B <= 0m)
            {
                return(new Exception($"Offer price ({PriceQ2B.ToString(6)}) is <= 0"));
            }

            if (!pair.AmountRangeBase.Contains(AmountBase))
            {
                return(new Exception($"Offer amount ({AmountBase.ToString(6)}) is not within the valid range: [{pair.AmountRangeBase.Beg},{pair.AmountRangeBase.End}]"));
            }

            if (!pair.AmountRangeQuote.Contains(AmountQuote))
            {
                return(new Exception($"Offer amount ({AmountQuote.ToString(6)}) is not within the valid range: [{pair.AmountRangeQuote.Beg},{pair.AmountRangeQuote.End}]"));
            }

            return(null);
        }
Exemple #2
0
 /// <summary>Orders are compared by price</summary>
 public int CompareTo(Offer rhs) => PriceQ2B.CompareTo(rhs.PriceQ2B);