feat: add hlz watch command for price alerts with shell triggers#3
Closed
feat: add hlz watch command for price alerts with shell triggers#3
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add edge detection to watchReadLoop: only fire when condition transitions from not-met to met (was_met state). Prevents repeated cmd execution while price stays on triggered side of threshold. - Resolve spot pairs (e.g. HYPE/USDC) to @index for allMids lookup via resolveSpotCoin, matching other read commands. Display output still shows the human-readable pair name.
Owner
Author
|
Closing for rework — fresh approach |
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.
Summary
Add
hlz watch <COIN> --above|--below <PRICE>— a WebSocket-based price watcher that monitors a condition and optionally executes a shell command when triggered.Changes
src/cli/args.zigWatchArgsstruct withcoin,above,below,cmd,repeatfieldswatchvariant toCommandunion andHelpTopicenumparseWatch()with validation: exactly one of--above/--belowrequiredparse()andcanonicalHelpTopic()src/cli/commands.zigwatch()command: connects to WS allMids, monitors target coin mid price⚡ BTC hit 100234.50 (was watching: --above 100000)--json:{"coin":"BTC","price":...,"condition":...,"threshold":...,"timestamp":...}std.process.Childwith/bin/sh -c--repeatflag for continuous monitoringextractMidPricehelpersrc/cli/main.zig.watchcase in main command switchTesting
zig build test— all tests pass (186 including 3 new extractMidPrice tests)zig build hlz— builds successfullyzig build hlz-terminal— builds successfullyhlz help watch— correct help outputCloses SYM-9