Crypto Liquidation Alert Bot: Lessons From Bitcoin’s Drop to $45K

Crypto Liquidation Alert Bot: Lessons From Bitcoin’s Drop to $45K

A crypto liquidation alert bot is a small program that watches your leveraged positions and crypto loans around the clock and warns you, by Telegram, email or push, before the price reaches the level where an exchange or a lending protocol closes them for you. It reads your liquidation price, margin ratio or loan health factor from official APIs or the blockchain, compares it with thresholds you choose, and sends a clear message while you still have time to add collateral, cut size or close. This week showed why that matters: Bitcoin fell below $45,000 and billions of dollars of positions were liquidated in a day. Below is how such a bot works, what it should watch, and how to build one safely.

01What Happened to Bitcoin This Week

Bitcoin broke below $50,000 on 4 December for the first time since August 2024, after holders locked in a record of about $4 billion in realized losses on 3 December, according to Glassnode data reported by Cointelegraph and CryptoSlate. US spot Bitcoin ETFs saw $715.6 million of net outflows on 3 December. On Saturday the slide continued: Bitcoin traded below $45,000, and CoinGlass data showed about $3.6 billion of crypto liquidations over 24 hours, as reported by FXStreet and Investing.com. Much of the selling was linked to worries about AI and quantum advances against the cryptography that secures wallets.

When a leveraged long is liquidated, the exchange sells the position to protect its loan. That forced selling pushes the price lower, which triggers the next round. Traders who were asleep, travelling or simply not watching a chart found out after the fact. A liquidation alert bot does not stop a market from falling, but it gives you the warning you need to act on your own plan instead of having the exchange act for you.

02What a Crypto Liquidation Alert Bot Watches

Liquidation risk lives in a few different places, and a useful bot covers the ones you actually use. Here are the four main building blocks.

Exchange futures positions

Perpetual and futures positions on exchanges such as Binance and Bybit. Their official APIs report each position’s size, entry price, mark price and estimated liquidation price.

DeFi loans

Collateralised loans on lending protocols, where your position is closed when its health factor or loan-to-value crosses the protocol’s limit. The bot reads this straight from the chain.

Wallet and on-chain events

Large transfers out of a watched wallet, a sudden drop in collateral balance, or a change in a contract you rely on. Useful for funds and teams as well as individuals.

Delivery channels

Telegram messages, email, webhook calls into your own systems, or push notifications. A good bot uses at least two channels so one outage does not silence it.

03The Numbers That Matter

The core idea is simple: measure how far you are from liquidation, and warn early enough to do something about it. The table shows common metrics and starting alert levels. Treat every value as a starting point to test against your own leverage, collateral and reaction time, not as a recommendation.

Metric Where it comes from Starting alert levels to test
Distance to liquidation price (%) Exchange position API: mark price vs liquidation price Warning at 15%, urgent at 8%, critical at 4%
Margin ratio Exchange account or position API Warning at 50%, urgent at 70%, critical at 85%
Loan health factor Lending protocol contract on-chain (liquidation is possible below 1.0) Warning at 1.5, urgent at 1.25, critical at 1.1
Loan-to-value vs liquidation LTV Lending market parameters on-chain Warning when within 10 points, urgent within 5
Price move speed Exchange price stream Alert on a 3% move inside 15 minutes
Bot heartbeat The bot itself Alert if no check has run for 5 minutes

Two details trip people up. First, exchanges liquidate on the mark price, not the last traded price, so the bot should use the same mark price the exchange uses. Second, the liquidation price changes when you add margin, open more size or pay funding, so it must be read again on every check, never stored once.

04How to Build One: Step by Step

This is the process we follow for a monitoring tool of this kind. It works for a personal bot or for a dashboard that watches many accounts.

01

List every position source

Write down each exchange account, sub-account and wallet address with loans. Missing one account is the most common gap.

02

Create read-only API keys

For monitoring, the bot only needs permission to read positions and balances. Turn off trading and withdrawals and restrict the key to your server’s IP address.

03

Stream prices, poll positions

Use the exchange’s WebSocket feed for mark prices and poll position and loan data on a short schedule. For DeFi, read the protocol contract through a reliable RPC provider, with a second provider as backup.

04

Define alert tiers

Set warning, urgent and critical levels per account. Add a cooldown so the same alert is not repeated every few seconds, and a “recovered” message when risk falls back.

05

Send to two channels

For example Telegram plus email, or Telegram plus a webhook into your team chat. Include the account, symbol, distance to liquidation and the time of the reading in every message.

06

Test on testnet, then go live small

Run the bot against exchange testnets or a small demo position, force the thresholds to trigger, and check every message arrives. Only then point it at real accounts.

05Alert Only or Automatic Protection?

Some traders want the bot only to warn them. Others want it to act, for example by reducing position size or adding collateral when a critical level is reached. Both are possible, but they carry different risks.

Alert only

The bot reads data and sends messages. The keys cannot trade, so a bug or a stolen key cannot open, close or move anything. You stay in control of every decision. This is the safest place to start.

Alert plus action

The bot can place reduce-only orders or top up collateral by rules you set. It needs trading permission, strict limits on size, a daily action cap, a manual off switch and a full log of every action. Never give it withdrawal rights.

If you choose automatic action, write the rules down in plain words first: which account, which trigger, what exact action, how much at most, and what happens if the action fails. The same thinking applies to any trading automation, as we explain in our guide to guardrails for AI trading agents.

06Common Failure Points

A monitoring bot that fails quietly is worse than none, because you trust it. These are the problems we design against.

⚠️

API rate limits during a crash. Exchanges slow or reject requests exactly when everyone is checking positions. Use WebSocket streams, respect limits and back off on errors.

⚠️

A dead bot looks like a calm market. No alerts can mean “all is fine” or “the bot has crashed”. A heartbeat message or a dead-man check solves this.

⚠️

Wrong price source. Using last price or a different exchange’s price instead of the mark price gives a false sense of distance from liquidation.

⚠️

Over-powered keys. A monitoring key with trading or withdrawal rights is a security risk. Keep keys read-only unless the bot truly needs to act.

07Where Charts and Indicators Fit

A liquidation alert bot answers one question: how close am I to being closed out? It does not tell you where the market is heading. Many traders pair it with a momentum view on the chart so they can judge whether a move is gathering speed or tiring. Our HaP MACD indicator for MT5 marks the MACD line with entry, strong momentum, momentum warning and exit states, and it offers alerts with optional push notifications. On a symbol such as BTCUSD, a momentum warning can be a cue to review your risk, while the liquidation bot covers the hard limit.

If you already trade crypto through MetaTrader, our article on connecting Binance to MT5 explains the difference between a data feed and real execution, and our crypto grid trading bot guide shows why grids also need a risk stop in a falling market.

08What SISCo Can Build for You

Through our Blockchain & Web3 service we build on-chain automation: bots and services that watch the chain and act when an event happens, such as a transfer, a price level or a contract call, plus crypto trading tools connected to Binance, Bybit and other exchanges through their official APIs. For the delivery side, our backend and automation work covers notification pipelines with email, Telegram and webhook alerts triggered by events or thresholds, with logging and monitoring.

  • A personal liquidation alert bot for your exchange and DeFi positions.
  • A multi-account risk dashboard for a team or fund, with tiered alerts.
  • Reduce-only protection rules, built around limits you define.
  • Wallet and contract watchers for treasuries and token projects.

We build software around your rules. We do not give trading advice or signals.

Frequently Asked Questions

Can a liquidation alert bot prevent liquidation?

No. It warns you early so you can add margin, reduce size or close the position yourself. In a very fast market, price can still reach your liquidation level before you act, which is why lower leverage remains the main protection.

Does the bot need my exchange password or withdrawal rights?

No. A monitoring bot only needs a read-only API key, restricted to your server’s IP address. Your password is never needed, and withdrawal permission should always stay off.

Can it watch DeFi loans as well as exchange positions?

Yes. DeFi loan data such as collateral, debt and health factor can be read directly from the lending protocol’s contracts on-chain, and checked alongside exchange positions in one bot.

Which alert channel is best?

Telegram is fast and works on any phone, so it is the most common choice. We recommend a second channel, such as email or a webhook, so a single outage does not hide an urgent warning.

Want Your Own Crypto Liquidation Alert Bot?

Tell us which exchanges, wallets and lending protocols you use, and how you want to be warned. We will review your rules and come back with a free quote and a realistic timeline. You receive the finished software, and we fix any bugs that appear later free of charge. Prefer to start with a chart tool? HaP MACD is available on the MQL5 Market.

Get a free quote Get HaP MACD on MQL5

Last reviewed: 5 December 2026. Trading involves risk, including the loss of all capital; leveraged and crypto products are especially risky. This article is educational and is not financial advice. Always test on a demo or testnet account first.

· · · ·

Related articles

Need a team that can design, build and maintain it all?

Let's talk. Tell us about your project and we'll reply with honest timelines.