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:

  1. Login to Hugging Face:
    huggingface-cli login
    
  2. 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

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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support