MCPcopy Create free account

hub / github.com/SebastienZh/StockTradebyZ / functions

Functions141 in github.com/SebastienZh/StockTradebyZ

↓ 6 callersFunctioncompute_zx_lines
返回 (zxdq, zxdkx)。zxdq=double-EWM;zxdkx=四均线平均。
pipeline/Selector.py:156
↓ 4 callersFunction_resolve_cfg_path
将配置中的相对路径解析为项目根目录下的绝对路径。
pipeline/select_stock.py:33
↓ 4 callersFunction_resolve_cfg_path
(path_like: str | Path, base_dir: Path = _ROOT)
agent/gemini_review.py:54
↓ 4 callersFunction_run
运行子进程,失败时终止整个流程。
run_all.py:29
↓ 4 callersFunctioncompute_weekly_ma_bull
周线均线多头排列标志(MA_short > MA_mid > MA_long), forward-fill 到日线 index,返回 bool Series。 周线收盘价 index 为真实交易日,reindex 后 ffill 可正确对齐。
pipeline/Selector.py:195
↓ 3 callersMethod_brick_arr
(self, hist: pd.DataFrame)
pipeline/Selector.py:577
↓ 3 callersMethod_get_hist
(self, df: pd.DataFrame, date: pd.Timestamp)
pipeline/Selector.py:279
↓ 3 callersFunction_load_cfg
()
dashboard/app.py:28
↓ 3 callersFunction_resolve_cfg_path
将配置中的路径统一解析为绝对路径:相对路径基于项目根目录。
pipeline/fetch_kline.py:60
↓ 3 callersFunction_resolve_path
(path_like: Union[str, Path])
pipeline/pipeline_io.py:28
↓ 3 callersMethodprepare_df
预计算知行线、KDJ、周线多头排列、向量化 pick mask。
pipeline/Selector.py:748
↓ 3 callersMethodvec_picks_from_prepared
( self, df: pd.DataFrame, start: Optional[pd.Timestamp] = None, end: Optional[pd.Tim
pipeline/Selector.py:944
↓ 2 callersFunction_apply_axis_style
统一设置所有子图的坐标轴样式。
dashboard/components/charts.py:280
↓ 2 callersFunction_apply_vec_filters
对列表中所有实现了 vec_mask 的 Filter 取交集,返回布尔数组。
pipeline/Selector.py:679
↓ 2 callersFunction_atomic_write
原子写入:先写 .tmp,再 os.replace。
pipeline/pipeline_io.py:37
↓ 2 callersFunction_calc_zx_lines
知行短期线 (zxdq) = double-EWM(span) 知行多空线 (zxdkx) = 四均线均值 MA(m1,m2,m3,m4) 应在完整历史数据上调用,确保预热期足够。
dashboard/components/charts.py:122
↓ 2 callersFunction_compute_brick_numba
( high: np.ndarray, low: np.ndarray, close: np.ndarray, n: int, m1: int, m2: int, m3: int, t: floa
pipeline/Selector.py:84
↓ 2 callersMethod_compute_vec_pick
(self, df: pd.DataFrame)
pipeline/Selector.py:892
↓ 2 callersFunction_default_log_path
()
pipeline/fetch_kline.py:65
↓ 2 callersMethod_j_series
(self, hist: pd.DataFrame)
pipeline/Selector.py:361
↓ 2 callersFunction_looks_like_ip_ban
(exc: Exception)
pipeline/fetch_kline.py:95
↓ 2 callersMethod_precompute_brick
就地写入 brick / brick_growth。
pipeline/Selector.py:883
↓ 2 callersMethod_zxdq_arr
(self, df: pd.DataFrame)
pipeline/Selector.py:649
↓ 2 callersFunctioncmd_preselect
(args: argparse.Namespace)
pipeline/cli.py:50
↓ 2 callersMethodcompute_arr
返回砖高 ndarray(直接调用 Numba JIT,避免 Series 包装开销)。
pipeline/Selector.py:548
↓ 2 callersFunctioncompute_kdj
返回带 K/D/J 列的 DataFrame(Numba 加速 KDJ 递推)。
pipeline/Selector.py:139
↓ 2 callersFunctioncompute_weekly_close
日线 → 周线收盘价(每周最后一个实际交易日)。 不依赖固定 resample 锚点(周日/周五),而是直接按 ISO 周编号分组取最后一行,index 保持为真实交易日日期。
pipeline/Selector.py:173
↓ 2 callersMethodfrom_dict
(cls, d: Dict[str, Any])
pipeline/schemas.py:49
↓ 2 callersFunctionload_config
加载 rules_preselect.yaml,返回原始 dict.
pipeline/select_stock.py:43
↓ 2 callersFunctionmake_daily_chart
日线图:K线 + 知行短期线 + 知行长期线 + 量能 知行线在完整数据上预热后截断,保证均线正确性。
dashboard/components/charts.py:304
↓ 2 callersMethodrun
(self)
agent/base_reviewer.py:84
↓ 2 callersMethodto_dict
(self)
pipeline/schemas.py:22
↓ 1 callersMethod__init__
( self, j_threshold: float = -5.0, j_q_threshold: float = 0.10,
pipeline/Selector.py:702
↓ 1 callersFunction_add_log_file
可选:追加文件日志到 data/logs/pipeline_YYYY-MM-DD.log。
pipeline/cli.py:37
↓ 1 callersFunction_build_weekly_df
日线 DataFrame → 周线 OHLCV DataFrame。 使用 'W-FRI'(以周五为周末)对齐,确保每周最后一个实际交易日落在正确的周桶内。 dropna 保证只保留有完整 OHLCV 的周。
dashboard/components/charts.py:236
↓ 1 callersFunction_calc_brick
计算砖型图的 raw 值(通达信 VAR6A = VAR5A - VAR2A,clip 于 t)。 注意:此函数返回 raw(即通达信"砖型图"本身),而非差分后的 brick。 raw[i] = max(VAR5A[i] - VAR2A[i] - t, 0)
dashboard/components/charts.py:180
↓ 1 callersFunction_calc_kdj
计算 KDJ 指标(通达信标准公式)。 RSV = (close - LLV(low,n)) / (HHV(high,n) - LLV(low,n)) * 100 K = EMA(RSV, alpha=1/m1) (等价 SMA(RSV,m1,1)) D = EM
dashboard/components/charts.py:90
↓ 1 callersFunction_calc_ma
(series: pd.Series, window: int)
dashboard/components/charts.py:86
↓ 1 callersFunction_calc_rangebreaks_daily
根据实际交易日期动态计算 rangebreaks,彻底去除所有空缺(含节假日)。 原理: 1. 排除周末(bounds=["sat","mon"]) 2. 找出 [min_date, max_date] 范围内所有工作日(周一~周五)中,
dashboard/components/charts.py:23
↓ 1 callersFunction_calc_rangebreaks_weekly
根据完整日线交易日期计算周线 rangebreaks,去除因长节假日产生的空周。 必须传入完整日线日期(而非截断后的周线日期),才能正确覆盖截断窗口 边界之外的空周(如春节整周落在窗口起点之前一周)。 原理:枚举 [min, max] 范围内所有理论周五,找出整
dashboard/components/charts.py:47
↓ 1 callersFunction_calc_warmup
根据启用策略的参数计算最长所需 warmup bars.
pipeline/select_stock.py:134
↓ 1 callersFunction_cool_sleep
(base_seconds: int)
pipeline/fetch_kline.py:103
↓ 1 callersFunction_ensure_dir
(path: Path)
pipeline/pipeline_io.py:33
↓ 1 callersFunction_export_fig
将 Plotly Figure 导出为 JPEG。
dashboard/export_kline_charts.py:63
↓ 1 callersFunction_filter_by_boards_stocklist
(df: pd.DataFrame, exclude_boards: set[str])
pipeline/fetch_kline.py:167
↓ 1 callersFunction_get_kline_tushare
(code: str, start: str, end: str)
pipeline/fetch_kline.py:128
↓ 1 callersFunction_green_run
green_run[i] = 截至 i-1 连续绿柱根数(brick < 0)。
pipeline/Selector.py:52
↓ 1 callersFunction_kdj_core
(rsv: np.ndarray)
pipeline/Selector.py:39
↓ 1 callersFunction_load_candidates
从 candidates JSON 文件中读取股票代码列表及 pick_date。 Returns: (codes, pick_date) pick_date 为空字符串时表示 JSON 中无该字段。
dashboard/export_kline_charts.py:33
↓ 1 callersFunction_load_candidates_map
()
dashboard/app.py:36
↓ 1 callersFunction_load_config
(config_path: Path = _CONFIG_PATH)
pipeline/fetch_kline.py:225
↓ 1 callersFunction_load_raw
加载单只股票日线 CSV。
dashboard/export_kline_charts.py:50
↓ 1 callersFunction_load_raw
(code: str)
dashboard/app.py:48
↓ 1 callersFunction_max_vol_not_bearish
滚动 n 日窗口内,成交量最大那天不为阴线(close >= open)。
pipeline/Selector.py:65
↓ 1 callersMethod_passes
(self, hist: pd.DataFrame)
pipeline/Selector.py:288
↓ 1 callersMethod_precompute_zx_wma
就地写入 zxdq / zxdkx / wma_bull。
pipeline/Selector.py:871
↓ 1 callersFunction_print_recommendations
读取最新 suggestion.json,打印推荐购买的股票。
run_all.py:41
↓ 1 callersFunction_resolve_pick_date
确定选股基准日期:None → 最晚可用交易日,否则向前搜索最近日期.
pipeline/select_stock.py:113
↓ 1 callersFunction_sorted_zx
保证均线参数从小到大排列.
pipeline/select_stock.py:107
↓ 1 callersFunction_to_ts_code
把6位code映射到标准 ts_code 后缀。
pipeline/fetch_kline.py:118
↓ 1 callersMethod_zx_vals
返回 (zxdq, zxdkx, close) 最新值。
pipeline/Selector.py:405
↓ 1 callersMethodapply_selector_features
在 prepare_base_only() 结果上叠加 selector.prepare_df()。 使用线程池:pandas/numpy 计算会释放 GIL,避免 Windows spawn 开销。
pipeline/pipeline_core.py:175
↓ 1 callersMethodbrick_growth_arr
每日砖型图增长倍数数组(用于 top-k 排序)。
pipeline/Selector.py:630
↓ 1 callersMethodbrick_growth_on_date
返回指定日期的砖型图增长倍数(top-k 排序用)。 优先读预计算列 'brick_growth'。
pipeline/Selector.py:922
↓ 1 callersMethodbuild
(self, prepared: Dict[str, pd.DataFrame])
pipeline/pipeline_core.py:281
↓ 1 callersFunctionbuild_parser
()
pipeline/cli.py:109
↓ 1 callersFunctioncompute_brick_chart
通达信砖型图公式 → 砖高 Series(red>0,green<0)。
pipeline/Selector.py:228
↓ 1 callersMethodextract_json
(text: str)
agent/base_reviewer.py:44
↓ 1 callersMethodfind_chart_images
(self, pick_date: str, code: str)
agent/base_reviewer.py:35
↓ 1 callersMethodgenerate_suggestion
(self, pick_date: str, all_results: List[dict], min_score: float)
agent/base_reviewer.py:58
↓ 1 callersMethodimage_to_part
将图片文件转为 Gemini Part 对象。
agent/gemini_review.py:90
↓ 1 callersMethodload_candidates
(path: Path)
agent/base_reviewer.py:31
↓ 1 callersFunctionload_codes_from_stocklist
(stocklist_csv: Path, exclude_boards: set[str])
pipeline/fetch_kline.py:182
↓ 1 callersFunctionload_config
(config_path: Path | None = None)
agent/gemini_review.py:59
↓ 1 callersMethodload_prompt
(prompt_path: Path)
agent/base_reviewer.py:27
↓ 1 callersFunctionload_raw_data
读取 data_dir 下所有 *.csv,统一处理列名/日期/排序.
pipeline/select_stock.py:64
↓ 1 callersFunctionmain
()
run_all.py:92
↓ 1 callersFunctionmain
()
dashboard/export_kline_charts.py:91
↓ 1 callersFunctionmain
(log_path: Optional[Path] = None)
pipeline/fetch_kline.py:235
↓ 1 callersFunctionmain
()
pipeline/cli.py:129
↓ 1 callersFunctionmain
()
agent/gemini_review.py:132
↓ 1 callersFunctionmake_weekly_chart
周线图:K线 + 四条 MA 均线 + 量能(纯净版,仅用于看盘与导出)。 df 为完整日线 DataFrame,内部聚合为周线后截取 bars 根展示。 rangebreaks 基于完整日线日期计算,确保节假日空周被正确排除。
dashboard/components/charts.py:395
↓ 1 callersMethodpasses_df_on_date
(self, df: pd.DataFrame, date: pd.Timestamp)
pipeline/Selector.py:306
↓ 1 callersMethodpasses_df_on_date
(self, df: pd.DataFrame, date: pd.Timestamp)
pipeline/Selector.py:942
↓ 1 callersMethodpasses_hist
(self, hist: pd.DataFrame)
pipeline/Selector.py:299
↓ 1 callersMethodprepare
完整预处理:turnover_n + selector.prepare_df(),多进程并行。
pipeline/pipeline_core.py:136
↓ 1 callersMethodprepare_df
完整预计算:brick + zxdq/zxdkx + wma_bull + brick_growth + _vec_pick。 返回 df 副本。
pipeline/Selector.py:901
↓ 1 callersMethodprepare_df_brick_only
轻量版 prepare_df:假设 zxdq / zxdkx / wma_bull 列已存在, 仅重新计算 brick / brick_growth / _vec_pick。 **就地修改 df**(不 copy),超参搜索内层循环专用,速度快 3-
pipeline/Selector.py:912
↓ 1 callersFunctionresolve_preselect_output_dir
返回候选输出目录,优先级:CLI参数 > 配置文件 global.output_dir > 默认值。
pipeline/select_stock.py:51
↓ 1 callersMethodreview_stock
子类需实现此方法,调用具体的 LLM 进行打分,并返回 JSON 解析字典。
agent/base_reviewer.py:54
↓ 1 callersFunctionrun_b1
在流动性池内运行 B1 策略,返回 Candidate 列表. 优化:对每只股票先调用 prepare_df() 预计算所有指标列, 再用 vec_picks_from_prepared() 直接查表,避免重复计算。
pipeline/select_stock.py:157
↓ 1 callersFunctionrun_brick
在流动性池内运行砖型图策略,返回按 brick_growth 降序的 Candidate 列表. 优化:对每只股票先调用 prepare_df() 预计算 brick/zxdq/wma_bull 等列, 再用 vec_picks_from_prepared() 直接查表,brick
pipeline/select_stock.py:206
↓ 1 callersFunctionrun_preselect
量化初选主函数,返回 (pick_date_ts, List[Candidate])。 不写任何文件,由 cli.py 负责落盘。 参数 ---- config_path : rules_preselect.yaml 路径(None = 默认) d
pipeline/select_stock.py:277
↓ 1 callersFunctionsave_candidates
将 CandidateRun 序列化为 JSON,写入磁盘。 参数 ---- run : CandidateRun 对象 candidates_dir : 输出目录,默认 data/candidates/ write_da
pipeline/pipeline_io.py:45
↓ 1 callersFunctionsetup_logging
初始化日志:同时输出到 stdout 和指定文件。
pipeline/fetch_kline.py:69
↓ 1 callersFunctionvalidate
(df: pd.DataFrame)
pipeline/fetch_kline.py:155
↓ 1 callersMethodvec_mask
(self, df: pd.DataFrame)
pipeline/Selector.py:665
Method__call__
(self, hist: pd.DataFrame)
pipeline/Selector.py:253
Method__call__
(self, hist: pd.DataFrame)
pipeline/Selector.py:366
Method__call__
(self, hist: pd.DataFrame)
pipeline/Selector.py:421
next →1–100 of 141, ranked by callers