|
๐งช ย Want to inspect the full research path, including weak factors and failed strategy ideas? |
Data โ hypothesis โ signal โ backtest โ validation โ documented finding
๐ฃ Snapshot ยท ๐งช Tracks ยท ๐ Results ยท โก Install ยท ๐ Reproduce ยท ๐ Methodology ยท ๐ Data ยท ๐ Structure ยท ๐ Limitations
English ยท ็ฎไฝไธญๆ ยท Espaรฑol ยท Deutsch ยท ๆฅๆฌ่ช ยท ะ ัััะบะธะน ยท Portuguรชs ยท ํ๊ตญ์ด
| Item | Current repository state |
|---|---|
| Format | Six primary Jupyter notebooks with saved outputs |
| Research tracks | A-share factors, BTC/USDT timing, and XGBoost signals |
| A-share snapshot | 2023-01-03 through 2026-03-27 |
| Crypto snapshot | Daily and hourly data through 2026-03-28 |
| Execution | Backtests and exploratory analysis only |
| Production layer | No live-trading module, CLI, package, test suite, or CI workflow |
This repository records how conclusions changed as more filters, costs, frequencies, and models were tested. Negative results remain part of the research history.
| Track | Core question | Main artifacts |
|---|---|---|
| ๐จ๐ณ A-share factors | Do momentum, reversal, turnover, and ROE explain cross-sectional returns? | IC tests, composite factor, risk-control backtest, return attribution |
| โฟ BTC timing | Can trend, sentiment, funding, and stop rules improve a BTC/USDT timing strategy? | Parameter search, walk-forward checks, cost estimate, failed extensions |
| ๐ค Machine learning | Can XGBoost classify future return targets or volatility regimes? | Daily and hourly classification, risk filter, fee-drag experiment |
flowchart LR
A([Data snapshots])
A --> B[A-share factors] --> E[IC tests] --> F[Attribution] --> L([Recorded findings])
A --> C[BTC timing] --> G[Parameter search] --> H[Walk-forward] --> I[Cost check] --> L
A --> D[XGBoost signals] --> J[Direction models] --> K[Volatility models] --> L
style A fill:#FEF3C7,stroke:#F59E0B,stroke-width:2px,color:#000,font-size:12px
style B fill:#DBEAFE,stroke:#3B82F6,stroke-width:2px,color:#000,font-size:12px
style C fill:#DBEAFE,stroke:#3B82F6,stroke-width:2px,color:#000,font-size:12px
style D fill:#DBEAFE,stroke:#3B82F6,stroke-width:2px,color:#000,font-size:12px
style E fill:#F1F5F9,stroke:#64748B,stroke-width:1px,color:#000,font-size:12px
style F fill:#F1F5F9,stroke:#64748B,stroke-width:1px,color:#000,font-size:12px
style G fill:#EDE9FE,stroke:#8B5CF6,stroke-width:1px,color:#000,font-size:12px
style H fill:#EDE9FE,stroke:#8B5CF6,stroke-width:1px,color:#000,font-size:12px
style I fill:#FEF2F2,stroke:#EF4444,stroke-width:1px,color:#000,font-size:12px
style J fill:#F1F5F9,stroke:#64748B,stroke-width:1px,color:#000,font-size:12px
style K fill:#F1F5F9,stroke:#64748B,stroke-width:1px,color:#000,font-size:12px
style L fill:#DCFCE7,stroke:#22C55E,stroke-width:2px,color:#000,font-size:12px
These numbers are saved notebook outputs from the repository snapshot. They describe historical experiments under the assumptions listed below.
The documented reference full-sample variant combines MACD(16,35,9), a Fear & Greed filter below 80, and a simulated 3% daily stop rule. The notebook also records +1335.98% and +612.25% from tighter 1% and 2% clipping thresholds, which makes stop selection highly sensitive to this simplified model.
| Metric | Recorded value | Interpretation |
|---|---|---|
| Sample | 2023-01-01 โ 2026-03-28 | BTC/USDT daily snapshot |
| Gross cumulative return | +423.22% |
Before the final transaction-cost estimate |
| Estimated after-cost return | +383.97% |
Uses 0.1% per signal change |
| Buy-and-hold return | +301.59% |
Same daily backtest window |
| Estimated after-cost max drawdown | -16.25% |
Final cost-estimate cell with the clipped daily stop model |
| Reported Sharpe | 1.7001 |
Computed from signal returns before stop and fee adjustments |
| Average signal changes | About 21 per year |
The notebook estimates roughly 2.13% annual fee drag |
The reported Sharpe and after-cost return use different return series. An after-cost Sharpe still needs a clean recomputation.
| Check | Recorded result | Reading |
|---|---|---|
| Final BTC workflow, average validation Sharpe | 0.6224 |
Lower than the full-sample result; parameter stability is limited |
| Earlier MACD-only walk-forward, average validation Sharpe | 0.4348 |
Positive average with meaningful fold variation |
| Experiment | Recorded result | Status |
|---|---|---|
| BTC MACD + sentiment + 3% stop | Reference full-sample daily result | Research reference only; stop-threshold sensitivity is high |
| A-share timing-only attribution | +65.28%, Sharpe 1.1479 |
Stronger than the stock-selection leg |
| A-share three-factor selection | +8.56%, Sharpe 0.2423 |
Weak |
| BTC multi-timeframe confluence | +199.01%, Sharpe 1.4897 |
Lower than the simpler full-position strategy |
| BTC long-short variants | Sharpe 0.9833 to 1.1150 |
Lower than long-only timing |
| Daily return-target XGBoost | Accuracy near 51% |
Near random |
| Hourly volatility classifier | Accuracy near 67% |
Exploratory; label construction leaks full-sample information |
| Hourly MACD + ML after costs | +48.42%, Sharpe 1.1212 |
Fee drag materially reduces the pre-fee result |
| Factor | IC mean | ICIR | Reading |
|---|---|---|---|
| 20-day momentum | -0.0023 |
-0.0112 |
No useful signal in this sample |
| 5-day reversal | 0.0062 |
0.0323 |
No useful signal in this sample |
| Turnover | 0.0290 |
0.1089 |
Weak |
| Three-factor composite | 0.0328 |
0.2237 |
Weak |
| ROE | โ | 0.0097 |
Weak and data-limited |
| Strategy leg | Cumulative return | Sharpe | Max drawdown |
|---|---|---|---|
| Three-factor selection | +8.56% |
0.2423 |
-22.73% |
| Timing and risk control | +65.28% |
1.1479 |
-11.97% |
| Selection + risk control at 20% position | +16.75% |
0.4341 |
-15.06% |
The attribution points toward timing as the main source of historical performance in this experiment. The constituent construction uses the current CSI 300 list, so the A-share study may contain survivorship bias.
| Stage | Cumulative return | Sharpe | Max drawdown |
|---|---|---|---|
Default MACD 12,26,9 |
+135.44% |
0.9987 |
-32.10% |
Optimized MACD 16,35,9 |
+338.95% |
1.6079 |
-21.65% |
| MACD + Fear & Greed + 3% stop | +423.22% gross |
1.7001 pre-cost series |
-15.66% simulated |
| Final cost estimate | +383.97% net |
Pending recomputation | -16.25% |
Additional experiments cover funding-rate filters, on-chain active addresses, volume, multi-timeframe confirmation, short selling, and dynamic position sizing. The notebook keeps these branches even when they reduce performance.
| Target | Frequency | Samples | Accuracy | Reading |
|---|---|---|---|---|
| 5-day return above 1% | Daily | 1,123 |
51% |
Near random |
| Positive 10-day return | Daily | 1,123 |
45% |
Below random |
| 24-hour price direction | Hourly | 28,217 |
47% |
Near random |
| 24-hour volatility level | Hourly | 28,217 |
67% |
Exploratory; threshold uses the full sample |
The volatility classifier was also tested as a risk filter. Its stronger classification score did not remove the fee problem from the higher-frequency strategy.
The saved notebooks were last executed with Python 3.13.5 kernels.
git clone https://github.com/okht/quant-research.git
cd quant-research
python -m venv .venv
source .venv/bin/activate
python -m pip install jupyterlab pandas numpy matplotlib akshare ccxt requests xgboost scikit-learn
jupyter labOn Windows PowerShell, activate the environment with:
.\.venv\Scripts\Activate.ps1The repository has no lockfile or automated environment check. Package behavior may differ across versions.
Suggested reading and execution order:
| Order | Notebook | Purpose |
|---|---|---|
| 1 | 01_data/01_data_cleaning.ipynb |
A-share acquisition, cleaning, and first factor checks |
| 2 | 02_factors/02_factor_ictest.ipynb |
Momentum, reversal, turnover, and composite IC tests |
| 3 | 03_backtest/03_backtest.ipynb |
A-share backtest, risk control, position sizing, and attribution |
| 4 | 03_backtest/03_roe_factor.ipynb |
ROE data experiment |
| 5 | 04_crypto/01_crypto_data.ipynb |
Crypto data, timing strategies, validation, and cost checks |
| 6 | 02_factors/04_ml_factor.ipynb |
XGBoost experiments using the crypto data snapshots |
Some cells load committed CSV snapshots; others call public market-data endpoints. Refreshing the Binance funding-rate section currently assumes a local proxy at 127.0.0.1:7897. Remove or adapt that proxy configuration before rerunning it elsewhere.
The notebooks contain sequential exploratory cells. Restart the kernel and run carefully, checking which variables and data ranges each later cell inherits.
| Topic | Current implementation |
|---|---|
| Signal timing | Strategy signals are generally shifted by one period before return application |
| BTC transaction cost | Final estimate subtracts 0.1% when the signal changes |
| Slippage and spread | Omitted |
| Stop loss | Simulated by clipping a daily strategy return at the chosen threshold |
| Parameter search | Multiple MACD grids are tested; full-sample and walk-forward results are both retained |
| A-share universe | Built from a current CSI 300 constituent pull, with possible survivorship bias |
| ML volatility label | Uses a full-sample median threshold, which leaks test-period information |
| Reproducibility | Data snapshots and outputs are committed; dependency versions are not pinned |
These assumptions materially affect the results. A production-quality evaluation would need point-in-time universes, clean train/validation/test boundaries, slippage, execution constraints, after-cost risk metrics, and independent reruns.
| File | Rows | Coverage or role |
|---|---|---|
03_backtest/close_data.csv |
781 ร 296 assets |
A-share close-price panel |
03_backtest/volume_data.csv |
781 ร 296 assets |
A-share turnover panel |
03_backtest/roe_data.csv |
781 ร 46 assets |
Partial ROE panel |
04_crypto/btc_daily.csv |
1,183 |
BTC/USDT daily, 2023-01-01 โ 2026-03-28 |
04_crypto/btc_1h.csv |
28,385 |
BTC/USDT hourly, 2023-01-01 โ 2026-03-28 |
04_crypto/btc_funding_full.csv |
7,174 |
BTC perpetual funding rate |
04_crypto/btc_fng.csv |
2,000 |
Fear & Greed Index |
04_crypto/btc_active_addr.csv |
2,000 |
On-chain active-address snapshot |
04_crypto/crypto_close.csv |
1,183 ร 10 assets |
Multi-crypto close-price panel |
Committed market data can have licensing, redistribution, revision, and timestamp considerations. Check the source terms before reusing it elsewhere.
quant-research/
โโโ README.md
โโโ README_CN.md
โโโ 01_data/
โ โโโ 01_data_cleaning.ipynb
โโโ 02_factors/
โ โโโ 02_factor_ictest.ipynb
โ โโโ 04_ml_factor.ipynb
โโโ 03_backtest/
โ โโโ 03_backtest.ipynb
โ โโโ 03_roe_factor.ipynb
โ โโโ close_data.csv
โ โโโ volume_data.csv
โ โโโ roe_data.csv
โโโ 04_crypto/
โโโ 01_crypto_data.ipynb
โโโ btc_daily.csv
โโโ btc_1h.csv
โโโ btc_funding_full.csv
โโโ btc_fng.csv
โโโ btc_active_addr.csv
โโโ crypto_close.csv
There is currently no 02_live_trading.ipynb or live execution module in the repository.
- This repository is a research archive built from historical data and exploratory notebooks.
- Full-sample results include model and parameter-selection risk.
- The final after-cost BTC return and the reported Sharpe come from different return series.
- The daily stop model omits intraday path, gaps, order-book depth, spread, and slippage.
- Tight daily-return clipping can mechanically inflate simulated returns and does not represent executable stop-loss behavior.
- The A-share universe may contain survivorship bias.
- The ML volatility label uses information from the full dataset.
- Saved outputs may differ when data providers revise history or dependencies change.
- No broker integration, order management, risk service, monitoring, or live-trading safeguards are included.
For research and education only. No investment advice or production trading system is provided.
A research result is useful when its assumptions and failures remain inspectable.
Maintained by okht