Skip to content

Add stock tracking agent sample - #2

Open
sevenYY wants to merge 6 commits into
masterfrom
cursor/stock-tracking-agent-d3a2
Open

Add stock tracking agent sample#2
sevenYY wants to merge 6 commits into
masterfrom
cursor/stock-tracking-agent-d3a2

Conversation

@sevenYY

@sevenYY sevenYY commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a standalone Python stock tracking agent sample for US, HK, and A-share markets
  • Add configurable watchlist rules for PE, dividend yield, manual buy prices, and safety margin fallback
  • Add a standard-library Web UI with filters, source switching, table display, recommendation cards, and JSON API
  • Default the Web UI to live quotes on every request and disable browser caching so stale offline fixtures are not shown as current data
  • Use Nasdaq quote API for latest US prices with Yahoo intraday chart fallback while keeping Yahoo fundamentals
  • Replace A-share live data source with EastMoney and compute A-share dividend yield from trailing-12-month cash dividends
  • Update the offline sample quote for AAPL to USD 312.06 and 贵州茅台 to CNY 1326 with TTM dividend yield 3.92%

Testing

  • python3 -m unittest samples.stock_agent.test_stock_agent
  • python3 samples/stock_agent/stock_agent.py --offline --market US --top 5
  • Restarted python3 samples/stock_agent/web_agent.py --host 127.0.0.1 --port 8000
  • Verified default Web UI sends Cache-Control: no-store, max-age=0
  • Verified http://127.0.0.1:8000/?source=offline&market=US&top=5 returns 200 and includes AAPL at 312.06
  • Verified http://127.0.0.1:8000/api/report?source=offline&market=US&top=5 returns 200 JSON with AAPL price 312.06
  • Verified default live API fails explicitly in this cloud environment instead of falling back to stale offline data

Notes

  • Live external quote requests from this cloud environment still return SSL EOF network errors for Nasdaq, Yahoo, and EastMoney; offline mode remains available for reliable local demos.
Open in Web Open in Cursor 

cursoragent and others added 2 commits May 30, 2026 08:02
Co-authored-by: sevenYY <sevenYY@users.noreply.github.com>
Co-authored-by: sevenYY <sevenYY@users.noreply.github.com>
@sevenYY
sevenYY marked this pull request as ready for review May 30, 2026 08:08
cursoragent and others added 4 commits May 30, 2026 08:13
Co-authored-by: sevenYY <sevenYY@users.noreply.github.com>
Co-authored-by: sevenYY <sevenYY@users.noreply.github.com>
Co-authored-by: sevenYY <sevenYY@users.noreply.github.com>
Co-authored-by: sevenYY <sevenYY@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants