sngyai/Sequoia-X

GitHub Trending (daily) Tools

Summary

Sequoia-X V2 is an open-source quantitative stock selection system for the A-share market, built with Python and using baostock for data, featuring multiple strategies and Feishu notifications.

A-share automatic stock selection system — Automatic scanning of multiple technical patterns, runs automatically after market close and pushes notifications to Feishu.
Original Article
View Cached Full Text

Cached at: 09/02/26, 05:44 PM

sngyai/Sequoia-X

Source: https://github.com/sngyai/Sequoia-X

Sequoia-X: The King Returns

A-Share Quantitative Stock Selection System V2


Introduction

Sequoia-X V2 is a quantitative stock selection system for the A-share market, rebuilt from scratch using modern Python engineering standards. The system is built on core design principles: object-oriented architecture, vectorized computation, and incremental data updates. After the market closes each day, it automatically selects stocks and pushes the results to a Feishu (Lark) group.

The data layer uses baostock (http://baostock.com) (free, no registration required, no rate limits) to fetch historical and incremental daily K-line data (backward-adjusted). This data is stored locally in SQLite, completely bypassing web scraping issues from sources like East Money.


Two Operational Modes

python main.py               # Daily Mode: 8-process incremental data update + strategy execution + Feishu push (2-3 minutes)
python main.py --backfill     # Backfill Mode: One-time import of historical K-lines for the entire market (about 12 minutes)

Built-in Strategies

StrategyDescription
TurtleTradeTurtle Breakout: 20-day high + trading volume over 100 million + bullish candle to prevent traps, sorted by price change
MaVolumeMoving Average + Volume Surge Breakout
HighTightFlagHigh and Tight Flag Pattern Breakout
LimitUpShakeoutLimit-Up Shakeout and Retest Confirmation
UptrendLimitDownLimit-Down Reversal in an Uptrend
RpsBreakoutO’Neil RPS (Relative Price Strength) Breakout

Quick Start

Requirements

  • Python >= 3.10

1. Install Dependencies

# Recommended: use uv (fast package manager)
uv sync

# Or use pip
pip install .

2. Configure Environment Variables

cp .env.example .env
# Edit .env and fill in the Feishu Webhook URL

3. First-Time Historical Data Backfill

python main.py --backfill

This takes about 12 minutes to backfill historical backward-adjusted daily K-line data for approximately 5200 A-shares.

4. Daily Operation

python main.py

Recommended to schedule with crontab to run automatically after market close each trading day:

15 19 * * 1-5 cd /root/Sequoia-X && .venv/bin/python main.py >> log.txt 2>&1

Project Structure

Sequoia-X/
├── main.py                      # Entry point: argparse dispatches daily/backfill modes
├── pyproject.toml               # Dependency declaration + ruff/pytest configuration
├── .env.example                 # Environment variable template
├── data/                        # SQLite database (generated at runtime, not in git)
├── sequoia_x/
│   ├── core/
│   │   ├── config.py            # Pydantic-settings configuration management
│   │   └── logger.py            # Rich structured logging
│   ├── data/
│   │   └── engine.py            # Data engine (baostock backfill + incremental sync + SQLite)
│   ├── strategy/
│   │   ├── base.py              # Abstract base class for strategies
│   │   ├── turtle_trade.py      # Turtle Trading strategy
│   │   ├── ma_volume.py         # Moving Average Volume strategy
│   │   ├── high_tight_flag.py   # High Tight Flag strategy
│   │   ├── limit_up_shakeout.py # Limit-Up Shakeout strategy
│   │   ├── uptrend_limit_down.py # Uptrend Limit-Down strategy
│   │   └── rps_breakout.py      # RPS Breakout strategy
│   └── notify/
│       └── feishu.py            # Feishu Webhook push
└── tests/                       # Property-based tests (hypothesis)

Data Notes

  • Data Source: baostock (http://baostock.com) (free, no registration required, no rate limits)
  • Adjustment Method: Backward-adjusted (hfq) – historical prices remain unchanged, suitable for incremental storage, avoids data discrepancies from corporate actions.
  • Storage: Local SQLite (data/sequoia_v2.db), can be directly copied to other machines for use.
  • Daily Incremental Updates: 8-process parallel fetching via baostock, completes full market update in 2-3 minutes.

License

MIT

Similar Articles

hello245m/free-stockdb

GitHub Trending (daily)

A local quantitative engine for A-share stock and ETF minute/day K-line data, with incremental sync, local cache, batch query, backtesting, and indicator calculation.

@geekbb: Open-source A-share quantitative workstation, using TickFlow data for three tasks: stock selection, real-time monitoring, and backtesting. Built-in 20 stock selection strategies (Polars vectorization runs all A-shares in seconds), supports no-code custom signals, AI strategy writing, multi-condition monitoring rules + Feishu push. https:…

X AI KOLs Timeline

Open-source A-share quantitative workstation, based on TickFlow data, implements three functions: stock selection, real-time monitoring, and backtesting. Built-in 20 Polars vectorized strategies, supports AI strategy writing and Feishu push.

@GYLQ520: With the listing of CXMT and YuShu, the A-share market is heating up again, and many are turning their attention back to the domestic market. After searching for tools specifically for A-share analysis, I found that solutions that cater to both US and Hong Kong stocks often don't fit the domestic market well. 'a' came across an intelligent A-share analysis system built on AKShare and CrewAI. AKShare is solid in quantitative…

X AI KOLs Timeline

This is an intelligent A-share analysis system built on AKShare and CrewAI, offering professional investment analysis capabilities through multi-Agent collaboration.

@_zheergen: Guys! Found another all-in-one Python stock tool — InStock. The myhhub/stock repository covers A-share quantitative analysis quite comprehensively: data scraping, indicator calculation, stock selection, backtesting, and automated trading all in one. Let me highlight the core features: Real-time A-share data scraping + 30…

X AI KOLs Timeline

Introduces the open-source Python tool InStock (myhhub/stock) for A-share quantitative analysis, supporting data scraping, technical indicators, stock selection, backtesting, automated trading, etc., and can be deployed via Docker.