feat!: Quote both directions of a pair with a single Quotation #51
No reviewers
Labels
No labels
kind
bug
kind
enhancement
kind
refactor
workflow
needs-info
workflow
needs-triage
workflow
ready-for-agent
workflow
ready-for-human
workflow
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rosa/lucre!51
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/two-sided-market"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An
Exchangeheld each direction of a pair as its own entry, so a table couldquote USD/EUR at 0.80 beside EUR/USD at 1.30 and pay for a round trip. Both
directions now share one
Quotation: it holds the pair, the price from base toquote, and an optional second price the other way. Leaving the second price out
says no price for that direction was offered; stating it makes the quotation
two-sided, and the low price can never sit above the high one.
docs/adr/0002-a-quotation-holds-an-optional-reverse-price.mdrecords thedecision and what it rejected, including why ADR 0001's objection to folding
one-way and two-way prices together does not apply once the reverse price is
optional.
Closes #50.
Breaking changes
ExchangeRateis replaced byQuotation, andExchangeRateErrorandInvertErrorbyQuotationError.Quotation::convertreturnsResult<Money, ConvertError>rather than aResultwrapped around anOption. A direction it cannot price is an errorvariant, not an absence.
Exchangekeys entries on the two currencies sorted rather than on aPair,so a stored key is never a pair nobody quoted.
IntoRatesandRatesare nowIntoQuotationsandQuotations.through
lucre::exchange::*.2e28. AnExchangeRateused to accept a rate at or above2e28and then refuse toinvert it.
Also in here
Extend,FromIterator, andFrom<[T; N]>impls onExchangecollapse into three blanket ones over
Into<Quotation>.src/exchange/pair.rs.and the round-trip property no longer rounds both sides before comparing.
CONTEXT.mdlists "market" under the words to avoid; the glossary, theREADME, and the module docs all follow the single price type.
mise run cipasses.