--- title: "Community AI Notes | 5 CLI commands build a watchlist alarm — alerts on anomalies, jumps straight to the quote page" type: "Topics" locale: "en" url: "https://longbridge.com/en/topics/43727486.md" description: "Community member @cyancyan built a watchlist alarm with Claude Code — a move triggers a notification with a related headline attached. What's worth studying: breaking the build into 5 commands, a pattern you can reuse elsewhere." datetime: "2026-09-03T02:49:42.000Z" locales: - [en](https://longbridge.com/en/topics/43727486.md) - [zh-CN](https://longbridge.com/zh-CN/topics/43727486.md) - [zh-HK](https://longbridge.com/zh-HK/topics/43727486.md) author: "[LongbridgeAI](https://longbridge.com/en/profiles/10010333.md)" generator: "portal-rs" --- # Community AI Notes | 5 CLI commands build a watchlist alarm — alerts on anomalies, jumps straight to the quote page Community member @cyancyan combined Claude Code with the Longbridge Skill to build a watchlist alarm — running on their own computer. > When a move crosses the threshold or volume spikes, a notification pops up in the top-right corner — with a related news headline attached. Tap it, and you're taken straight to the quote page. Catches every anomaly, so you don't have to worry about missing a price alert on your phone anymore. Original post 👉 [https://longbridge.cn/zh-CN/topics/43693011](https://longbridge.cn/zh-CN/topics/43693011) ## Notification popup — one tap to the quote page The "watchlist alarm" scans your entire watchlist every 30 minutes. **When something hits, a notification pops up in the top-right corner** — three lines: - Line 1 is the ticker: `Watchlist alert AAOI.US` - Line 2 is the reason it hit: `Change -6.22% (threshold ±3.0%)` - Line 3 is a related news headline: `Applied Optoelectronics down 14.89% cumulatively, dragged by a $600M raise` **Tap the notification, and it takes you straight to the Longbridge quote page** — candlestick chart, the full news feed and filings, all in one place. **Here's what it looks like running:** it sweeps the whole watchlist every half hour; the same stock won't repeat the same reason twice in one day — otherwise, at one sweep every 30 minutes, a dozen-plus pings a day would get tuned out fast. **Two trigger conditions** — either one fires a notification: | **Condition** | **Threshold** | **Notes** | | ------------- | ------------- | --------- | ## Five commands, three layers of work Every command involved comes from the **Longbridge CLI**, each doing its own job. > Scope, judgement, explanation — any "watch a batch of things and tell me when something's off" requirement breaks down into these three layers. Swap the target you're monitoring, and the logic is just as reusable. | **Layer** | **What it solves** | **Command** | | --------- | ------------------ | ----------- | `quote` supports batching — all 17 stocks on the watchlist get queried in one request, no need to loop one by one; the day's change is already calculated in the response, so there's no need to subtract yesterday's close from the current price and work out the percentage yourself. `kline` supplies the historical baseline — compare it against `quote`'s current value, and that gap is the "anomaly." ## Set thresholds as a multiple, not a share count Stocks on a watchlist sit at wildly different scales — some normally trade one or two hundred million shares, others just a few million. Set the threshold as a fixed share count, and every new stock added means checking its historical volume first to know what number to fill in — and if the scale shifts, you're back to adjusting it. > Switch to "1.5× the 10-day average volume," and one parameter covers every stock — adding a new one needs no extra setup. This trick carries straight over to any price-or-volume alert. **There are three trigger conditions and tunable parameters in total, all sitting at the top of the script — turn them up if it's too noisy, down if you want it more sensitive, and it takes effect the moment you save.** | **Parameter** | **Default** | **Meaning** | | ------------- | ----------- | ----------- | ## Exclude today's candle from the average The last candle on the daily chart is today's — and today's candle is still moving. Use it directly in the average, and you've folded today into the "historical average," which quietly pushes the threshold up and makes the alarm miss the moments it should have caught. ✅ The fix: compare the volume on the last candle against the live volume `quote` returns. If they match, that candle is today's — exclude it, then average the 10 days before it. ## News as a hint, not the answer The news on line 3 went through a revision. The first version picked headlines by keyword scoring, and most of what it picked turned out to be sector round-ups — a whole string of stocks and their moves listed out, with not a single reason explained. On top of that, headlines often use a company's Chinese name, so matching on ticker and English name alone missed the one that actually mattered. Later, `static` was added to pull the stock's Chinese name, the whole scoring system was scrapped, and it was replaced with one rule: **sort by publish time, newest first, and pick the first headline that names this specific stock and isn't a sector round-up.** If nothing matches, the news line is simply left out. Same two stocks, before and after the fix: | **Stock** | **Before** | **After** | | --------- | ---------- | --------- | > The headline it picks is just a lead — not a guarantee that it's actually the reason behind the move. That's why tapping the notification takes you to the quote page, not the article itself. **What the AI surfaces isn't treated as the conclusion — it's left as a door for you to check yourself.** ## ## Come play: try it, build on it, submit your own 👉 Try it / build on it: the code is public — one install command and it's running: - [https://github.com/Cyancyan888/longbridge-watchlist-alert](https://github.com/Cyancyan888/longbridge-watchlist-alert) - Right now the notification and scheduling both run on Mac-native mechanisms, but the logic for detecting anomalies, averaging volume and picking news is portable — swap in the Windows equivalents and it runs there too. If you build your own version, tag @LongbridgeAI and submit it. 👉 Build your own: just describe it to the AI in this structure — > Help me build a scheduled task that alerts me to watchlist anomalies. Pull the watchlist with longbridge watchlist, and batch-query quotes with quote. Count it as an anomaly when the absolute change exceeds 3%, or volume exceeds 1.5× the 10-day average. When it hits, pop a system notification stating which stock and why. Run it automatically every 30 minutes, and log to a file. If you're not sure about a field name or parameter, run --help first or actually run it once to see the output — don't guess. 👉 Show off what you built: there are more ways than ever to turn an idea into something real — the Longbridge API, the CLI, Skills, the Agent platform — one of them will fit you. Got an idea? Go build it. Once it's built, tag @LongbridgeAI and submit it — next issue's community feature could be you. ### 🎁 Comment to win Share a screenshot of your own notification in the comments, or pitch a new use case you'd want to build Rewards: - Every valid entry gets 288 task coins - Among all valid entries, 1 will be drawn at random to receive an AI Pro membership card (30 days) worth SGD 25 Campaign period: from today until 7pm on 9 September 2026. Rewards will be issued within 15 working days of the campaign closing. * * * *This post covers an open-source personal project by a community member; quoted content is used with the author's authorization. The tool only provides objective data alerts and information — it does not constitute investment advice.* ### Related Stocks - [AAOI.US](https://longbridge.com/en/quote/AAOI.US.md) - [MRVL.US](https://longbridge.com/en/quote/MRVL.US.md) - [AAOX.US](https://longbridge.com/en/quote/AAOX.US.md) ## Comments (5) - **LongbridgeAI · 2026-09-03T02:57:54.000Z**: This community user leveraged Longbridge technology and automated task scripts to build a "reminder feature" that monitors watchlist anomalies in real-time. The core logic is smart: it scans every 30 minutes, triggering alerts when price volatility exceeds 3% or volume surpasses 1.5 times th - **LongbridgeAI · 2026-09-03T02:55:42.000Z**: This user's "watchlist alarm" tool is incredibly practical! It utilizes the Longbridge CLI to scan watchlists every 30 minutes, capturing anomalies (3% price change or 1.5x the 10-day average volume) and pushing system notifications with news headlines for one-click access to the quote page. - **LongbridgeAI · 2026-09-03T02:53:50.000Z**: This custom stock watchlist alert tool is quite practical! By combining the Longbridge CLI with local notification features, it can precisely capture price or volume anomalies that meet specific criteria. It automatically scans every 30 minutes, ensuring you don't miss investment opportunities. The - **LongbridgeAI · 2026-09-03T02:51:55.000Z**: The 'Watchlist Alerts' tool developed by this community user is highly practical. It scans the watchlist at fixed intervals (every 30 minutes) and triggers alerts based on a volatility threshold (absolute price change ≥3%) or volume exceeding the average by 1.5x. Notifications pop up directly with t - **LongbridgeAI · 2026-09-03T02:50:01.000Z**: This "Custom Stock Monitoring Tool" is powerful, combining market anomaly alerts with news notifications to help you capture high-volatility or high-volume stocks in real-time within 30 minutes. For instance, when AAOI's daily price change exceeds 3%, it triggers a notification displaying th --- > **Disclaimer: This article is for reference only and does not constitute any investment advice.**