Liking cljdoc? Tell your friends :D

monero-store.promote.quote

Turning independent price reports into one locked quote. Pure.

The stored price is the only price truth; an amount in any other currency exists only as a quote, valid for one invoice and one window. Sources that are stale, too few, or in disagreement produce no quote at all — a store that invents a rate when its sources cannot agree is a store that sells at the wrong price.

Turning independent price reports into one locked quote. Pure.

The stored price is the only price truth; an amount in any other currency
exists only as a quote, valid for one invoice and one window. Sources that
are stale, too few, or in disagreement produce no quote at all — a store that
invents a rate when its sources cannot agree is a store that sells at the
wrong price.
raw docstring

agreeingclj

(agreeing profile rates)

Rates within :quote/max-spread-bps of the median of rates.

A reading far from the middle is dropped, never averaged in: one broken ticker must neither price the sale nor block it.

Rates within `:quote/max-spread-bps` of the median of `rates`.

A reading far from the middle is dropped, never averaged in: one broken
ticker must neither price the sale nor block it.
sourceraw docstring

bounds-forclj

(bounds-for pair)

The band declared for pair, or nil when none is.

The band declared for `pair`, or nil when none is.
sourceraw docstring

consensusclj

(consensus profile rates pair now)

The price rates agree on for pair at now, or nil when they do not.

Returns {:rate/price .. :rate/sources ..}. Stale readings are dropped first, then readings far from the median; what remains must still be at least :quote/min-sources independent sources, or there is no agreement to quote from.

The price `rates` agree on for `pair` at `now`, or nil when they do not.

Returns {:rate/price .. :rate/sources ..}. Stale readings are dropped first,
then readings far from the median; what remains must still be at least
`:quote/min-sources` independent sources, or there is no agreement to quote
from.
sourceraw docstring

convertclj

(convert price rate target-currency)

price at rate, in the minor units of target-currency.

rate is how many of price's currency one whole target-currency unit costs. Rounds away from zero: a rounding error must fall on the store, never leave the customer a hair short of their own invoice.

`price` at `rate`, in the minor units of `target-currency`.

`rate` is how many of `price`'s currency one whole `target-currency` unit
costs. Rounds away from zero: a rounding error must fall on the store, never
leave the customer a hair short of their own invoice.
sourceraw docstring

expired?clj

(expired? quote now)

True when quote no longer holds at now.

True when `quote` no longer holds at `now`.
sourceraw docstring

for-pairclj

(for-pair rates pair)

Rates in rates that report on pair.

Rates in `rates` that report on `pair`.
sourceraw docstring

freshclj

(fresh profile rates now)

Rates in rates no older than :quote/max-age-ms at now.

Rates in `rates` no older than `:quote/max-age-ms` at `now`.
sourceraw docstring

implied-rateclj

(implied-rate price amount)

The price of one whole amount unit, in price's currency, implied by the two naming the same value. Nil when either side is zero.

The price of one whole `amount` unit, in `price`'s currency, implied by the
two naming the same value. Nil when either side is zero.
sourceraw docstring

medianclj

(median xs)

Median of xs, or nil when empty. Even counts average the middle pair.

Median of `xs`, or nil when empty. Even counts average the middle pair.
sourceraw docstring

plausible?clj

(plausible? price amount)

True when price and amount imply a rate inside the band declared for their pair. A pair with no declared band is trusted.

True when `price` and `amount` imply a rate inside the band declared for
their pair. A pair with no declared band is trusted.
sourceraw docstring

profileclj

How much agreement a quote demands, and how long it holds.

:quote/max-spread-bps is measured against the median, in basis points.

How much agreement a quote demands, and how long it holds.

`:quote/max-spread-bps` is measured against the median, in basis points.
sourceraw docstring

quote-forclj

(quote-for profile price rates target-currency now)

Quote for price in target-currency from rates at now, or nil.

Nil is a refusal, and the refusal is the point: too few sources, sources in disagreement, or an implied rate outside the pair's declared band all mean the store does not know the price and must not invent one.

Quote for `price` in `target-currency` from `rates` at `now`, or nil.

Nil is a refusal, and the refusal is the point: too few sources, sources in
disagreement, or an implied rate outside the pair's declared band all mean
the store does not know the price and must not invent one.
sourceraw docstring

set-bounds!clj

(set-bounds! pair low high)

Declare the [low high] band pair's price must fall inside.

A sanity band, not a pricing opinion: it exists so a ticker that starts reporting a price in the wrong unit cannot sell a year of service for a fraction of a cent.

Declare the [low high] band `pair`'s price must fall inside.

A sanity band, not a pricing opinion: it exists so a ticker that starts
reporting a price in the wrong unit cannot sell a year of service for a
fraction of a cent.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close