This skill core does three things:Stock selection scope、Buy-side signals、Sell-side signals; and optionally uses realtime_quotes.py to batch-fetch for specified codescurrent-price-type snapshots(based on MarketDataProvider.get_quote, Tencent quotes + minute K aggregation).
What is output isdecision reference(structured list or JSON),does not includehistorical backtest matching,does not includeautomatic order placement; for real orders, please use a broker or separately connect a-share-paper-trading and other execution channels.
The strategy signal is positioned asconditionally valid: under changes in market structure and trading costs, signal strength may decay and requires continuous review.
Capability boundaries
| Do | Do not do |
|---|---|
| Take the top N from whole-market high-liquidity stocks (including ChiNext and STAR Market) to form the day's stock pool | Minute-level backtesting, mixed backtesting, return curves |
Use daily line trend_pullback to mark entry/exit conditions |
Guarantee returns or replace investment advisory |
| Provide two types of "buy reference" lists (see below) | Place orders directly to exchanges or paper trading services |
| Optional: read a position list file and mark "strategy exit" symbols | Save live positions for you (unless you create your own file) |
Batch-fetch current prices, change percentages, limit-up/limit-down reference prices, etc. for multiple stocks (realtime_quotes.py) |
Replace a-share-data 's heavy interfaces such as whole-market real-time sectors and capital flows |
Strategy logic (and parameters)
Default parameters are in scripts/strategy_lab/strategy_params.py(fast/slow moving averages, pullback magnitude, RSI range and exit RSI, etc.).
Signal calculation is in scripts/strategy_lab/strategies.py 's trend_pullback.
The script additionally applies two layers of filtering:
- Cost filter: estimate round-trip cost according to
--roundtrip-cost-bps, and onlyedge_after_cost > 0candidates enter the final buy list. - Robustness filter: calculate within the parameter neighborhood of
ROBUSTNESS_PARAM_GRIDcomputed within the parameter neighborhoodentry_consensus_ratio, and candidates below--entry-consensus-minwill be filtered out.
Buy reference (two groups, please distinguish the semantics):
from_previous_day_close: the previous closed daily line satisfiesentry. Consistent with the habit of "signal after the previous day's close, execute on the current day",closer to an ex-ante plan。from_last_close: the latest daily line also satisfiesentry, leaning towardpattern display; if it repeats with the previous day, please avoid double counting.
Within the list, sort by strategy-internal score(moving-average strength) in descending order; by defaulteach buy list retains at most 5 stocks(strategy_params.MAX_BUY_CANDIDATES), consistent with "positions to watch simultaneously should not be too many". When you need more or all, add --max-buys 0 to indicate no truncation, or --max-buys 10 , etc.
Sell reference:
For --holdings codes in the file, ifthe latest daily barsatisfies exit(conditions within the rules such as breaking the slow line or RSI being too high), then it is listed as a sell reference. File format: one code per line, comment lines allowed (# at the start).
Risk control reference (documentation and JSON fields only):
REFERENCE_INTRADAY_STOP_PCT represents the historicalintraday stop-loss percentage referenceconsistent with the strategy document; this scriptdoes notmonitor intraday stop-loss for you; you need to set it yourself in your order placement software.
Environment and dependencies
pip install akshare pandas numpy requests
Run
SKILL_DIR="<本 skill 绝对路径>"
python3 "$SKILL_DIR/scripts/daily_decisions.py" --json
Common parameters:
--top-n: stock pool size, default 120--max-buys: maximum number of entries to keep on the buy side after sorting, default 5; pass0for no truncation--holdings: path to the holdings code file--workers: number of concurrent daily bar fetches--json: output a JSON file for programmatic consumption (the JSON contains the pre-truncation count*_total)--roundtrip-cost-bps: round-trip transaction cost estimate (in bps), default 45--entry-consensus-min: parameter neighborhood entry consistency threshold, default 0.67--disable-robust-check: disable parameter neighborhood consistency filtering (use only when debugging)
Example:
python3 "$SKILL_DIR/scripts/daily_decisions.py" --top-n 120 --holdings "$HOME/my_holdings.txt"
The JSON output will contain both the raw candidates and the filtered candidates:
from_previous_day_close_raw/from_last_close_raw: raw candidates that satisfy the signal onlyfrom_previous_day_close/from_last_close: candidates after cost and robustness filtering- Each candidate is accompanied by
entry_consensus_ratio、edge_after_cost、cost_filter_passed、consensus_filter_passed todo_confirm_items: record of the currently adopted conventions (roundtrip=45bps, consensus=0.67, RSI interval offset)
Real-time quote snapshot (enhanced)
Fora known list of codes, batch-fetch quotes (concurrently), which can be used together with the codes output by daily_decisions :
python3 "$SKILL_DIR/scripts/realtime_quotes.py" 600519 000001 601318 --json
python3 "$SKILL_DIR/scripts/realtime_quotes.py" -f "$HOME/my_holdings.txt" --workers 10
--json: output unified JSON (includingquotesand per-itemdetails)--intraday: additionally fetchthe lastminute K (--intraday-freqdefault5m), to facilitate checking time alignment with the daily snapshot- Data comes from
paper_trading/market_data.py: compared with full-market depth quotes, this is alightweight snapshot, and intraday prices update with the latest minute K
Script layout
| Path | Purpose |
|---|---|
scripts/daily_decisions.py |
Entry point: fetch pool, compute signals, print or --json |
scripts/realtime_quotes.py |
batch current price snapshots, optionally with the last minute K attached |
scripts/paper_trading/market_data.py |
Quotes and get_all_market_universe |
scripts/strategy_lab/strategies.py |
trend_pullback |
scripts/strategy_lab/indicators.py |
moving averages, RSI |
scripts/strategy_lab/strategy_params.py |
Default parameters and strategy name |
Integration with the execution layer
If you want to put signals into a paper trading account, you can combine and use in the Agent a-share-paper-trading: first read this skill's output, then call the paper trading CLI or HTTP API to place orders; this skill does notdepend on the paper trading process.