Summary
The client TWAP display needs a backend endpoint. A GET /keys/:keyId/twap endpoint that reads price snapshots and computes the average over a requested window should be added.
Scope
- Add GET /keys/:keyId/twap?window=1h|24h|7d endpoint (no auth required)
- Call the get_twap contract view function with the window converted to ledger units
- Return twapPrice, spotPrice, windowLedgers, and snapshotCount in the response
- Cache the response in Redis for 60 seconds and invalidate on each trade
- Return null for twapPrice when fewer than 2 snapshots exist in the window
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram
Summary
The client TWAP display needs a backend endpoint. A GET /keys/:keyId/twap endpoint that reads price snapshots and computes the average over a requested window should be added.
Scope
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram