Returns the sum of self and other.
Throws ParamError on overflow (or sign violation for unsigned
types).
Returns a fresh wrapper holding the same value.
Value types are cheap to copy. Ordinary setters already borrow/clone wrapper inputs; this method is a convenience when an explicit second wrapper object is useful.
Compares against other: -1, 0, or 1.
Divides by a number | bigint scalar.
Throws ParamError on division by zero, overflow, or an invalid
scalar.
Returns true when both values are equal.
Computes the remainder against a number | bigint scalar.
Throws ParamError on division by zero, overflow, or an invalid
scalar.
Multiplies by a number | bigint scalar.
bigint is exact; number is imprecise.
Throws ParamError on overflow or an invalid scalar.
StaticfromBuilds a position size from a fee.
StaticfromConstructs from a JS number (imprecise; prefer fromString).
Throws ParamError on a non-finite or out-of-domain value.
StaticfromConstructs from a JS number then quantizes to scale.
WARNING: the float source is imprecise; prefer
fromStringRounded.
Throws ParamError on an invalid value, scale, or strategy.
StaticfromStaticfromBuilds a position size from a P&L value.
StaticfromBuilds a signed position size from a quantity and a side.
Throws ParamError when side is not "BUY"/"SELL".
StaticfromConstructs losslessly from a decimal string.
Throws ParamError on an invalid format or out-of-domain value.
StaticfromParses a decimal string then quantizes to scale using
strategy.
Throws ParamError on an invalid value, scale, or strategy.
StaticzeroReturns the zero value.
Constructs from a
DecimalInput(string | number | bigint).A generic
numbermust be a safe integer. UsefromFloatexplicitly for imprecise fractional input.Errors
Throws
ParamErroron an invalid value or type.