Skip to content

randomwalkhan/Short-Term-Reversal-Strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15,005 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reversal 3.5

Reversal 3.5 Live Paper Test

  • Latest checkpoint (ET): 2026-06-16 17:45:11 EDT
  • Equity: $24,583.25 | Realized: $15,985.75 | Unrealized: $-1,402.50 | Open positions: 1
  • Today closed trades: 1
  • Current slot: share_ext_1745
  • Universe: qqq_plus_leverage_etfs
  • Chart windows: Overall / 1D / 1W / 1M (default open panel: Overall)

Current Open Positions

ticker asset_type execution_mode          instrument  units  cash_spent  current_position_value  current_price  unrealized_pnl  unrealized_return_pct  business_days_held
  DRAM     option         option DRAM260717C00069000     17     12622.5                 11220.0            6.6         -1402.5                 -11.11                   0
Overall

Reversal 3.5 Live Equity Overall

1D

Reversal 3.5 Live Equity 1D

1W

Reversal 3.5 Live Equity 1W

1M

Reversal 3.5 Live Equity 1M

Reversal3.3.ipynb remains the current research notebook for short-term reversal analysis and option profitability confidence estimation; 3.5 is the current execution/filtering version.

Reversal3.3.ipynb 仍是当前研究型 notebook,用于短期反转研究和期权盈利概率评估;3.5 是当前执行层和过滤器版本。

Strategy Summary | 策略总结

This repository studies a short-term reversal call-buying setup built around large intraday drawdowns, historical recovery probability, and staged optimization. The current official version is Reversal 3.5.

本仓库研究的是一套基于“日内大跌后短期反转”的 call 策略,通过历史反弹成功率和逐阶段优化来推进。目前官方版本是 Reversal 3.5

  • Official universe: qqq_plus_leverage_etfs = qqq_only_filtered + SOXL + UPRO + DRAM
  • Official filters: 60d lookback, matched_signals >= 10, minimum current drop > 0.5%, a non-ETF trailing P/E < 140 universe guard, and a live trend-health gate that blocks short-term down channels
  • Official timing overlay: 5d technical-indicator timing score with a 0.50 no-trade gate
  • Trade framing: near-ATM calls, ~30 DTE in backtests, +10% / +15% / -10% exit ladder in research, +15% / +15% / -10% in live execution
  • Live paper test: no-lookahead scheduled scans with an option-liquidity gate, a no-trade rule when liquidity is poor, and GitHub-published dashboard output
  • Research discipline: RESEARCH_GUARDRAILS.md

Research Journey | 研究历程

This project started from something I kept seeing on my screen: after a sharp down day, some stocks would rebound surprisingly quickly over the next few sessions. I wanted to know which names actually behaved that way consistently, and whether that pattern was strong enough to support short-term reversal option trades rather than just a good-looking anecdote.

这个项目最开始其实是一个很朴素的观察:我发现有些股票在大跌后的几天里,经常会出现比较快的反弹。我当时想弄清楚,到底是哪些股票更容易出现这种走势,这种现象到底只是偶然,还是能被系统化地验证,并进一步转化成 short-term reversal option trades。

In the earliest Reversal 1.x style work and the preserved early notebooks such as versions/notebooks/Reversal2.0.ipynb and versions/notebooks/Reversal2.1.ipynb, I started with a very small legacy watchlist of roughly ten names. The scripts pulled one year of Yahoo Finance Close, High, and Low data, computed daily Max Drop, and then let me set three simple inputs: a same-day drop threshold, a recovery target, and a lookahead window. Once those were set, the code would tell me which tickers had the tendency to rebound by x% of the drop within t + lookahead trading days after a qualifying drawdown.

在最早的 Reversal 1.x 思路和现在仓库里保留下来的早期 notebook,例如 versions/notebooks/Reversal2.0.ipynbversions/notebooks/Reversal2.1.ipynb 中,我一开始只研究大约十只左右的股票,也就是后面保留下来的 legacy_watchlist_11 这条线。那时的脚本会先从 Yahoo Finance 下载过去一年的 CloseHighLow,再计算每日的 Max Drop。然后我可以手动设定三个核心参数:当日跌幅阈值、反弹比例、以及 lookahead day。脚本跑完之后,会直接输出哪些 ticker 在满足当日跌幅条件后,能在 t + lookahead 的窗口里完成我设定的反弹比例。

After identifying the names that exhibited this behavior, I added an option layer. In those earlier versions, I could input expiry, implied volatility, entry price, risk-free rate, and related assumptions, then use Black-Scholes and GBM-based simulations to estimate day-by-day call PnL confidence intervals. That part was important because it moved the project from “which names bounce” to “what the option trade might actually look like.”

在找出这些更容易反弹的股票之后,我又继续往期权端推进。早期版本里,我已经可以输入到期日、隐含波动率、买入成本、无风险利率等参数,然后用 Black-Scholes 和基于 GBM 的模拟去估计买入对应 call 之后,在未来每天的盈利区间和置信水平。对我来说,这一步很关键,因为它把问题从“哪些股票容易反弹”推进到了“如果真的买对应的 call,这笔交易可能长什么样”。

From there, the project became a sequence of research upgrades rather than a single script:

从那里开始,这个项目就逐步从一个小脚本,变成了一条连续推进的研究路径:

  1. Formalize the base signal.
    我先把“日内大跌” formalize 成 signal day,再把“未来几天是否回补 signal-day 跌幅的 70%”定义成最基础的成功标准。这条主线后来延续到 Reversal3.3.ipynbbacktest_reversal_3_1_calls.py 里。
  2. Test where the effect is actually strongest.
    然后我开始比较不同 universe,确认这个现象究竟在哪类股票池里最稳定。compare_reversal_2_3_3_universes.py 这一步告诉我,效果最强的不是越广越好,而是更精选的 qqq_only_filtered
  3. Improve the signal before scaling execution.
    在 universe 固定下来之后,我继续测试更短的观察窗口、minimum current drop、以及少量 leveraged ETF overlay,逐步形成了 60d window、minimum current drop > 0.5%、以及 SOXL + UPRO 这套基础路径;Reversal 3.5 进一步把 memory ETF DRAM 加入候选池观察。
  4. Add regime awareness and execution controls.
    再往后,我开始研究 regime filter、holiday handling、option-liquidity gating,以及如何把整个流程接成 no-lookahead 的 live paper runner,并持续把结果写回 GitHub dashboard。
  5. Add a timing overlay instead of forcing every valid signal into a trade.
    这一步是 3.3 的核心:在读完关于技术指标窗口长度与预测周期匹配的研究之后,我开始测试更短窗口的 timing overlay。目标不是把主策略推翻,而是在主信号已经成立之后,再判断这笔单到底该不该做。最后我保留了 5d 技术指标窗口,并引入 timing_score >= 0.50 的 no-trade 机制。

Representative research outputs I still keep in the repo:

我现在仍然保留在仓库里的代表性研究输出包括:

Research question Script / notebook Representative output
Which universe best captures the reversal effect? compare_reversal_2_3_3_universes.py reversal_2_3_3_universe_comparison.csv, reversal_2_3_3_universe_comparison.png
Which factor refinement improves the base setup most? backtest_reversal_article_variants.py reversal_article_variants_summary.csv, reversal_2_4_article_variants.png
Does a minimum-drop threshold improve trade quality? backtest_reversal_2_5_min_drop_experiment.py reversal_2_5_min_drop_summary.csv, reversal_2_5_min_drop_experiment.png
Do a few leveraged ETFs improve the official setup? backtest_reversal_3_1_leveraged_etf_experiment.py reversal_3_1_leveraged_etf_summary.csv, reversal_3_1_leveraged_etf_experiment.png
Should the strategy be paused in hostile market regimes? analyze_reversal_3_1_regime_score.py, analyze_reversal_3_1_regime_predictive_power.py reversal_3_1_regime_score.png, reversal_3_1_regime_gating_comparison.png

That is how the current live-paper implementation emerged. I did not begin with execution infrastructure first. I started with a repeatable rebound pattern, narrowed the universe, improved the signal path, tested option framing, and only then connected the research into a scheduled live process with execution constraints.

这也就是现在这套 live paper implementation 的来历。对我来说,顺序一直是先确认价格恢复现象是否真实存在,再判断它在哪些 universe 和参数下最稳定,然后再去讨论期权执行、流动性约束和 live monitoring。现在仓库里的执行层,就是这条研究路径自然延伸出来的结果。

Current Version | 当前官方版本

Release notes (3.5)

  • 3.5 execution update: early-entry scans are now shadow-only. The 10:00 AM-12:00 PM ET scanner still records candidates and option-liquidity context, but it no longer opens live paper or Alpaca paper positions.
  • 3.5 universe update: add DRAM, a memory/semiconductor ETF, to the curated qqq_plus_leverage_etfs candidate cache for live monitoring and future research.
  • 3.4.4 hotfix: tighten the option entry liquidity gate to open interest >= 110, volume >= 20, and spread <= 14% to reduce low-liquidity option fills.
  • 3.4.3 hotfix: distinguish executable option quotes from stale lastPrice marks. Live dashboards now expose option mark source / exit signal price, and take-profit / stop-loss triggers ignore stale last-price-only marks when bid/ask are unavailable.
  • 3.4.2 hotfix: live execution now loads the promoted qqq_plus_leverage_etfs universe from the checked-in ticker cache by default, avoiding repeated Nasdaq screener requests during every 5-minute cycle. Set REVERSAL_FORCE_DYNAMIC_UNIVERSE=true only when an operator intentionally wants to rebuild the universe live.
  • Keep the official 3.3.3 strategy definition and exit-rescan patch intact.
  • Keep the former high-confidence early-entry window from 10:00 AM to 12:00 PM ET as a shadow scanner, refreshed every 5 minutes.
  • Introduce a deliberately strict early_entry_score gate, calibrated from the CRWD 2026-05-08 morning case: early_entry_score >= 0.67, success_rate >= 88%, matched_signals >= 30, and at least 60% reclaim from the early intraday low.
  • Add a TEAM-inspired recovery-stability filter to the morning gate: candidates must show stable intraday repair through reclaim, positive short-window slope, EMA/VWAP support, and limited pullback from the post-low high.
  • Preserve the one-new-entry-per-day rule for real entries; shadow early-entry observations do not block the regular 3:00 PM ET entry.
  • Add an isolated Alpaca paper execution runner for the current 3.5 signal stack. It uses local-only credentials, submits regular-window Alpaca paper option orders, and keeps the GitHub-published live paper runner separate.
  • 3.4.1-alpaca-paper.1 hotfix: tolerate empty first-run CSV files and support a same-day block list after a missed live paper runner trade, preventing late catch-up entries that would make Alpaca paper results incomparable.

版本说明(3.5

  • 3.5 execution update:early-entry 扫描改为 shadow-only10:00 AM-12:00 PM ET 仍会记录候选、分数和期权流动性,但不再真实打开 live paper 或 Alpaca paper 仓位。
  • 3.5 universe update:把 memory / semiconductor ETF DRAM 加入精选 qqq_plus_leverage_etfs 候选池,用于 live 观察和后续研究。
  • 3.4.4 hotfix:把期权入场流动性门槛提高到 open interest >= 110volume >= 20spread <= 14%,降低低流动性 option fill 的风险。
  • 3.4.3 hotfix:区分可执行的期权 bid/ask 报价与 stale lastPrice mark。live dashboard 现在展示 option mark 来源 / exit signal price,并且当 bid/ask 不可用时,不再用 stale lastPrice-only mark 触发止盈或止损。
  • 3.4.2 hotfix:live 执行默认直接读取 repo 中已生成的 qqq_plus_leverage_etfs ticker cache,避免每 5 分钟循环都请求 Nasdaq screener;只有在明确设置 REVERSAL_FORCE_DYNAMIC_UNIVERSE=true 时才现场重建 universe。
  • 保留 3.3.3 的策略定义和 exit-rescan 修复。
  • 保留原来的 10:00 AM12:00 PM ET 高置信早盘窗口,但现在只作为 shadow scanner,每 5 分钟记录一次候选。
  • 新增刻意更严格的 early_entry_score gate,以 2026-05-08 早盘 CRWD 这类案例为校准标准:early_entry_score >= 0.67success_rate >= 88%matched_signals >= 30,并且至少从早盘日内低点 reclaim 60%
  • 加入从 TEAM 日内稳定修复案例提炼出的 recovery-stability 过滤:早盘候选必须体现 reclaim、短窗斜率转正、EMA/VWAP 支撑,以及从低点后高点回撤有限。
  • 真实入场仍保留一天最多新开一笔的限制;shadow early-entry 观察不会阻止同一天 3:00 PM ET 的常规入场。
  • 新增独立的 Alpaca paper execution runner,用当前 3.5 信号栈提交常规窗口的 Alpaca paper 期权订单;API 凭据只保存在本地,不进入 GitHub,并且和现有 GitHub-published live paper runner 分开运行。
  • 3.4.1-alpaca-paper.1 hotfix:修复首次运行空 CSV 导致的读取崩溃,并支持在错过 live paper runner 交易后封锁当天剩余入场,避免 Alpaca paper 下午补开一笔不可比的交易。

Featured Result | 重点结果

The latest recorded official Reversal 3.3 backtest keeps the promoted 3.1 research stack intact, then adds a 5d timing overlay with a 0.50 no-trade gate on top of the existing candidate selection. On the current 1-year data snapshot, that change lifts win rate and sharply compresses drawdown while keeping Sharpe slightly above the no-overlay baseline. The current recorded Reversal 3.3 result is +690.85% total return, -26.42% max drawdown, 69.23% win rate, and 4.32 Sharpe. Reversal 3.5 keeps that core strategy definition, changes early-entry execution to shadow-only after live-paper underperformance, adds DRAM to the curated ETF overlay for memory-cycle exposure, and keeps the cached live-universe fallback, stale option quote protection, and tighter option-liquidity entry gate.

最近一次记录的 Reversal 3.3 官方回测保留了 3.1 提升后的核心研究口径,并在现有候选筛选之上新增 5d timing overlay 与 0.50 no-trade gate。在当前的 1 年数据快照下,这一改动显著压低了最大回撤,同时提升了胜率,并让 Sharpe 仍然略高于无 overlay 的基线。当前记录的 Reversal 3.3 结果为:总收益 +690.85%、最大回撤 -26.42%、胜率 69.23%、Sharpe 4.32。Reversal 3.5 保留核心策略定义,但在 live paper 观察到 early-entry 表现不稳定后,将 early-entry 执行切换为 shadow-only,同时加入 memory ETF DRAM 作为精选 ETF overlay 的新增候选,并保留 cached live-universe fallback、stale option quote 保护和更严格的 option-liquidity 入场门槛。

Backtest window: 2025-04-23 to 2026-04-23.

回测区间:2025-04-232026-04-23

Research discipline is documented in RESEARCH_GUARDRAILS.md; future upgrades should be judged against those standards instead of curve quality alone.

研究纪律已写入 RESEARCH_GUARDRAILS.md;以后版本升级应按这些标准判断,而不是只看曲线是否更好看。

Short-Term Reversal Call Backtest

Optimization Path | 优化路径

The current strategy structure is intentionally sequential:

当前策略优化逻辑是明确分阶段推进的:

  1. Select the best universe first.
    先确定最优 universe。
  2. Hold that universe fixed.
    固定 universe,不再混入新的 universe 变化。
  3. Compare factor / signal refinements on top of the chosen universe.
    在选定 universe 之上比较新的因子或信号改造。
  4. Promote the best-performing factor into the next official version.
    把表现最好的因子升级为下一个正式版本。
  5. Re-open the universe only when a controlled overlay experiment beats the official setup across more than one horizon.
    只有当受控 overlay 实验在多个观察周期上都优于官方设定时,才重新打开 universe 层做升级。

Stage 1: Universe Selection | 第一阶段:选 Universe

Reversal 2.3.3 compared five universes under the original dynamic matched_signals >= 10 rule. The conclusion was clear: qqq_only_filtered remained the best universe and is therefore preserved in Reversal 2.5.3.

Reversal 2.3.3 在原始动态 matched_signals >= 10 规则下比较了五组 universe,结论非常明确:qqq_only_filtered 仍然最优,因此在 Reversal 2.5.3 中被保留。

Backtest window: 2025-03-17 to 2026-03-16.

回测区间:2025-03-172026-03-16

Universe Usable Tickers Win Rate Return Max DD Sharpe Equity Output Trade Output
qqq_only_filtered 97 59.02% +552.91% -32.46% 2.93 equity trades
legacy_watchlist_11 10 54.15% +81.27% -31.57% 1.18 equity trades
qqq_spy_filtered 501 53.53% +54.38% -43.24% 0.91 equity trades
spy_only_filtered 491 52.92% +36.28% -43.26% 0.73 equity trades
nasdaq_spy_filtered 1163 50.81% -7.10% -50.29% 0.23 equity trades
nasdaq_only_filtered 830 49.59% -30.21% -50.51% -0.15 equity trades

Reversal 2.3.3 Universe Comparison

Stage 2: Factor Selection | 第二阶段:选 Factor

After fixing the universe as qqq_only_filtered, the article-inspired comparison script tested volume rescaling, PCA de-factoring, kappa / s-score filtering, and shorter rolling windows. The 60d window was the strongest factor upgrade and is therefore promoted into Reversal 2.4.

在把 universe 固定为 qqq_only_filtered 之后,论文启发的对比脚本继续测试了成交量 rescaling、PCA 去市场因素、kappa / s-score 过滤以及更短滚动窗口。最终 60d 窗口是最强的因子升级,因此被提升为 Reversal 2.4 的正式默认设置。

Backtest window: 2025-03-17 to 2026-03-16.

回测区间:2025-03-172026-03-16

Note: the stage 2 and stage 3 tables below use refreshed rerun results and include Sharpe ratios computed with the U.S. 10Y Treasury yield on 2026-03-16 (4.23%) as the annual risk-free rate.

说明:下面第二、第三阶段的表格都已经切换成最新重跑结果,并加入了 Sharpe ratio;Sharpe 统一使用 2026-03-16 的美国 10 年期国债收益率 4.23% 作为年化无风险利率。

Variant Return Max DD Win Rate Trades Sharpe
Window 60d +806.11% -30.56% 61.00% 241 3.41
Original 2.3.3 +552.91% -32.46% 59.02% 244 2.93
Add Volume +364.25% -37.58% 57.32% 239 2.44
Window 126d +276.80% -38.62% 56.83% 227 2.18
Window 252d + Recent Weight +181.17% -30.21% 56.31% 206 1.82
Kappa / s-score +145.58% -29.95% 55.61% 214 1.61
PCA Defactored +23.89% -42.39% 52.31% 216 0.60

Reversal 2.4 Article Variants

Stage 3: Minimum Drop Filter | 第三阶段:选 Minimum Drop

After fixing both the universe and the 60d factor, the next test was whether the live / backtest entry should require a minimum current drop. The 0.5% threshold was the strongest improvement, so it is promoted into Reversal 2.5 as the new official execution filter.

在把 universe 和 60d 因子都固定下来之后,下一步测试的是是否要为 live / backtest 入场增加 minimum current drop 门槛。最终 0.5% 阈值表现最好,因此被提升为 Reversal 2.5 的正式执行过滤。

Backtest window: 2025-03-17 to 2026-03-16.

回测区间:2025-03-172026-03-16

Minimum Drop Return Max DD Win Rate Trades Sharpe
0.0% +806.11% -30.56% 61.00% 241 3.41
0.5% +1305.60% -30.84% 62.08% 240 3.96
1.0% +594.68% -24.79% 60.44% 225 3.11
2.0% +485.14% -22.05% 62.13% 169 3.20
3.0% +77.61% -15.15% 60.00% 70 1.68
4.0% +3.56% -18.19% 52.38% 21 0.06

Reversal 2.5 Minimum Drop Experiment

Stage 4: Leveraged ETF Overlay | 第四阶段:精选 Leveraged ETF Overlay

After fixing the 60d factor and the minimum current drop > 0.5% filter, the next question was whether a very small number of leveraged ETFs should be allowed into the official universe. The research result was narrower than the original intuition: adding SOXL and UPRO consistently improved 1Y, 2Y, and 3Y results, while TQQQ did not add stable incremental benefit once those two were already present. Reversal 3.1 therefore promoted a curated overlay, not a broad leveraged-ETF bucket. Reversal 3.5 adds DRAM separately as a memory-cycle ETF candidate for live monitoring and future validation.

在把 60d 因子和 minimum current drop > 0.5% 过滤都固定下来之后,下一步研究的问题是:是否应该允许极少数 leveraged ETF 进入官方 universe。结果比最初的直觉更窄:SOXLUPRO1Y2Y3Y 上都稳定改善了结果,而 TQQQ 在加入这两只之后并没有继续带来稳定增益。因此 Reversal 3.1 提升的是一个精选 overlay,而不是泛化的 leveraged ETF 大篮子。Reversal 3.5 另行加入 DRAM,作为 memory-cycle ETF 候选进行 live 观察和后续验证。

Backtest window shown below (1Y comparison): 2025-03-31 to 2026-03-31.

下图展示的回测区间(1Y 比较):2025-03-312026-03-31

Variant 1Y Return 1Y Max DD 1Y Win Rate 1Y Sharpe
baseline_qqq_only_filtered +1136.44% -44.17% 61.67% 3.76
plus_tqqq +1148.88% -44.13% 61.67% 3.78
plus_soxl +1552.12% -44.20% 62.92% 4.16
plus_upro +1271.12% -44.07% 62.08% 3.90
plus_soxl_upro +1709.09% -44.30% 63.33% 4.28
plus_tqqq_soxl_upro +1707.90% -44.30% 63.33% 4.28

Reversal 3.1 Leveraged ETF Overlay Experiment

Stage 5: Timing Overlay and No-Trade Gate | 第五阶段:Timing Overlay 与 No-Trade 机制

After stabilizing the universe, factor path, and leveraged-ETF overlay, the next bottleneck was execution quality. The strategy still forced too many option entries in weak short-term timing conditions, and the share-fallback path made live execution drift away from the option-centric research thesis. I studied a technical-indicator paper that argued predictive performance improves when the input window roughly matches the forecast horizon, then tested 3d / 5d / 7d / 10d timing overlays on top of the existing setup.

在固定 universe、factor path 和 leveraged ETF overlay 之后,下一步的瓶颈变成了执行质量。原策略在一些短期 timing 较差的环境里仍然会硬开 option 单,而 share fallback 也让 live execution 慢慢偏离了最初的 option-centric 研究主线。基于一篇关于“技术指标输入窗口长度与预测周期匹配”的研究,我继续在现有策略之上测试了 3d / 5d / 7d / 10d 的 timing overlay。

The key result was not “trade more accurately by predicting everything.” It was “skip more bad trades.” Across the 3-year timing study, the 5d window gave the cleanest balance between lowering drawdown and staying aligned with the very short holding horizon of this strategy. When promoted into the official 1-year backtest, the 5d timing score with a 0.50 gate improved Sharpe from 4.24 to 4.32, lifted win rate from 63.27% to 69.23%, and compressed max drawdown from -48.99% to -26.42%.

这一步最重要的结论不是“把所有交易都预测得更准”,而是“更有效地跳过坏单”。在 3 年 timing study 里,5d 窗口在压低回撤和保持短持有期逻辑一致性之间给出了最平衡的结果。把这层机制提升到当前 1 年官方回测之后,5d timing score + 0.50 gate 把 Sharpe 从 4.24 提升到 4.32,胜率从 63.27% 提升到 69.23%,同时把最大回撤从 -48.99% 压缩到 -26.42%

Backtest window shown below (3Y timing study): 2023-04-23 to 2026-04-23.

下图展示的回测区间(3Y timing study):2023-04-232026-04-23

Timing Overlay Experiment

Stage 6: Target-Recovery Exit Study | 第六阶段:目标恢复价退出研究

After promoting the timing overlay, I tested whether exits should also be tied back to the original reversal thesis. Instead of using only a fixed option-level take-profit, this experiment converts the expected stock recovery target into a modeled option target price using Black-Scholes, 20d rolling realized volatility, and the 10-year Treasury rate used elsewhere in the project.

在 timing overlay 提升之后,我继续测试退出规则是否也应该回到最初的反转假设上。除了固定的 option-level 止盈之外,这个实验把“股价回补当日跌幅的 70%”转换成一个 Black-Scholes 估算的期权目标价;波动率使用 20d rolling realized volatility,无风险利率沿用项目中使用的 10 年期 Treasury rate。

The result is nuanced. A target based on the entry/reference close is useful as a risk-control idea, but it does not clearly dominate the current fixed +15% / -12% option exit. A target based on the signal-day low is too close to the entry in this backtest and performs poorly. I therefore keep this as research evidence rather than promoting it into the official live rule for now.

结论比较细:基于买入时 reference close 的目标价,确实有风险控制价值,但并没有明显优于当前固定 +15% / -12% 的 option 退出规则;而基于 signal-day low 的目标价在回测中离入场太近,表现较差。因此这一步暂时保留为研究证据,不直接提升为 live 规则。

Backtest window shown below: 2025-04-23 to 2026-04-23.

下图展示的回测区间:2025-04-232026-04-23

Variant Return Max DD Win Rate Sharpe Interpretation
fixed_15_12 +3056.34% -17.83% 70.43% 5.39 Current fixed option exit remains the strongest return-oriented rule
target_close_stop12 +1390.86% -16.87% 71.79% 4.91 More thesis-linked, slightly lower drawdown, but lower return and Sharpe
target_close_symmetric_stop +1308.54% -8.24% 50.00% 6.53 Strong risk-control profile, but the effective option stop is very tight and needs further execution testing
target_low_stop12 -10.74% -32.89% 75.70% -0.26 Low-reference target is too close to entry
target_low_symmetric_stop -11.30% -37.50% 75.93% -0.19 Low-reference target is not viable under this setup

Target-Recovery Exit Experiment

Version History | 历代更新

The project keeps its optimization trail explicit rather than hiding earlier versions. The current path is:

本项目保留完整的优化路径,当前主线是:

Versioning rule: when the research definition changes materially, bump the main version; for smaller fixes or execution-only adjustments, increment the last segment only.

版本规则:研究口径发生实质变化时,提升主版本;若只是小修复或执行层微调,只增加最后一位。

  • 2.3.3: lock the best universe as qqq_only_filtered
  • 2.4: promote the 60d observation window
  • 2.5: promote minimum current drop > 0.5%
  • 3.1: keep the 2.5 execution logic and upgrade the official universe to qqq_plus_leverage_etfs
  • 3.2: keep the 3.1 research configuration unchanged, add NYSE holiday protection, option-liquidity gating, share fallback execution, live position cash/value fields, the spread <= 15% option entry threshold, and the extended-hours take-profit / stop loss handling for share fallback
  • 3.2.1: keep the 3.2 strategy definition unchanged, but patch the live runner so off-hours checkpoints continue marking open positions and keep the dashboard/versioning flow consistent
  • 3.2.2: keep the 3.2.1 trading logic unchanged, but tighten the 1D live chart y-axis so small daily moves are easier to read
  • 3.3: remove new-entry share fallback, add a 5d technical-indicator timing overlay with a 0.50 no-trade gate, and promote the resulting lower-drawdown option-only execution path into both the official backtest and the live paper runner
  • 3.3.1: keep the 3.3 strategy intact, add a non-ETF trailing P/E guard at 140, and remove AMD, AXON, CSGP, DDOG, FANG, PLTR, and TSLA from the saved and dynamically built official universe
  • 3.3.2: keep the 3.3.1 universe and execution path intact, then add a live trend-health gate to block short-term down-channel candidates such as CMCSA while allowing sideways or recovering names
  • 3.3.3: keep the 3.3.2 strategy unchanged, but patch live exit scanning so take-profit / stop-loss checks rerun every 5 minutes inside repeated manage_* windows
  • 3.4: keep the 3.3.3 strategy and risk controls intact, then add a deliberately strict 10:00 AM-12:00 PM ET high-confidence early-entry permission using early_entry_score >= 0.67, success_rate >= 88%, matched_signals >= 30, and early reclaim >= 60%, while preserving the one-new-entry-per-day limit
  • 3.4.1: keep the 3.4 morning gate intact, then add a TEAM-inspired intraday recovery-stability filter so early entries also require a stable reclaim path instead of a single sharp bounce
  • 3.4.2: keep the 3.4.1 signal logic intact, but make live execution use the checked-in qqq_plus_leverage_etfs_tickers.csv cache by default so 5-minute cycles do not depend on live Nasdaq screener availability
  • 3.4.3: keep the 3.4.2 signal logic intact, but add executable-quote protection so stale option lastPrice marks do not trigger take-profit / stop-loss exits when bid/ask are unavailable
  • 3.4.4: keep the 3.4.3 signal and exit logic intact, but tighten option entry liquidity to open interest >= 110, volume >= 20, and spread <= 14%
  • 3.5: keep the 3.4.4 3:00 PM ET execution path intact, switch early-entry scans to shadow-only logging, add DRAM to the curated ETF overlay, and make data refresh detect newly added ticker CSVs
  • 3.4.1-alpaca-paper: add a separate Alpaca paper execution adapter for the current 3.4.1 signal stack without changing the research definition
  • 3.4.1-alpaca-paper.1: hotfix empty first-run CSV handling and same-day missed-trade blocking for the Alpaca paper adapter
  • 3.4.2-alpaca-paper.0: align the Alpaca paper adapter version with the 3.4.2 live runner
  • 3.4.3-alpaca-paper.0: inherit the 3.4.3 stale option quote protection in the Alpaca paper adapter
  • 3.4.4-alpaca-paper.0: inherit the 3.4.4 tighter option-liquidity entry gate in the Alpaca paper adapter
  • 3.5-alpaca-paper.0: align Alpaca paper with 3.5 by shadow-logging early entries rather than submitting morning option orders
  • 3.5-alpaca-paper.1: use live Alpaca account cash for early-entry shadow logging, so hypothetical budget context is not reported as zero

Earlier notebook snapshots such as versions/notebooks/Reversal2.5.3.ipynb, versions/notebooks/Reversal2.5.ipynb, versions/notebooks/Reversal2.4.ipynb, versions/notebooks/Reversal2.3.3.ipynb, versions/notebooks/Reversal2.3.2.ipynb, and versions/notebooks/Reversal2.3.1.ipynb are retained for version-by-version review.

诸如 versions/notebooks/Reversal2.5.3.ipynbversions/notebooks/Reversal2.5.ipynbversions/notebooks/Reversal2.4.ipynbversions/notebooks/Reversal2.3.3.ipynbversions/notebooks/Reversal2.3.2.ipynbversions/notebooks/Reversal2.3.1.ipynb 等旧版 notebook 都保留在仓库里,便于逐版本回看。

License | 版权

This repository is released under an explicit All Rights Reserved copyright notice. It is not an open-source project, and reuse, copying, modification, distribution, or derivative work creation requires prior written permission.

本仓库采用明确的 All Rights Reserved 版权声明,并非开源项目;复制、修改、分发、 再发布或基于本仓库创建衍生作品,均需事先获得书面许可。

Overview | 项目简介

This project focuses on identifying large intraday drawdowns, evaluating whether prices reverse over the next few trading days, and estimating the return distribution of related call-option trades.

本项目主要研究三件事:识别日内大幅下跌、评估未来几个交易日内的价格反转概率,以及估计相关看涨期权交易的收益分布。

The notebook works from CSV files stored under reversal_data/, Reversal 2.3 adds a dynamic universe builder, Reversal 2.3.1 adds a staged-entry options backtest plus universe-comparison scripts, Reversal 2.3.2 defaults the research flow to qqq_only_filtered with an in-notebook data-refresh step, Reversal 2.3.3 adds minimum-sample filtering plus top-15 ranked output, Reversal 2.4 promotes the 60d observation window into the default research and official backtest setup, Reversal 2.5 adds the minimum current drop > 0.5% entry filter, Reversal 2.5.1 improves spot-price handling by preferring extended-hours prices when available, Reversal 2.5.2 adds current ATM call IV plus 20d rolling sigma to the live screener output, Reversal 2.5.3 consolidates that live screener into a cleaner single-table layout, Reversal 3.1 upgrades the official universe to qqq_plus_leverage_etfs = qqq_only_filtered + SOXL + UPRO, Reversal 3.2 adds NYSE holiday awareness plus the option-liquidity/share-fallback execution layer to the live paper runner, Reversal 3.2.1 keeps open-position marking alive after hours, Reversal 3.2.2 tightens the 1D live chart axis when daily moves are small, Reversal 3.3 replaces new-entry share fallback with a no-trade rule while adding a promoted short-window timing overlay, Reversal 3.3.1 adds a non-ETF trailing P/E guard to the official universe, Reversal 3.3.2 adds a live trend-health gate to avoid short-term down-channel candidates, Reversal 3.3.3 patches repeated live exit scanning inside manage_* slots, Reversal 3.4 adds a high-confidence morning entry permission for unusually strong early reversal setups, Reversal 3.4.1 adds an intraday recovery-stability check inspired by TEAM, Reversal 3.4.2 adds a cached live-universe fallback for operational reliability, Reversal 3.4.3 protects live exits from stale last-price-only option marks, Reversal 3.4.4 tightens option entry liquidity, and Reversal 3.5 turns early-entry execution into shadow-only logging while adding DRAM to the ETF overlay.

Notebook 通过 reversal_data/ 目录下的 CSV 数据运行;Reversal 2.3 新增了动态股票池构建器,Reversal 2.3.1 新增了分批建仓的回测和股票池横向比较脚本,Reversal 2.3.2 把默认研究流程切到 qqq_only_filtered 并在 notebook 内加入了数据刷新步骤,Reversal 2.3.3 进一步加入了最小样本过滤和前 15 名输出,Reversal 2.4 把 60d 观察窗口正式提升为默认研究与官方回测设定,Reversal 2.5 加入了 minimum current drop > 0.5% 入场过滤,Reversal 2.5.1 把 spot 取价改成优先使用扩展时段价格,Reversal 2.5.2 把当前 ATM call IV 和 20d rolling sigma 接进了 live screener 输出,Reversal 2.5.3 把 live screener 的展示压缩成更清晰的单表布局,Reversal 3.1 把官方 universe 升级为 qqq_plus_leverage_etfs = qqq_only_filtered + SOXL + UPRO,Reversal 3.2 把 NYSE 节假日识别、期权流动性门槛、share fallback 和 spread <= 15% 接进了 live paper runner,Reversal 3.2.1 让盘后持仓继续更新并让 share fallback 在扩展时段继续执行止盈 / stop loss,Reversal 3.2.2 则进一步把 1D 实时净值图的纵轴做成自适应缩放,Reversal 3.3 正式取消新的 share fallback 并把 timing overlay + no-trade gate 提升为主线执行逻辑,Reversal 3.3.1 为官方股票池加入非 ETF trailing P/E 保护,Reversal 3.3.2 加入 live trend-health gate,避免买入短期下跌通道里的候选,Reversal 3.3.3 修复 manage_* slot 内重复止盈 / stop loss 扫描,Reversal 3.4 新增高置信早盘反转入场许可,Reversal 3.4.1 加入从 TEAM 案例提炼出的日内稳定修复检查,Reversal 3.4.2 加入 cached live-universe fallback 来提升运行稳定性,Reversal 3.4.3 防止 stale lastPrice-only option mark 触发 live exit,Reversal 3.4.4 进一步收紧 option entry liquidity,而 Reversal 3.5 把 early-entry 执行切换为 shadow-only 并加入 DRAM ETF overlay。

Before running the main analysis notebook, you can use update_reversal_csv.ipynb to download and refresh the input CSV files.

在运行主分析 notebook 之前,可以先使用 update_reversal_csv.ipynb 下载并更新输入用的 CSV 数据。

Workflow | 推荐流程

  1. Run update_reversal_csv.ipynb to download or refresh market data into reversal_data/.
    先运行 update_reversal_csv.ipynb,把市场数据下载或更新到 reversal_data/
  2. Run Reversal3.3.ipynb for QQQ-plus-overlay universe construction, reversal success analysis, in-notebook CSV refresh, live setup screening, call-entry planning, option confidence intervals, GBM simulation, and rolling sigma plots.
    再运行 Reversal3.3.ipynb,完成带精选 leveraged ETF overlay 的股票池构建、反转成功率分析、notebook 内 CSV 刷新、实时 setup 筛选、call 入场规划、期权置信区间、GBM 模拟和滚动波动率可视化。
  3. Run backtest_reversal_3_3_calls.py for the latest recorded official Reversal 3.3.x call backtest under qqq_plus_leverage_etfs + matched_signals >= 10 + 60d + minimum current drop > 0.5% + 5d timing overlay + no trade gate + trailing P/E < 140 for non-ETFs. 如果你想跑最近记录的 Reversal 3.3.x 主回测,再运行 backtest_reversal_3_3_calls.py;这部分使用 qqq_plus_leverage_etfs + matched_signals >= 10 + 60d + minimum current drop > 0.5% + 5d timing overlay + no trade gate + 非 ETF trailing P/E < 140
  4. Run compare_reversal_2_3_3_universes.py if you want to revisit the universe-selection stage under the original dynamic matched_signals >= 10 filter.
    如果你想回看 universe 选择阶段,再运行 compare_reversal_2_3_3_universes.py;这部分使用原始动态 matched_signals >= 10 过滤。
  5. Run backtest_reversal_article_variants.py if you want to reproduce the article-inspired factor comparison that selected the 60d window.
    如果你想复现论文启发的因子对比并验证为什么最终选择 60d 窗口,再运行 backtest_reversal_article_variants.py
  6. Run backtest_reversal_2_5_min_drop_experiment.py if you want to reproduce the minimum-drop threshold sweep that selected the 0.5% filter.
    如果你想复现 minimum-drop 阈值比较,并验证为什么最终选择 0.5% 过滤,再运行 backtest_reversal_2_5_min_drop_experiment.py
  7. Read RESEARCH_GUARDRAILS.md before promoting any new factor, threshold, or story into an official version.
    如果你想把新的因子、阈值或叙事升级成正式版本,先读 RESEARCH_GUARDRAILS.md
  8. Run reversal_3_3_live.py if you want the no-lookahead live paper-test pipeline with scheduled entry / exit scans, the promoted timing overlay, and auto-generated GitHub dashboard files.
    如果你想启用无未来函数的 live paper-test,并定时更新 GitHub dashboard,就运行 reversal_3_3_live.py

Notebook Contents | Notebook 内容

  1. Probability of Success Reversal
    Measures how often a ticker recovers after a large intraday drop using CSV data under reversal_data/.
    使用 reversal_data/ 中的 CSV 数据,统计个股在出现较大日内跌幅后,未来若干交易日内发生反弹的成功率。

  2. QQQ Plus Leveraged ETF Universe Builder
    Builds the default qqq_plus_leverage_etfs candidate pool from local QQQ constituents, filtered by minimum market cap, price, and non-ETF trailing P/E, then adds the curated SOXL + UPRO + DRAM ETF overlay. 基于本地 QQQ 成分股构建默认的 qqq_plus_leverage_etfs 候选池,并在最小市值、股价和非 ETF trailing P/E 过滤之后,加入精选的 SOXL + UPRO + DRAM ETF overlay。

  3. Live Reversal Setup Screener
    Uses today's near-real-time price to infer the current intraday drawdown for each ticker, applies an optional minimum current-drop filter, then measures how often similar or worse historical drops recovered a user-defined fraction of the signal-day drawdown within the next N trading days.
    使用当日近实时价格推断每个 ticker 当前的日内跌幅,可选地叠加 minimum current-drop 过滤,再回看过去一段观察窗口内“至少同等严重”的历史下跌日,统计未来 N 个交易日内回补 signal-day 跌幅指定比例的成功率。

  4. Option Execution Planner for Call Entries
    Pulls option chains for the chosen ticker, filters toward near-ATM calls in the 21-40 trading-day range, and translates the strategy into reference entry, take-profit, and stop loss levels.
    拉取所选 ticker 的期权链,筛选 21-40 个交易日范围内、接近 ATM 的 call,并把策略转成参考入场价、止盈价和止损价。

  5. Black Scholes Methods for Profitability Confidence Interval
    Estimates option profitability confidence with a Black-Scholes pricing framework and bootstrap simulations.
    结合 Black-Scholes 定价框架和 bootstrap 模拟,估计期权策略收益区间及其置信水平。

  6. Geometric Brownian Motion Methods for Profitability Confidence Interval
    Simulates option outcomes with GBM paths under configurable drift and volatility assumptions.
    在可调的漂移率和波动率假设下,使用几何布朗运动模拟期权收益结果。

  7. Rolling Sigma
    Plots rolling annualized volatility for selected tickers.
    绘制所选股票的滚动年化波动率曲线。

Data Layout | 数据结构

Place per-ticker CSV files in:

请将每个股票对应的 CSV 文件放在以下目录中:

reversal_data/
  SOXL.csv
  UPRO.csv
  ...

The notebook expects columns such as Date, Open, High, Low, Adj Close, and Max Drop.

Notebook 默认读取的主要字段包括 DateOpenHighLowAdj CloseMax Drop

update_reversal_csv.ipynb is designed to generate these CSV files automatically from Yahoo Finance data.

update_reversal_csv.ipynb 的用途就是从 Yahoo Finance 自动生成这些 CSV 文件。

Dependencies | 依赖环境

Install the Python packages used in the notebook:

安装 notebook 所需的 Python 包:

pip install numpy pandas matplotlib scipy yfinance notebook

Usage | 使用方法

Open the notebook from the repository root so Path.cwd() resolves correctly:

请在仓库根目录打开 notebook,这样 Path.cwd() 才会正确指向项目目录:

jupyter notebook Reversal3.3.ipynb

To refresh the CSV data first, open:

如果你想先更新 CSV 数据,可以打开:

jupyter notebook update_reversal_csv.ipynb

Update the user-config sections inside each code cell to change:

你可以在各代码单元的用户配置区修改以下参数:

  • Tickers | 股票列表
  • Drop threshold, minimum current drop, and recovery target | 下跌触发阈值、minimum current drop 与反弹目标
  • Strike, call cost, expiry date | 行权价、期权成本、到期日
  • Confidence level, risk-free rate, bootstrap count | 置信水平、无风险利率、bootstrap 次数
  • GBM path count and volatility method | GBM 路径数与波动率设定方式

For update_reversal_csv.ipynb, the main configurable inputs are:

对于 update_reversal_csv.ipynb,主要可调参数包括:

  • Tickers | 股票列表
  • Start date and end date | 数据起止日期
  • Output directory | 输出目录

Repository Files | 仓库文件

  • update_reversal_csv.ipynb | Download and prepare CSV market data before analysis. | 在分析前下载并整理 CSV 市场数据。
  • update_reversal_data.py | Refresh the default qqq_plus_leverage_etfs CSV datasets from Yahoo Finance. | 从 Yahoo Finance 刷新默认的 qqq_plus_leverage_etfs 所需 CSV 数据。
  • RESEARCH_GUARDRAILS.md | Default research discipline for avoiding curve sculpting, weak narratives, and LLM-assisted overfitting. | 默认研究守则,用于避免曲线雕刻、伪机制叙事和 LLM 放大的过拟合。
  • reversal_3_3_live.py | Reversal 3.5 live paper-test runner with scheduled entry/exit logic, state persistence, dashboard generation, optional GitHub publishing, the promoted cached qqq_plus_leverage_etfs live universe now including DRAM, the non-ETF trailing P/E guard, NYSE holiday protection, tighter option-liquidity gating, stale option quote protection, the promoted 5d timing overlay, the live trend-health down-channel gate, repeated 5-minute exit rescans inside manage_* slots, and shadow-only 10:00 AM-12:00 PM ET early-entry candidate logging. | Reversal 3.5 的 live paper-test 主脚本,包含定时入场/离场逻辑、状态持久化、dashboard 生成、可选的 GitHub 发布、默认读取已缓存且已加入 DRAMqqq_plus_leverage_etfs live universe、非 ETF trailing P/E 保护、NYSE 节假日保护、更严格的期权流动性门槛、stale option quote 保护、正式提升后的 5d timing overlay、live trend-health 下跌通道过滤、manage_* slot 内每 5 分钟重复止盈 / stop loss 扫描,以及 10:00 AM-12:00 PM ET 的 shadow-only early-entry 候选记录。
  • reversal_3_4_1_alpaca_paper.py | Separate Alpaca paper execution runner that reuses the Reversal 3.5 signal stack, submits only regular-session Alpaca paper option limit orders, shadow-logs early-entry candidates, reconciles fills, manages exits, and stores credentials only in a local ignored .secrets file. | 独立的 Alpaca paper execution runner,复用 Reversal 3.5 信号栈,只提交常规入场窗口的 Alpaca paper 期权 limit order,早盘候选仅做 shadow 记录,跟踪成交和退出,并且只从本地忽略提交的 .secrets 目录读取凭据。
  • Reversal3.3.ipynb | Current main notebook with the official qqq_plus_leverage_etfs universe, the default 60d observation window, the minimum current drop > 0.5% live-screen filter, and the current research workflow that now feeds the Reversal 3.3 timing-overlay version line. | 当前主 notebook,使用官方 qqq_plus_leverage_etfs universe、默认 60d 观察窗口、minimum current drop > 0.5% live-screen 过滤,以及已经衔接到 Reversal 3.3 timing-overlay 主线的研究流程。
  • versions/notebooks/ | Archived notebook snapshots from Reversal2.0 through Reversal3.2, kept for version-by-version review without cluttering the repo root. | 历史 notebook 快照目录,收纳从 Reversal2.0Reversal3.2 的版本,便于逐版本回看,同时避免根目录混杂。
  • versions/notebooks/README.md | Snapshot index for the archived notebook history. | 历史 notebook 快照索引。
  • backtest_reversal_2_3_calls.py | Reversal 2.3 call backtest with top-2 daily ranking, weighted sizing, and broad universe selection. | Reversal 2.3 的 call 回测脚本,包含每日前二打分、加权仓位和广义股票池。
  • backtest_reversal_2_3_1_calls.py | Reversal 2.3.1 call backtest with staggered 50% entries and up to two concurrent positions. | Reversal 2.3.1 的 call 回测脚本,采用分批 50% 建仓和最多两个同时持仓。
  • backtest_reversal_2_3_3_calls.py | Official Reversal 2.3.3 call backtest with qqq_only_filtered and the original dynamic matched_signals >= 10 trade gate. | Reversal 2.3.3 的官方 call 回测脚本,默认使用 qqq_only_filtered,并沿用最初的动态 matched_signals >= 10 交易门槛。
  • backtest_reversal_2_4_calls.py | Official Reversal 2.4 call backtest with the promoted 60d observation window. | Reversal 2.4 的官方 call 回测脚本,使用提升后的 60d 观察窗口。
  • backtest_reversal_2_5_calls.py | Official Reversal 2.5 call backtest with the promoted 60d observation window and minimum current drop > 0.5% filter. | Reversal 2.5 的官方 call 回测脚本,使用提升后的 60d 观察窗口和 minimum current drop > 0.5% 过滤。
  • backtest_reversal_3_1_calls.py | Promoted Reversal 3.1 / 3.2 baseline backtest before the timing-overlay upgrade. | Timing-overlay 升级前的 Reversal 3.1 / 3.2 主线基准回测脚本。
  • backtest_reversal_3_3_calls.py | Latest recorded Reversal 3.3.x call backtest with the curated qqq_plus_leverage_etfs overlay, the non-ETF trailing P/E guard, the promoted 60d observation window, the minimum current drop > 0.5% filter, and the promoted 5d timing overlay plus no-trade gate. | 最近记录的 Reversal 3.3.x call 回测脚本,使用精选的 qqq_plus_leverage_etfs overlay、非 ETF trailing P/E 保护、提升后的 60d 观察窗口、minimum current drop > 0.5% 过滤,以及正式提升后的 5d timing overlay 与 no-trade gate。
  • backtest_reversal_3_3_timing_overlay_experiment.py | Research experiment that compares 3d / 5d / 7d / 10d timing overlays and threshold-based no-trade rules before promotion into the official 3.3 version. | Timing-overlay 研究实验脚本,用于比较 3d / 5d / 7d / 10d timing overlay 与阈值型 no-trade 规则,并在正式提升到 3.3 前做完整对比。
  • backtest_reversal_3_3_target_exit_experiment.py | Exit-policy experiment that converts the expected stock recovery target into a Black-Scholes option target price and compares it with fixed option-level take-profit / stop loss rules. | 退出规则研究脚本,把预期股价恢复目标转换成 Black-Scholes 估算的期权目标价,并与固定 option-level 止盈 / stop loss 规则对比。
  • backtest_reversal_3_1_leveraged_etf_experiment.py | Controlled leveraged-ETF overlay comparison across TQQQ, SOXL, UPRO, and their combinations on top of the official 2.5 setup. | 受控的 leveraged ETF overlay 比较脚本,在官方 2.5 设定之上测试 TQQQSOXLUPRO 及其组合。
  • backtest_reversal_article_variants.py | Article-inspired factor comparison across volume, PCA, kappa / s-score, and rolling-window variants. | 论文启发的因子比较脚本,横向测试成交量、PCA、kappa / s-score 和不同滚动窗口。
  • backtest_reversal_2_5_min_drop_experiment.py | Minimum-drop threshold comparison that tests 0.0% through 4.0% filters on top of the 60d + qqq_only_filtered setup. | minimum-drop 阈值比较脚本,在 60d + qqq_only_filtered 设定上测试 0.0%4.0% 的过滤门槛。
  • compare_reversal_2_3_1_universes.py | Compare Reversal 2.3.1 across multiple ticker-list universes. | 比较 Reversal 2.3.1 在多个股票池下的表现。
  • compare_reversal_2_3_3_universes.py | Official five-universe comparison under Reversal 2.3.3 using the dynamic matched_signals >= 10 filter. | Reversal 2.3.3 下的官方五组 universe 对比脚本,使用动态 matched_signals >= 10 过滤。
  • reversal_universe.py | Shared universe builder used by notebook, backtest, and live paper trading, including the curated qqq_plus_leverage_etfs preset with SOXL + UPRO + DRAM and the Reversal 3.3.1 high trailing P/E exclusion list. | notebook、回测和 live paper trading 共用的 universe 构建模块,包含精选的 SOXL + UPRO + DRAMqqq_plus_leverage_etfs preset 和 Reversal 3.3.1 高 trailing P/E 排除名单。
  • qqq_plus_leverage_etfs_tickers.csv | Saved ticker list for the promoted universe overlay used by Reversal 3.x. | Reversal 3.x 主线版本使用的官方 overlay universe 保存版 ticker 列表。
  • spy_tickers.txt | Local SPY constituents source used when building the broad universe. | 构建广义股票池时使用的本地 SPY 成分股文件。
  • qqq_tickers.txt | Local QQQ constituents source used for universe comparison. | 股票池比较时使用的本地 QQQ 成分股文件。
  • README.md | Project documentation. | 项目说明文件。

Outputs | 输出结果

Depending on the cell settings, the notebook can generate:

根据不同单元格设置,notebook 可以输出:

  • Reversal success-rate comparisons | 反转成功率对比结果
  • Option profitability confidence intervals | 期权盈利置信区间
  • Rolling sigma charts | 滚动波动率图表
  • success_rate_comparison.png

About

Python-based quant trading research project for short-term reversal option setups, universe selection, staged-entry backtesting, and live paper trading.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors