Expand description
The single boundary where a planner’s f64 becomes a market quantity.
The planner and the forecasts compute in f64. Everything that leaves the system — bids,
orders, schedules, setpoints — passes quantize, which refuses non-finite input, converts
through the shortest decimal representation that round-trips the f64 (so 0.1 becomes
exactly 0.1, not 0.1000000000000000055…), and rounds to the product’s granularity in a
stated direction. The result carries the rule it applied, for the decision record.
This is the only module allowed to turn a float into a Decimal; cargo xtask check-conversions and the clippy bans in clippy.toml enforce that.
Structs§
- Granularity
- The smallest tradable step of a quantity or price, with the rounding direction to use.
- Quantized
- A market quantity together with the rule that produced it.
Enums§
- Quantize
Error - Why a value could not be quantised.
- Round
Direction - Rounding direction to a granularity step.
Functions§
- quantize
- Turns a planner number into a market quantity on
granularity.