Commit Graph
9 Commits
Author SHA1 Message Date
jwinterm c46c4e5570 feat(prices): add Gate.io as a source, starting with GRIN
Kraken does not list GRIN, and the niche-ticker path averages nonlogs and
cexswap, the same venues our own desk quotes into. An oracle that reads back
our own quotes is the circularity the desk divergence rail exists to catch,
so Gate.io is wired as its own source rather than folded into that average.

We prefer the book mid over `last`: on a thin market a print can sit outside
the current spread, while bid and ask are live quotes. Kraken still wins
wherever it lists the coin, and a Gate.io failure degrades to no GRIN rate
rather than to a wrong one.
2026-09-14 20:47:44 -04:00
jwinterm c0802fe5d8 fix(oracle): price from the live book, and expire stale prints
The feed read $0.008546 while cross-venue consensus was $0.009280, low by 8.6%,
and wowdesk's fair guard is anchored to it: the desk was refusing to bid at
prices the market was actually trading, because the feed did not believe those
prices existed.

Two causes, both last-trade artefacts. Nonlogs WOW-BTC last traded at 10 sat
while its book stood 10 bid, 13 ask, so the live midpoint was 11.5 and we were
quoting a print instead. And CexSwap's WOW-XMR sample, which carries $635 of
seven-day volume against Nonlogs' $169 and therefore dominates the average, was
the 24-hour low and 11.5 hours old.

Nonlogs now prefers the midpoint of the best bid and ask, guarded: both sides
present, ask above bid, spread at or under 60%, else fall back to the last
trade. CexSwap publishes no book, so the only guard available there is age, and
a print older than 12 hours no longer anchors the feed.

Measured against live venues: Nonlogs moves $0.007989 to $0.009187, three dead
CexSwap pairs expire, and the feed as a whole moves $0.008546 to $0.008796.

GET /v1/oracle now returns the method, the guard values and the known limits
next to the rates, served by the code that implements them so the description
cannot drift from the behaviour. README carries the same in prose.
2026-09-06 09:18:26 -04:00
jwinterm 074b232267 nonlogs: ignore markets with no 24h volume, like the cexswap leg already does
The cexswap leg drops pairs with no 7-day volume and says why: a stale
last print on a dead pair must never drag the average. The nonlogs leg
did not, and averaged WOW-USDT — a 0.00723 print with null volume — against
a WOW-BTC route with real trades behind it.

Today that pulls the nonlogs leg 15% low, and since the leg is half the
WOW blend, the published price 8.4% low: 0.009830 against 0.010653. The
drag grows as WOW moves away from whenever that print happened.

Both routes are now volume-weighted by 24h quote volume, and a venue with
no volume anywhere is omitted so the other venue's sample stands alone —
the same shape as the cexswap function.

This feed is what Hash Bags, Smirk, wowlet and the desk's own fair value
display, so the number moves for all of them on deploy.
2026-09-03 12:51:21 -04:00
jwinterm 3f38aa4fdc forex: non-USD quotes via ECB daily reference rates
fetchEcbFiat() converts the ECB EUR-based table to USD multipliers each
cron run; /v2/rates multiplies COIN_USD for any known fiat quote. Feed
failure degrades to USD-only, never to a stale-wrong number. Deployed
and verified: WOW/EUR, GBP, JPY, MXN all serving.
2026-08-16 00:08:55 -04:00
jwinterm b016eee8bf cexswap: volume-weight WOW price, ignore dead pairs
The naive mean across all WOW pairs let stale prints on zero-volume
markets (WOW-ETH last traded at $0.000087) drag the cexswap component
~40% below its live markets, and the published WOW rate ~20% under fair.
Weight by volume7d_usd and drop pairs with no 7-day volume; if every
pair is dead the ticker falls back to the Nonlogs sample alone.
2026-08-15 20:07:31 -04:00
jwinterm 4f7c515808 Add Trocador webhook receiver, trade-status cache, and sparkline history
- POST /v1/trocador-webhook: Trocador hits this on every trade status change;
  stored in KV under trade:<id> for 14 days (matching Trocador's retention).
- GET /v1/trade/🆔 returns the cached trade body so the wallet can poll us
  instead of Trocador, dramatically reducing load on their infra per their
  commercial team's request.
- GET /v1/sparkline?coin=BTC&hours=24: returns hourly history points for
  rendering balance sparklines. Cron appends one entry per UTC hour per coin,
  capped at 168 points (1 week).
2026-05-14 15:57:17 -04:00
jwinterm 8f374a6470 Bind worker to prices.neroswap.com via custom_domain route 2026-05-14 11:00:52 -04:00
jwinterm 5f76d77bd1 Replace NonKYC with Nonlogs + cexswap.cc for WOW pricing
Per source repos in ~/src:
- ~/src/smirk-backend/src/infra/prices.rs uses Nonlogs api/markets,
  averaging (WOW-BTC * Kraken BTC/USD) and WOW-USDT routes.
- ~/src/neroswap-site/scrapers/scrape_cexswap.py hits
  cexswap.cc/api/public/markets/summary which already returns last_usd
  per pair.

WOW now sourced from BOTH and averaged — survives one source going down
without code changes.
2026-05-14 09:20:09 -04:00
jwinterm f4bf98f6fc Initial Hash Wallet price aggregator (Cloudflare Worker)
Single endpoint serving USD spot prices for Hash Wallet, sourcing from
Kraken (majors) and NonKYC (Wownero), KV-cached and refreshed via cron
every minute. Drop-in /v2/rates shape compatible with the existing wallet
client; preferred /v1/prices returns everything in one call.
2026-05-14 08:58:58 -04:00