Thanks to visit codestin.com
Credit goes to github.com

Skip to content

vsching/liquidation-heatmap

Repository files navigation

πŸ”₯ Cryptocurrency Liquidation Heatmap

Streamlit Python MIT License

A professional cryptocurrency liquidation heatmap visualization tool similar to Coinglass, built with Python, CCXT, and Streamlit.

Liquidation Heatmap Preview

πŸš€ Features

  • πŸ“Š Real-time Data: Live order book and price data from major exchanges
  • πŸ“ˆ Interactive Heatmap: Plotly-based visualizations with hover details
  • βš–οΈ Leverage Analysis: Support for 5x, 10x, 25x, 50x, 100x, 125x leverage
  • πŸ”„ Multi-Exchange: Binance, OKX, Bybit support via CCXT
  • πŸ’° Multiple Pairs: BTC/USDT, ETH/USDT, SOL/USDT, and more
  • 🌐 Web Interface: Professional Streamlit dashboard
  • πŸ“± Mobile Responsive: Works on desktop and mobile

🎯 What It Shows

The liquidation heatmap visualizes potential liquidation levels based on:

  1. Current order book depth from live exchanges
  2. Leverage calculations for different position sizes
  3. Volume concentration at critical price levels
  4. Support/Resistance zones where liquidations cluster

Red zones = Long liquidations (price goes down)
Green zones = Short liquidations (price goes up)
Hot spots = High liquidation density

πŸ› οΈ Installation

Option 1: Quick Start (Streamlit Cloud)

  1. Fork this repository
  2. Go to share.streamlit.io
  3. Deploy your forked repo
  4. Done! ✨

Option 2: Local Development

# Clone the repository
git clone https://github.com/yourusername/liquidation-heatmap.git
cd liquidation-heatmap

# Install dependencies
pip install -r requirements.txt

# Run Streamlit app
streamlit run streamlit_app.py

# Or run CLI version
python src/main.py --symbol BTC/USDT

πŸ–₯️ Usage

Web Interface (Recommended)

streamlit run streamlit_app.py

Then open http://localhost:8501 in your browser.

Command Line Interface

# Basic usage
python src/main.py

# Custom symbol and exchange
python src/main.py --symbol ETH/USDT --exchange binance

# Generate static charts
python src/main.py --output static --save-path ./charts/heatmap

# Both interactive and static
python src/main.py --output both --save-path ./output/analysis

πŸ“Š Example Output

Live BTC/USDT Analysis

Current BTC price: $107,836.90
Heatmap data points: 100

Long liquidation levels:
  5x: $86,269.52 (20.00% down)
  10x: $97,053.21 (10.00% down)
  25x: $103,523.42 (4.00% down)

Short liquidation levels:
  5x: $129,404.28 (20.00% up)
  10x: $118,620.59 (10.00% up)
  25x: $112,150.38 (4.00% up)

πŸ—οΈ Architecture

liquidation_heatmap/
β”œβ”€β”€ streamlit_app.py          # Web interface (main entry point)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py              # CLI interface
β”‚   β”œβ”€β”€ data_fetcher.py      # CCXT data fetching
β”‚   └── visualizer.py        # Plotly/matplotlib charts
β”œβ”€β”€ data/                    # Cached data
β”œβ”€β”€ output/                  # Generated charts
└── requirements.txt         # Dependencies

πŸ”§ Configuration

Supported Exchanges

  • Binance (default)
  • OKX
  • Bybit

Supported Trading Pairs

  • BTC/USDT, ETH/USDT, BNB/USDT
  • SOL/USDT, ADA/USDT, DOT/USDT
  • Any pair supported by the exchange

Leverage Levels

  • 5x, 10x, 25x, 50x, 100x, 125x (customizable)

πŸš€ Deployment Options

1. Digital Ocean (Recommended) ⭐

Deploy to DO

One-command deployment:

curl -fsSL https://raw.githubusercontent.com/vsching/liquidation-heatmap/main/deploy-digitalocean.sh | bash
  • βœ… Real API access - No restrictions
  • βœ… $4-6/month - Very affordable
  • βœ… Custom domain - Professional setup
  • βœ… Full control - Your own server

2. Docker (Any Server)

# Clone and run with Docker
git clone https://github.com/vsching/liquidation-heatmap.git
cd liquidation-heatmap
docker-compose up -d

3. Render (Free + Private Repos)

Deploy to Render

4. Streamlit Cloud (Free, Public Repos Only)

Deploy to Streamlit

5. Railway / Heroku

railway up
# or
git push heroku main

πŸ“ˆ Liquidation Formula

Long Liquidation Price = Entry Price Γ— (1 - 1/Leverage)
Short Liquidation Price = Entry Price Γ— (1 + 1/Leverage)

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

This tool is for educational and research purposes only. Not financial advice. Always do your own research before making trading decisions.

πŸ™ Acknowledgments

  • CCXT - Cryptocurrency trading API
  • Streamlit - Web framework
  • Plotly - Interactive visualizations
  • Coinglass - Inspiration for the heatmap design

⭐ Star this repo if you found it helpful!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published