AI 原生量化投研平台AI-native quantitative research platform
正在加载…Loading…
页面仍在加载,可以继续等待,或重新加载。The page is still loading. You can keep waiting or reload.
部分页面资源未能加载,请重新加载。Some page resources could not load. Please reload.
设备当前处于离线状态,恢复连接后可以继续等待或重新加载。Your device is offline. Once connected, you can keep waiting or reload.
因子逻辑
技术分析指标 · 通道与位置:布林带位置 %B(参数 20, 2σ)。收盘价在 20 日布林带内的相对位置。计算式:(close - m_ta_bbands_l(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0)) / NULLIF(m_ta_bbands_u(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0) - m_ta_bbands_l(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0), 0) 值来自平台表 cn_stock_factors_ta_channel.boll_pos_20。由 BOLL_UPR 同族模板推导:m_ta_bbands_u(close,timeperiod:=26) → (close - m_ta_bbands_l(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0)) / NULLIF(m_ta_bbands_u(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0) - m_ta_bbands_l(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0),0)。 用源码布林带上下轨同族模板,按网页增加 (close−下轨)/(上轨−下轨) 位置归一化;非纯参数替换。 以下 SQL 为推导版本,非源码原文;登记与分析仍读取平台表原值。
BigQuant SQL
SELECT date, instrument, (close - m_ta_bbands_l(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0)) / NULLIF(m_ta_bbands_u(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0) - m_ta_bbands_l(close, timeperiod:=20, nbdevup:=2, nbdevdn:=2, matype:=0),0) AS factorFROM cn_stock_bar1dORDER BY date, instrumentbq examples new strategies/multi_factor.py bqf_10670_strategy.py --name '布林带位置20日 选股' \ --set 'TABLES=["cn_stock_factors_ta_channel"]' --set 'FACTORS=["boll_pos_20"]' --set 'HOLD=30' \ --set 'EVERY=20' --set 'BENCHMARK="000300.SH"' --set 'START="2021-01-01"' \ --set 'END="2026-09-29"' \ && python bqf_10670_strategy.pySELECT date, instrument, boll_pos_20 FROM cn_stock_factors_ta_channel带入当前因子,在 Cowork 中继续研究。
from bigquant import factor
values = factor.values(["BQF_10670"], "2021-01-01", "2026-09-29")report = factor.analyze( values, start_date="2021-01-01", end_date="2026-09-29", universe=("all", "hs300"), neutralize=(None, "size+industry"), depth="deep",)report.render()