Initial commit: Trading skills collection

- OKX交易自动化 (okx-auto-position, okx-crypto, okx-exchange)
- 交易信号处理 (signal-confirmation-templates, trading-signal-aggregator)
- 量化因子挖掘 (quant-factor-mining)
- 长桥集成 (longbridge-cli, longbridge-python-sdk)
- 六合彩分析 (lottery-hk)
- 股息投资 (dividend-investing, dividend-scanner)
- 日内交易 (intraday-trading)
- 同花顺 (tonghuashun)
This commit is contained in:
2026-07-05 02:39:41 -04:00
commit 657dc41c46
83 changed files with 12531 additions and 0 deletions
@@ -0,0 +1,49 @@
# 股息率套利分析 — Dividend Yield Arbitrage
## 核心逻辑
```
净息差 = 股息率(税前) - 融资成本
年套利收入 = 本金 × 净息差
```
## 美的集团套利示例(2026年6月)
| 项目 | 数值 |
|------|:----:|
| 2025全年分红 | 4.30元/股(43元/10股) |
| 当前价(除权后) | 77.27元 |
| 股息率 | 5.56% |
| 银行分期成本 | ~3% |
| **净息差** | **~2.56%** |
| 每100万套利收入 | **~2.56万/年** |
## 股息率随买入价变化(基于2025年分红4.30元/股)
| 买入价 | 股息率 | 净息差(3%成本) |
|:-----:|:------:|:--------------:|
| 82 | 5.24% | 2.24% |
| 80 | 5.38% | 2.38% |
| 77.27(现价) | 5.56% | 2.56% |
| 75 | 5.73% | 2.73% |
| 73 | 5.89% | 2.89% |
| 70 | 6.14% | 3.14% |
## 股息增长对实际收益的影响
假设买入价77.27,分红按过去5年CAGR 22%增长:
| 年份 | 预测分红 | 对买入价的股息率 | 累计收益 |
|:----:|:--------:|:---------------:|:--------:|
| 2025(基准) | 4.30 | 5.56% | — |
| 2026E | 4.50 (+5%保守) | 5.82% | 5.82% |
| 2027E | 4.70 | 6.08% | 11.90% |
| 2028E | 4.90 | 6.34% | 18.24% |
## 风险提示
1. **分红不保证** — 公司可能削减或取消分红
2. **股价波动** — 除权后贴权会导致账面亏损
3. **税率** — A股持仓<1月扣20%红利税,>1年免税
4. **汇率风险** — 港股(港元)和美股(美元)有汇率波动
5. **融资续贷风险** — 银行分期续贷不保证
@@ -0,0 +1,98 @@
# 填权 (Gap Fill) Timing Reference
## What is 填权?
After ex-dividend, the stock price drops by approximately the dividend amount. "填权" means the stock price recovers back to (or above) the pre-ex-dividend level over time.
**填权 ≠ immediate.** The market doesn't give away free money — the ex-div price drop is a mechanical adjustment. Whether and how fast the gap fills depends on ongoing supply/demand for the stock.
## Historical Fill Speeds for A-share Dividend Stocks
### 华特达因 (000915) — High-dividend healthcare stock
| Year | Ex-div | Dividend | Pre-close | Ex-close | Fill Time | Notes |
|------|--------|----------|-----------|----------|-----------|-------|
| 2025 | Jun 11 | 2.00元 | 32.39 | 29.49 | **~10 days** (31.15, +5.6%) | Fast fill; stock was in uptrend |
| 2024 | May 16 | 2.00元 | 35.30 | 33.48 | **Did not fill in 60 days** (30→27) | Bear market dragged it down |
**Key insight:** 2025 filled fast because the stock was in a healthy trend. 2024 didn't fill because the overall market was falling. Stock quality matters but macro conditions dominate.
### 同仁堂 (600085) — Blue-chip TCM
(Add data here when available from analysis.)
## Factors That Determine Fill Speed
### 1. Stock Price Position (Most Important)
```
Stock at 52-week low: High fill probability (already "cheap")
Stock at 52-week high: Low fill probability (due for pullback)
Example: 华特达因 2025 → ex-div at 32 → near YTD high → fast fill anyway (good stock)
华特达因 2024 → ex-div at 35 → at YTD high → no fill (bad timing + bad market)
```
### 2. Market Direction
- **Bull market / 结构性牛市**: Most quality stocks fill within 1-3 weeks
- **Bear market / 熊市**: Can take months or never — the dividend is "eaten" by the falling price
- **Sideways market**: Depends on stock-specific catalysts
### 3. Dividend Size Relative to Price
| Dividend/Price ratio | Impact |
|---------------------|--------|
| < 2% | Small gap, easy to fill (days) |
| 2-5% | Moderate, 1-3 weeks typical |
| > 5% | Large gap, may take months; better to wait for natural dip before buying |
### 4. Company Fundamentals
- **Growing dividends** (e.g., 华特达因 2021: 0.35 → 2025: 2.50/share) → faster fill (market rewards increasing payouts)
- **Stable/declining dividends** → slower fill
- **High payout ratio** (>80%) → risk of cut → may never fill
- **Cash-rich** (>30% market cap in cash) → faster fill (dividend is safe)
## Practical Rules for Dividend Capture
```
If you MUST try dividend capture (buy pre-ex-div, sell post):
1. Only attempt on stocks near their 52-week LOW
→ The ex-div gap is less damaging when already near support
2. Only attempt when market is in uptrend
→ Check: is the SH/SZ index above its 50-day MA?
3. Plan to hold MINIMUM 2-4 weeks post-ex-div
→ Selling the next day guarantees a loss (tax + gap)
4. Calculate your break-even price:
BreakEven = ExDivPrice + (Tax_Rate × Dividend)
Example: 28元 stock, 2元 dividend, 20% tax:
BreakEven = 26.00 + 0.40 = 26.40
→ Stock must rally 1.5% from ex-div just to break even
5. Consider buying AFTER ex-div instead:
- No dividend → no tax → no gap risk
- Lower entry price → higher yield on cost
- Same future dividends
→ Often the better move for pure yield investors
```
## Data Source
To calculate 填权 timing for any stock:
```python
import akshare as ak
# Use unadjusted prices (adjust='') to see the real ex-div gap
df = ak.stock_zh_a_hist(symbol='000915', period='daily',
start_date='20250601', end_date='20251001', adjust='')
# Find ex-div day by looking for the big drop on the expected date
# Then scan forward to see how many days to recover
```