alphasift — Automatic Stock Screening Skill
Screen, score, and rank candidate A-share stocks by strategy.
Positioning: full-market candidate discovery and cross-sectional ranking engine. It sits upstream of single-stock deep analysis services like daily_stock_analysis; DSA is only an optional L3 post-analyzer, not a primary screening dependency.
Use When
- The user wants to list available strategies
- The user wants to screen A-shares by strategies such as
dual_low,volume_breakout - The user wants structured JSON results for further analysis by downstream agents
- The user wants to save screening runs and evaluate results later using the latest snapshot
- The user is new to this project and wants to see the minimal end-to-end pipeline (full market → candidates → ranking) with one command
alphasift quickstart
Preconditions
- Currently only supports
market="cn" - Must install the package from the repo root first:
pip install -e . - To use LLM ranking, set
LITELLM_MODEL,LLM_CHANNELS,LITELLM_CONFIGor the legacy variablesLLM_API_KEY/LLM_MODEL/LLM_BASE_URL - You can reuse the LiteLLM configuration fields from
daily_stock_analysis, includingOPENAI_*,GEMINI_*,DEEPSEEK_API_KEY,OLLAMA_API_BASE - Strategy YAML can override default rules via
scoring_profile,risk_profile,portfolio_profile,scorecard_profile - Strategy YAML can configure preferred/avoided events, announcement categories, and candidate context source weights via
event_profile - LLM outputs candidate industry/theme tags; if a candidate provides
industry/concepts/board_heat_score/board_heat_trend_score, these serve as anchor points for LLM, theme heat factors, and portfolio diversification layers. The history sidecar can backfill persistence, cooling, and state fields. The default portfolio diversification layer uses these tags to map risk buckets, reducing duplicate allocation in the same crowded trade - L3 uses the local
scorecardpost-scorer by default, and can also appenddsaorexternal_http - To enable DSA post-analysis, set
DSA_API_URL; the default callsPOST /api/v1/analysis/analyze - Strategies that depend on daily K-line data automatically perform daily K-line enrichment on the Top N candidates after L1
- The daily K-line data source
DAILY_SOURCEsupportsakshare(default),baostock, orauto;autoautomatically degrades to baostock when akshare fails as a free fallback
Operations
1. List Strategies
alphasift strategies
1.1 Quickstart Demo (No API Key Required)
alphasift quickstart
alphasift quickstart --strategy balanced_alpha --max-output 8
2. Run Screening
alphasift screen dual_low --no-llm
alphasift screen volume_breakout --max-output 10
alphasift screen balanced_alpha --no-llm
alphasift screen capital_heat
alphasift screen balanced_alpha --context "Today the brokerage sector saw increased volume, with low-valuation financial stocks attracting capital inflows"
alphasift --env-file /home/ubuntu/daily_ai_assistant/.env screen balanced_alpha
alphasift screen balanced_alpha --explain
alphasift screen balanced_alpha --candidate-context-file candidate_context.csv
alphasift screen dual_low --no-post-analysis
alphasift screen shrink_pullback --no-llm
alphasift screen dual_low --post-analyzer dsa
alphasift audit
alphasift industry-cache --output data/industry_map.csv --explain
alphasift screen dual_low --no-llm --save-run
alphasift runs
alphasift evaluate <run_id> --explain
alphasift evaluate-batch --limit 20 --explain
alphasift evaluate <run_id> --with-price-path --explain
3. Python API
from alphasift import evaluate_saved_run, evaluate_saved_runs, list_strategies, screen
list_strategies()
screen("dual_low", market="cn", use_llm=False)
evaluate_saved_run("<run_id>")
evaluate_saved_runs(limit=20)
Output
Returns a ScreenResult JSON with key fields:
strategymarketstrategy_versionsnapshot_countafter_filter_countpicksllm_rankedllm_market_viewllm_selection_logicllm_portfolio_riskllm_coveragepost_analyzersdaily_enrichedrisk_enabledportfolio_concentration_notesdegradationsnapshot_sourcesource_errors
Each Pick contains:
rankcodenamefinal_scorescreen_scoreranking_reasonrisk_summarypricechange_pctamounttotal_mvturnover_ratevolume_ratiope_ratiopb_ratioindustryconceptsboard_heat_scoreboard_heat_latest_scoreboard_heat_trend_scoreboard_heat_persistence_scoreboard_heat_cooling_scoreboard_heat_observationsboard_heat_stateboard_heat_summarychange_60dsignal_scoremacd_statusrsi_statusbreakout_20d_pctrange_20d_pctvolume_ratio_20dbody_pctpullback_to_ma20_pctconsolidation_days_20dfactor_scoresllm_confidencellm_sectorllm_themellm_tagsllm_catalystsllm_risksllm_thesisllm_style_fitllm_watch_itemsllm_invalidatorsrisk_scorerisk_levelrisk_penaltyrisk_flagsportfolio_penaltyportfolio_flagspost_analysis_statuspost_analysis_score_deltasdeep_analysis_statusdeep_analysis_summarydeep_analysis_resultdeep_analysis_signal_scoredeep_analysis_sentiment_scoredeep_analysis_operation_advicedeep_analysis_trend_predictiondeep_analysis_risk_flags
Boundaries
- There is currently no standalone remote
get_resultservice; use--save-run,runs,evaluate, andevaluate-batchlocally to manage run records auditis used for self-checking strategy profile overrides, known capability gaps, and next-step priorities--candidate-context-filesupports CSV/JSON/JSONL format, aligns candidate-level news, announcements, capital flows, or research summaries via thecodefield, and only injects rows related to the current candidate pool. Optional fetching will includesource_count,source_confidence,source_weight_score,context_summary, and announcement categories- Candidate-level context identifies coarse-grained event tags and negative risk tags for LLM cross-sectional ranking reference
industry-cachecaches industry/concept mappings and sector heat fields, and writes them into the history sidecar. When loading the mapping later, it can backfill sector heat rolling trends, persistence, cooling, and state fields for LLM context and thetheme_heatfactor- The portfolio diversification layer prioritizes industry/theme tags returned by the LLM, falling back to the candidate's
industryfield if needed. If both are missing, rule scores remain unchanged - L3 post-analyzers run only on the final candidates and do not participate in the full-market initial screening; the local
scorecardis enabled by default, and DSA is just one of the optional backends - T+N evaluation is based on the saved price and the latest snapshot price at the time of evaluation, not equivalent to full back-adjusted backtesting. Transaction costs can be deducted, and breakout/pullback pattern posterior labels can be output.
--with-price-pathadditionally estimates maximum drawdown and maximum floating profit