Get the FREE Ultimate OpenClaw Setup Guide →

stock-scanner

Scanned
npx machina-cli add skill limit881010/stocks/stock-scanner --openclaw
Files (1)
SKILL.md
7.1 KB

Taiwan & US Stock Scanner + Portfolio Tracker

Scan Taiwan and US stocks for technical buy signals and track selected positions for sell signals.

When to Use This Skill

Use this skill when the user:

  • Wants to scan Taiwan stocks: "掃描股票", "尋找買入機會", "find buy signals"
  • Wants to track/monitor positions: "追蹤", "monitor my stocks", "check my positions"
  • Wants to manage their watchlist: "add to watchlist", "remove from watchlist"

First Time Setup

For new users, follow these steps to set up the stock scanner:

Step 1: Install Required Packages

cd .agent/skills/stock-scanner
pip install -r requirements.txt

Required packages:

  • yfinance - Fetch stock data from Yahoo Finance
  • pandas - Data manipulation and analysis
  • numpy - Numerical computing
  • matplotlib - Plotting and visualization (for backtesting charts)

Step 2: Initialize Data Files

Run the initialization script to create required data files:

cd scripts
python init_setup.py

This will create empty data files if they don't exist:

  • watchlist.csv - Empty watchlist (will be populated when you add stocks)
  • scan_results_with_stats.csv - Taiwan scan results (populated by scanner)
  • us_scan_results_with_stats.csv - US scan results (populated by scanner)

Note: The top_market_cap_stocks.txt cache file will be automatically created on your first Taiwan stock scan.

Core Workflow

1. Scan for Buy Signals

Execute the scanner to find stocks with technical buy signals:

cd .agent/skills/stock-scanner/scripts
python run_scanner.py

The scanner:

  • Scans top 150 Taiwan stocks by market cap
  • Tests 8 technical strategies per stock
  • Backtests each signal to verify win rate
  • Saves results to strategy/scan_results_with_stats.csv
  • Automatically retries OTC stocks with .TWO suffix if .TW fails

Output: Table of stocks with buy signals, sorted by win rate.

1b. Scan US Stocks for Buy Signals

Execute the US stock scanner to find buy signals among specified tech stocks:

cd .agent/skills/stock-scanner/scripts
python run_us_scanner.py

The scanner:

  • Scans 15 US tech stocks (AAPL, NVDA, MSFT, GOOGL, AMZN, META, TSLA, AVGO, ADBE, CRM, INTC, AMD, QCOM, TXN, MU)
  • Tests 8 technical strategies per stock
  • Backtests each signal to verify win rate
  • Saves results to us_scan_results_with_stats.csv

Customizing US Stock List: Edit us_stocks_list.py to change the stocks to scan.

Output: Table of US stocks with buy signals, sorted by win rate.

2. Select Stocks for Tracking

After scanning, help the user select stocks to track. Present the scan results and ask which stocks they want to add to their watchlist.

Example conversation:

ASSISTANT: "掃描完成!找到 26 個買入訊號。以下是勝率最高的前 10 個:
1. 2886.TW - W-Bottom (勝率 100%, 回報 9.7%)
2. 2606.TW - %B+MFI Reversal (勝率 66.7%, 回報 12.1%)
...

你想追蹤哪些股票?請提供股票代碼,例如:2886.TW 2606.TW"

USER: "2886.TW 2606.TW 3034.TW"

Note: The add_to_watchlist script automatically detects whether you're adding Taiwan stocks (ending in .TW/.TWO) or US stocks, and searches the appropriate scan results files.

Then add selected stocks (works for both Taiwan and US stocks):

cd .agent/skills/stock-scanner/scripts
python add_to_watchlist.py 2886.TW 2606.TW 3034.TW
# or for US stocks:
python add_to_watchlist.py AMZN NVDA AAPL

3. Monitor Portfolio

Check tracked positions for sell signals:

cd .agent/skills/stock-scanner/scripts
python monitor_portfolio.py

The monitor:

  • Loads watchlist from watchlist.csv (supports both Taiwan and US stocks)
  • Fetches current prices for all positions
  • Checks each position's strategy for sell signal (-1)
  • Calculates P&L and holding period
  • Highlights positions with sell signals

Quick Status Check: For a simple price update without full technical analysis:

python status.py

Output: Portfolio status table + sell signal alerts.

4. Manage Watchlist

Show current watchlist:

cd .agent/skills/stock-scanner/scripts
python show_watchlist.py

Remove positions:

cd .agent/skills/stock-scanner/scripts
python remove_from_watchlist.py 2330.TW 2454.TW

Technical Strategies

The scanner tests 8 strategies per stock:

  1. Vol Breakout - Volume surge with price breakout
  2. Low Vol Reversal - Oversold reversal with volume spike
  3. W-Bottom - W pattern base with volume confirmation
  4. BB Squeeze+Mom - Bollinger squeeze with momentum
  5. Ichimoku Cloud - Cloud breakout signal
  6. Mean Reversion - Price stretched from mean
  7. DBB Trend Entry - Donchian breakout
  8. %B+MFI Reversal - %B oversold + MFI divergence

Each signal is backtested to verify win rate and expected return.

Data Files

  • scan_results_with_stats.csv - Latest Taiwan stock scan results
  • us_scan_results_with_stats.csv - Latest US stock scan results
  • watchlist.csv - User's tracked positions (supports both TW and US stocks)
  • top_market_cap_stocks.txt - Cached top 150 Taiwan stocks (30-day validity)
  • us_stocks_list.py - List of US stocks to scan (customizable)

Important Notes

  • First Time Setup: Run python init_setup.py to create required data files if they don't exist
  • Cache: Stock list cached for 30 days. Refresh with python strategy/fetch_top_stocks.py --refresh
  • OTC Stocks: Scanner automatically retries with .TWO suffix if .TW fails
  • Watchlist: Adding stocks appends to existing watchlist (not replace)
  • API Quota: Scanning uses 0 MB FinLab quota (relies on cache), monitoring uses yfinance (free)
  • Missing Data Files: If you encounter "file not found" errors, run init_setup.py first

Example Usage Sessions

Taiwan Stock Scanning

USER: "掃描股票"

ASSISTANT: [Runs run_scanner.py]
         [Presents results]
         "找到 26 個買入訊號。你想追蹤哪些股票?"

USER: "2886.TW 2606.TW"

ASSISTANT: [Runs add_to_watchlist.py 2886.TW 2606.TW]
         "已加入 2 個部位到追蹤清單!"

USER: "追蹤"

ASSISTANT: [Runs monitor_portfolio.py]
         [Shows portfolio status with sell signals]

US Stock Scanning

USER: "scan"

ASSISTANT: [Runs run_us_scanner.py]
         [Presents US stock results]
         "Found 4 buy signals. Which stocks do you want to track?"

USER: "加入觀察清單 AMZN"

ASSISTANT: [Runs add_to_watchlist.py AMZN]
         "✅ Successfully added AMZN to watchlist!"

USER: "追蹤"

ASSISTANT: [Runs monitor_portfolio.py]
         [Shows mixed TW/US portfolio status]

Source

git clone https://github.com/limit881010/stocks/blob/main/skills/stock-scanner/SKILL.mdView on GitHub

Overview

Stock-scanner analyzes Taiwan and US stocks for technical buy signals using eight strategies and tracks selected positions in a watchlist. It backtests signals for reliability and monitors exits, helping you act on strong opportunities and manage risk.

How This Skill Works

The scanner tests eight technical strategies on each stock (Taiwan’s top 150 by market cap or a user-specified US list), backtests signals to verify win rate, and saves results to CSV files. You review the results, select stocks to track, and the system monitors tracked positions for sell signals and exit opportunities.

When to Use It

  • Scan Taiwan stocks for technical buy signals (top 150 by market cap).
  • Scan user-specified US tech stocks for buy signals.
  • Select and add promising stocks to a watchlist for monitoring.
  • Monitor tracked positions for exit/sell signals.
  • Manage your stock watchlist by adding or removing stocks.

Quick Start

  1. Step 1: Install required packages: cd .agent/skills/stock-scanner; pip install -r requirements.txt
  2. Step 2: Initialize data files: cd scripts; python init_setup.py
  3. Step 3: Run scans (Taiwan or US): cd .agent/skills/stock-scanner/scripts; python run_scanner.py; python run_us_scanner.py

Best Practices

  • Run the Taiwan scan regularly to surface signals with the highest win-rate.
  • Customize the US stock list (us_stocks_list.py) to match your interests before scanning.
  • Review backtesting results and filter signals before adding to your watchlist.
  • Keep watchlist.csv and scan result files up to date; prune inactive positions periodically.
  • Ensure dependencies are installed and data files exist (watchlist.csv, scan_results_with_stats.csv, us_scan_results_with_stats.csv).

Example Use Cases

  • A user runs the Taiwan scan, sees 26 buy signals, and adds the top 3 to the watchlist for monitoring.
  • User updates the US stock list (AAPL, NVDA, AMZN) and runs the US scan, then adds AAPL and NVDA to the watchlist.
  • Two watched positions trigger exit signals based on the latest scan results and are flagged for review.
  • User removes a stale stock from the watchlist after it fails to meet criteria over several scans.
  • User compares win-rate rankings across strategies to adjust which signals to prioritize.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers