Public price tickers behind one port, described as data.
Adding an exchange — or a whole new pair — is a map entry in sources;
nothing here branches on which exchange it is. A source that fails is simply
absent from the round, and the quote layer above decides whether what came
back is enough to price a sale.
Public price tickers behind one port, described as data. Adding an exchange — or a whole new pair — is a map entry in `sources`; nothing here branches on which exchange it is. A source that fails is simply absent from the round, and the quote layer above decides whether what came back is enough to price a sale.
(->number x)x as a positive number, or nil. Tickers quote prices as strings as often
as they quote them as numbers.
`x` as a positive number, or nil. Tickers quote prices as strings as often as they quote them as numbers.
(->source profile client now-fn)IRateSource over the ticker profile describes.
now-fn stamps the reading, because a ticker rarely says when it last
traded — and a reading with no time cannot be aged out.
IRateSource over the ticker `profile` describes. `now-fn` stamps the reading, because a ticker rarely says when it last traded — and a reading with no time cannot be aged out.
(extract payload path)The positive number at path in payload, or nil.
The positive number at `path` in `payload`, or nil.
(feed {:keys [rate-sources ttl-ms now-fn]
:or {ttl-ms 60000 now-fn (fn* [] (Date.))}})A cached round over rate-sources, as a 0-arity function.
At most one round of network per :ttl-ms; a round that yields nothing is
not cached, so a total outage retries instead of pinning an empty result.
A cached round over `rate-sources`, as a 0-arity function. At most one round of network per `:ttl-ms`; a round that yields nothing is not cached, so a total outage retries instead of pinning an empty result.
(fixed-source {:keys [id pair price now-fn] :or {now-fn (fn* [] (Date.))}})IRateSource that always reports price. Development and tests.
IRateSource that always reports `price`. Development and tests.
(spot this)This source's current price for its pair, as a Rate, or nil.
This source's current price for its pair, as a Rate, or nil.
(registry {:keys [client now-fn source-profiles]
:or {now-fn (fn* [] (Date.)) source-profiles sources}})An IRateSource per profile in source-profiles.
An IRateSource per profile in `source-profiles`.
(round rate-sources)Every rate the sources can supply now. Sources that fail are absent.
Every rate the sources can supply now. Sources that fail are absent.
Independent public tickers, none of which needs an account or a key.
:source/path is where the price sits in the parsed body, and
:source/pair is [base quote] — the price is how many quote units one
whole base unit costs.
Independent public tickers, none of which needs an account or a key. `:source/path` is where the price sits in the parsed body, and `:source/pair` is [base quote] — the price is how many `quote` units one whole `base` unit costs.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |