Language: 中文 | English
This project is a Python tool for identifying daily stock price segments, confirmed tops/bottoms, pivots, turn candles, and unconfirmed candidates. It can run from the command line or through a Tkinter GUI.
For the full Chinese documentation and detailed rule definitions, see README.zh-CN.md.
pip install -r requirements.txtDependencies:
pandasrequestsakshare
Daily market data is cached under data/cache by default. If a network endpoint is temporarily unavailable, the program can reuse existing cached data.
Open the GUI:
python3 main.py guiThe GUI lets users enter a stock symbol, analyze all detected segments, see whether each segment comes from pivot confirmation or an extreme anchor, and export either a TXT summary or detailed JSON.
Analyze one stock:
python3 main.py stock --symbol 001259 --start 19900101 --end 20260529 --output out/001259.jsonAnalyze all limit-up stocks on a given day:
python3 main.py limit-up --date 20260515 --lookback-days 520 --direction up --output out/zt_20260515.jsonAnalyze a local CSV file:
python3 main.py csv --file data/sample.csv --direction both --output out/sample.jsonCSV files may use date/open/high/low/close, or common AkShare Chinese column names such as 日期/开盘/最高/最低/收盘.
Common options:
--scan-mode lowest: start from the historical lowest low and complete segments forward/backward.--scan-mode history: scan from the left side of history in chronological order.--direction auto|up|down|both: initial direction forhistorymode.--adjust ""|qfq|hfq: adjustment mode; default isqfq.--max-segments: maximum number of consecutive segments.--cache-dir/--no-cache: control market data cache behavior.
main.py: command-line entry point.segment_analyzer/data_fetcher.py: daily market data and limit-up pool fetching.segment_analyzer/indicators.py: OHLC normalization and MA5/MA34 calculation.segment_analyzer/analyzer.py: core segment, pivot, turn candle, endpoint extension, and post-processing rules.segment_analyzer/agent.py: orchestration, batch tasks, JSON output, and summaries.segment_analyzer/gui.py: Tkinter GUI.segment_analyzer/models.py: output data structures.
Each JSON segment report includes fields such as:
segment_no,segment_directionconfirmed_top,confirmed_bottomcandidate_top,candidate_bottomunconfirmed_candidatespivot_confirm_k,pivot_line,pivot_lower,pivot_upper,pivot_typeturn_k,initial_cross,refresh_statusdecision_status
- Segment identify
- Segment trend analysis
- Buying and selling points
For complete field explanations and rule details, use the Chinese README: README.zh-CN.md.