YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Intraday BTC Leverage Trading System
A Python-based research and backtesting system for leveraged intraday Bitcoin trading with automated profit siphoning and multi-layer capital protection.
π Strategy Menu: Choose Your Style
We verified three distinct strategies catering to different trading styles. Choose the one that fits your goal:
| Strategy Style | Timeframe | Return | Trades/Day | Drawdown | Best For... |
|---|---|---|---|---|---|
| π₯ Balanced Growth | 1-Hour | +86.88% | 0.6 | -23% | Best Overall. High return with low risk. |
| π Long-Term Wealth | Daily | +1,041% | 0.01 | -50% | Investors. Set and forget for years. |
| β‘ Active Trading | 15-Min | +23.88% | 1.7 | -40% | Traders. Frequent action, higher risk. |
Note: Returns verified on historical data (2023-2025 for intraday, 2014-2025 for daily).
π― Key Features
- Dual-Account System: Maintains separate trading equity (E_t) and vault (V_t) for profit protection
- Automated Profit Siphon: Automatically transfers profits to vault after each winning trade
- Multi-Layer Risk Management:
- Per-trade risk limits
- Stop-loss and take-profit automation
- Daily drawdown protection (halts trading if daily loss exceeds threshold)
- Leveraged Trading: Configurable leverage (1x-5x)
- Technical Analysis: Moving average crossover with volatility filtering
- Comprehensive Metrics: Sharpe ratio, max drawdown, win rate, profit factor, and more
- Visualization: Equity curves, drawdown charts, trade analysis
π Project Structure
intraday_btc_model/
β
βββ data/
β βββ btc_1h_binance.csv # 1-Hour Verified Data
β βββ btc_15min_binance.csv # 15-Min Verified Data
β βββ btc_daily_2014_2025.csv # 11-Year Historical Data
β
βββ core/
β βββ data_loader.py # CSV loading and validation
β βββ features.py # Technical indicator calculation
β βββ signal_model.py # Signal generation
β βββ position_sizing.py # Position sizing with leverage
β βββ risk_management.py # Risk controls and profit siphon
β βββ backtester.py # Main backtesting engine
β
βββ reports/ # Generated results
β
βββ config.py # Configuration parameters
βββ run_backtest.py # Main entry point
βββ verify_best_strategy.py # Run the 1-Hour Strategy Verification
βββ verify_15m_strategy.py # Run the 15-Min Active Strategy Verification
βββ verify_long_term.py # Run the 11-Year Daily Strategy Verification
βββ README.md # This file
π Quick Start
1. Install Dependencies
pip install -r requirements.txt
2. Run the Balanced Strategy (Recommended)
To see the performance of the 1-Hour optimal strategy:
python intraday_btc_model/verify_best_strategy.py
3. Run the Active Strategy
To see the performance of the 15-Minute active trading strategy:
python intraday_btc_model/verify_15m_strategy.py
4. Explore Long-Term Potential
To see how an aggressive daily strategy performs over 11 years:
python intraday_btc_model/verify_long_term.py
5. Upload to Hugging Face
To push this model and data to your Hugging Face account:
- Login to Hugging Face:
huggingface-cli login - Run the push script:
python push_to_hub.py
π Understanding Results
Equity Curve (reports/equity_curve.csv)
Contains time series of:
e_trading: Trading equity (active capital)v_vault: Vault equity (protected profits)total: Total equity (E_t + V_t)
Trades (reports/trades.csv)
Individual trade records with:
- Entry/exit times and prices
- Position direction and size
- Gross PnL, fees, net PnL
- Exit reason (stop, target, etc.)
π§ How It Works
1. Signal Generation
Current strategy (v1): Moving Average Crossover
- Long signal: Fast MA > Slow MA + moderate volatility
- Short signal: Fast MA < Slow MA + moderate volatility
- No signal: High volatility (avoid choppy markets)
2. Profit Siphon
After closing a winning trade:
- If
E_t > E_base:- Transfer excess to vault:
V_t += (E_t - E_base) - Reset trading equity:
E_t = E_base
- Transfer excess to vault:
This protects profits from being risked in future trades.
3. Daily Drawdown Protection
At the start of each day, record E_day_start.
During the day:
- If
E_t β€ E_day_start Γ (1 - D_max):- Close any open position
- Halt trading for the rest of the day
This prevents catastrophic single-day losses.
π License
This project is for educational and research purposes. Use at your own risk.
Disclaimer: Trading cryptocurrencies involves substantial risk of loss. This software is provided "as is" without warranty of any kind. The authors are not responsible for any losses incurred through the use of this software.