A leverage loses its digits at the ORE binding
Table of Contents
This page is a capture in the inbox bucket of the product backlog — a pre-sprint idea, not yet pulled into a sprint as a story.
1. What
Give the ORE binding a lexical double leaf, the double counterpart of
moneyFloat, and make rangeBound.Leverage use it. The leaf keeps the
document's text beside the parsed value, and the writer prints the text when it
has one, exactly as _serialize_moneyFloat does for the money leaves.
2. Why
RangeFrom, RangeTo, Strike and StrikeAdjustment keep the digits the
document states, because they are moneyFloat leaves. Leverage is a plain
xsd::optional<float>: it is a multiplier stored in a double precision
column, and its text is lost at the binding. A document that states
<Leverage>1.05</Leverage> exports as 1.04999995, so a round trip changes
the document it read.
The fix is the same shape the money leaves already have, and the lever is reapply_ore_lexical_form.py: a member table entry, a setter that stashes the text, and a writer that prints it. It is filed separately because it touches the binding for every family that states a double, not only this one.
3. References
projects/ores.trading/modeling/ores.trading.range_bound.org— the leverage column and the levels beside it.scripts/reapply_ore_lexical_form.py— where the money leaves are patched in, and where a double leaf would join them.doc/knowledge/architecture/exact_numbers_and_economic_change.org— why a continuous quantity may stay a binary double.
4. See also
- Rework the FX instruments to the instrument table rule — the story that found it.