docs: add price alert bot recipe (closes #100)#108
Open
BigNathan1 wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@BigNathan1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a cookbook recipe and runnable example for an "if XLM > X notify me"
price alert bot, built on the existing WebSocket price stream (#L018).
Changes
docs/cookbook/alert-bot.md(new) — worked walkthrough covering thedata flow, the
price_updatemessage shape, the bot code, runinstructions, HMAC-signed notify forwarding, x402-gated streams, and the
server-side webhook alternative. Includes a live-demo section
(GraphiQL at http://localhost:3002/graphiql, the published OpenAPI
reference, and the local
ws://localhost:3002/wsstream).examples/alert-bot/alert-bot.ts(new) — a minimal runnable bot thatconnects to
/ws, watches a pair, and fires when the price crosses thethreshold. Follows the existing
oracle-relayexample conventions(
--help/--once, env-driven config, guarded entrypoint) and reusescrossesThreshold,buildThresholdAlertPayload, anddeliverJsonWithRetriesfromsrc/alertsso the bot and server agreeon crossing semantics.
examples/alert-bot/README.md(new) — environment table and run notes.package.json— adds thealert:botscript..env.example— documents theALERT_BOT_*variables.README.md— links the new example and cookbook page.Acceptance criteria
npm run alert:bot.local
/wsstream.Verification
Validated end-to-end with a temporary smoke harness (mirroring
scripts/ws-smoke.ts): a non-crossing update was ignored and a0.14 -> 0.16crossing firedALERT XLM/USDC is above 0.15. Noproduction source files were changed.
closes #100