Show / Hide Table of Contents

Struct XrplQuality

rippled's Quality: the exchange rate of an offer, in / out, in the 64-bit encoding the ledger sorts order books by - the exponent plus 100 in the top byte, the 16-digit mantissa below it.

Namespace: Xrpl.Amounts
Assembly: Xrpl.dll
Syntax
public readonly struct XrplQuality
Remarks

A lower encoded value is a better quality: the taker gets more for less. The comparison operators follow rippled's: a < b means a is the worse quality.

Constructors

| Edit this page View Source

XrplQuality(ulong)

A quality from its 64-bit encoding.

Declaration
public XrplQuality(ulong value)
Parameters
Type Name Description
ulong value

Properties

| Edit this page View Source

Rate

The rate in / out the encoding holds (Quality::rate()); zero for the zero quality.

Declaration
public XrplNumber Rate { get; }
Property Value
Type Description
XrplNumber
| Edit this page View Source

Value

The 64-bit encoding. Zero is the quality of an offer that gives nothing.

Declaration
public ulong Value { get; }
Property Value
Type Description
ulong

Methods

| Edit this page View Source

CeilIn(XrplAmount, XrplAmount, XrplAmount, LedgerRules)

Quality::ceilIn: the offer's amounts cut down so it takes at most limit, the output recomputed at this quality with the legacy DivRound(XrplAmount, XrplAmount, IssuedCurrency, bool, LedgerRules), rounded up, and never above what the offer gives.

Declaration
public (XrplAmount In, XrplAmount Out) CeilIn(XrplAmount @in, XrplAmount @out, XrplAmount limit, LedgerRules rules = null)
Parameters
Type Name Description
XrplAmount in
XrplAmount out
XrplAmount limit
LedgerRules rules
Returns
Type Description
(XrplAmount In, XrplAmount Out)
| Edit this page View Source

CeilInStrict(XrplAmount, XrplAmount, XrplAmount, bool, LedgerRules)

Quality::ceilInStrict: CeilIn(XrplAmount, XrplAmount, XrplAmount, LedgerRules) with DivRoundStrict(XrplAmount, XrplAmount, IssuedCurrency, bool, LedgerRules) in the requested direction.

Declaration
public (XrplAmount In, XrplAmount Out) CeilInStrict(XrplAmount @in, XrplAmount @out, XrplAmount limit, bool roundUp, LedgerRules rules = null)
Parameters
Type Name Description
XrplAmount in
XrplAmount out
XrplAmount limit
bool roundUp
LedgerRules rules
Returns
Type Description
(XrplAmount In, XrplAmount Out)
| Edit this page View Source

CeilOut(XrplAmount, XrplAmount, XrplAmount, LedgerRules)

Quality::ceilOut: the offer's amounts cut down so it gives at most limit, the input recomputed at this quality with the legacy MulRound(XrplAmount, XrplAmount, IssuedCurrency, bool, LedgerRules), rounded up, and never above what the offer takes.

Declaration
public (XrplAmount In, XrplAmount Out) CeilOut(XrplAmount @in, XrplAmount @out, XrplAmount limit, LedgerRules rules = null)
Parameters
Type Name Description
XrplAmount in
XrplAmount out
XrplAmount limit
LedgerRules rules
Returns
Type Description
(XrplAmount In, XrplAmount Out)
| Edit this page View Source

CeilOutStrict(XrplAmount, XrplAmount, XrplAmount, bool, LedgerRules)

Quality::ceilOutStrict: CeilOut(XrplAmount, XrplAmount, XrplAmount, LedgerRules) with MulRoundStrict(XrplAmount, XrplAmount, IssuedCurrency, bool, LedgerRules) in the requested direction.

Declaration
public (XrplAmount In, XrplAmount Out) CeilOutStrict(XrplAmount @in, XrplAmount @out, XrplAmount limit, bool roundUp, LedgerRules rules = null)
Parameters
Type Name Description
XrplAmount in
XrplAmount out
XrplAmount limit
bool roundUp
LedgerRules rules
Returns
Type Description
(XrplAmount In, XrplAmount Out)
| Edit this page View Source

CompareTo(XrplQuality)

Orders qualities from worse to better: a better quality compares greater.

Declaration
public int CompareTo(XrplQuality other)
Parameters
Type Name Description
XrplQuality other
Returns
Type Description
int
| Edit this page View Source

Equals(object)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with the current instance.

Returns
Type Description
bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Overrides
System.ValueType.Equals(object)
| Edit this page View Source

Equals(XrplQuality)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(XrplQuality other)
Parameters
Type Name Description
XrplQuality other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the other parameter; otherwise, false.

| Edit this page View Source

FromAmounts(XrplAmount, XrplAmount, LedgerRules)

The quality of an offer that takes in and gives out (Quality(Amounts), getRate(out, in)).

Declaration
public static XrplQuality FromAmounts(XrplAmount @in, XrplAmount @out, LedgerRules rules = null)
Parameters
Type Name Description
XrplAmount in
XrplAmount out
LedgerRules rules
Returns
Type Description
XrplQuality
| Edit this page View Source

FromBookDirectory(string)

The quality an order book directory is sorted by: the last 16 hex digits of its index, the BookDirectory of an offer. rippled crosses an offer at this quality, set when the offer was placed, not at the ratio of what the offer has left.

Declaration
public static XrplQuality FromBookDirectory(string bookDirectory)
Parameters
Type Name Description
string bookDirectory
Returns
Type Description
XrplQuality
Exceptions
Type Condition
FormatException

The text is not a 64-character hex index.

| Edit this page View Source

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
System.ValueType.GetHashCode()
| Edit this page View Source

Round(int)

Quality::round: the quality with its mantissa rounded up, to a worse quality, to digits significant digits - the rounding a tick size applies to an offer.

Declaration
public XrplQuality Round(int digits)
Parameters
Type Name Description
int digits

The significant digits to keep, 1 to 16; 16 leaves the quality as it is.

Returns
Type Description
XrplQuality
Exceptions
Type Condition
ArgumentOutOfRangeException

digits is outside 1 to 16.

| Edit this page View Source

ToString()

The encoding in hex, as rippled logs it.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
System.ValueType.ToString()
| Edit this page View Source

WithinRelativeDistance(XrplQuality, XrplQuality, XrplNumber, LedgerRules)

Whether two qualities are within a relative distance of each other, as rippled's withinRelativeDistance(Quality, Quality, Number) decides it from their rates.

Declaration
public static bool WithinRelativeDistance(XrplQuality calculated, XrplQuality requested, XrplNumber distance, LedgerRules rules = null)
Parameters
Type Name Description
XrplQuality calculated
XrplQuality requested
XrplNumber distance
LedgerRules rules
Returns
Type Description
bool

Operators

| Edit this page View Source

operator ==(XrplQuality, XrplQuality)

Declaration
public static bool operator ==(XrplQuality left, XrplQuality right)
Parameters
Type Name Description
XrplQuality left
XrplQuality right
Returns
Type Description
bool
| Edit this page View Source

operator >(XrplQuality, XrplQuality)

left is the better quality.

Declaration
public static bool operator >(XrplQuality left, XrplQuality right)
Parameters
Type Name Description
XrplQuality left
XrplQuality right
Returns
Type Description
bool
| Edit this page View Source

operator >=(XrplQuality, XrplQuality)

Declaration
public static bool operator >=(XrplQuality left, XrplQuality right)
Parameters
Type Name Description
XrplQuality left
XrplQuality right
Returns
Type Description
bool
| Edit this page View Source

operator !=(XrplQuality, XrplQuality)

Declaration
public static bool operator !=(XrplQuality left, XrplQuality right)
Parameters
Type Name Description
XrplQuality left
XrplQuality right
Returns
Type Description
bool
| Edit this page View Source

operator <(XrplQuality, XrplQuality)

left is the worse quality.

Declaration
public static bool operator <(XrplQuality left, XrplQuality right)
Parameters
Type Name Description
XrplQuality left
XrplQuality right
Returns
Type Description
bool
| Edit this page View Source

operator <=(XrplQuality, XrplQuality)

Declaration
public static bool operator <=(XrplQuality left, XrplQuality right)
Parameters
Type Name Description
XrplQuality left
XrplQuality right
Returns
Type Description
bool
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX