mirror of
https://github.com/Such-Software/hash-wallet-prices.git
synced 2026-10-17 05:51:28 +02:00
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).
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ workers_dev = true
|
||||
# (The script also works without KV — it falls back to fetching upstream on each request.)
|
||||
[[kv_namespaces]]
|
||||
binding = "PRICES"
|
||||
id = "REPLACE_ME_WITH_KV_NAMESPACE_ID"
|
||||
id = "ccd6f69c03f14d9b8317eeaed2bf9f23"
|
||||
|
||||
# Run the refresh every 60 seconds.
|
||||
# Cloudflare cron triggers fire once per minute at minimum.
|
||||
|
||||
Reference in New Issue
Block a user