Builders 路 5 min read

How to make CoinGlass ring your phone

To make CoinGlass ring your phone, make an 馃敭 Anything alarm in LFG Alarm, then run a short script on a schedule that reads the CoinGlass API and calls the alarm's private link when a number crosses your line. When BTC longs get flushed, funding spikes or a Hyperliquid whale opens a big position, every phone on the alarm rings like an alarm clock. LFG is your daily alarm and curiosity agent for iPhone and Android, plus lfg.gm in a desktop browser.

Also called: CoinGlass alert to phone 路 liquidation alert 路 CoinGlass API alarm 路 funding rate alert 路 Hyperliquid whale alert

Download on the App StoreGet it on Google Play

CoinGlass's own alerts, under Alerts on coinglass.com, watch a pair's price or open interest and market-wide volatility, and reach you in the browser, by email or in the CoinGlass app. They can't call a link, so to ring a phone, a script does the checking. The one below runs free on GitHub Actions.

What you can ring on

Ring when CoinGlass endpoint Lowest API plan
BTC longs liquidated in 4 hours pass $100M Coin Liquidation History Hobbyist
Shorts get squeezed on a coin you trade Coin Liquidation History, short side Hobbyist
Funding on a coin goes above 0.1% Coin Funding Rate by Exchange Hobbyist
A Hyperliquid whale opens or closes over $1M Hyperliquid Whale Alerts Startup
A single liquidation over $1M hits Liquidation Orders Standard

The plans and what each one can call are on CoinGlass's plans page. Hobbyist reads in steps of 4 hours or more; higher plans read down to 30 minutes or 1 minute.

Before you start

  • Get the LFG Alarm app on your phone from Google Play or the App Store, and sign in. The script notices the move; your phone does the ringing.
  • An Anything alarm. Every LFG account gets one free, and paid plans have room for more; see lfg.gm.
  • A CoinGlass API key, from your CoinGlass account, on a plan that covers the endpoint you want.
  • A GitHub account, to run the script on a schedule. Any computer or server that runs cron works too.

Make the alarm

  1. In LFG Alarm, on Alarms, tap 馃敭 Anything.
  2. Name it for what it means, for example "BTC longs flushed". The ring screen shows the alarm's name and nothing else, so pick a name that says what happened.
  3. Pick a Cooldown: how long it stays quiet after it rings, from 1 minute to 1 hour.
  4. Share it with whoever should hear it, and tap Arm it.
  5. On the link card, tap Copy. It starts with https://api.lfg.gm/horn/. Keep it private: anyone with it can ring the alarm.

Write the check

This script reads the last 4 hours of BTC liquidations across Binance, OKX and Bybit, and rings the alarm when longs passed $100M. It looks at the 4 hours that just ended, so each stretch of time rings at most once.

# check_liquidations.py
import json, os, urllib.request

LIMIT_USD = 100_000_000  # ring when longs liquidated in 4 hours pass this

url = ("https://open-api-v4.coinglass.com/api/futures/liquidation/aggregated-history"
       "?symbol=BTC&exchange_list=Binance,OKX,Bybit&interval=4h&limit=2")
req = urllib.request.Request(url, headers={"CG-API-KEY": os.environ["COINGLASS_API_KEY"]})
rows = json.load(urllib.request.urlopen(req))["data"]

just_ended = sorted(rows, key=lambda r: r["time"])[0]
if just_ended["aggregated_long_liquidation_usd"] > LIMIT_USD:
    urllib.request.urlopen(urllib.request.Request(os.environ["LFG_RING_URL"], data=b"", method="POST"))

To watch shorts instead, read aggregated_short_liquidation_usd. To watch ETH or SOL, change symbol.

Run it every 4 hours

  1. In a GitHub repository, open Settings, then Secrets and variables, then Actions, and add two secrets: COINGLASS_API_KEY with your key, and LFG_RING_URL with the alarm's link.
  2. Add check_liquidations.py to the repository.
  3. Add this file as .github/workflows/liquidations.yml:
name: BTC longs flushed
on:
  schedule:
    - cron: "5 */4 * * *"
  workflow_dispatch:
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: python check_liquidations.py
        env:
          COINGLASS_API_KEY: ${{ secrets.COINGLASS_API_KEY }}
          LFG_RING_URL: ${{ secrets.LFG_RING_URL }}

It runs five minutes after each 4-hour stretch ends. To try it now, open the Actions tab, pick the workflow and click Run workflow. To hear the ring without waiting for a big day, set LIMIT_USD to 0 for one run, then put it back.

Let your AI set it up

try this

Have your AI agent make it.

Paste this into ChatGPT, Claude, Grok or any AI agent that can add a connector, not into the LFG Alarm app. The setup steps come with it: get the LFG Alarm app, connect it to your agent once, and your agent makes the alarm in your account.

Use LFG Alarm to make an Anything alarm called "BTC longs flushed" with 60 minutes of quiet time and give me its link. Then write me a Python script and a GitHub Actions workflow that check CoinGlass's Coin Liquidation History every 4 hours and call that link when BTC long liquidations in the last 4 hours pass $100M.

Already have the LFG Alarm app and connected it to your AI agent?

Why it works. One request makes the alarm and writes the check. Connect LFG Alarm to your AI app first: see [AI agents](/agents). CoinGlass also has an MCP server, so your AI can look up the right endpoint while it writes the script.

Good to know

  • Your CoinGlass key stays with you. The script keeps it in your GitHub secrets. LFG never sees it.
  • GitHub's schedule can run late. Scheduled workflows can start several minutes after their time when GitHub is busy.
  • Nothing from CoinGlass reaches the ring screen. The alarm's name is what people see, so name it for the moment.

If it does not work

  • The run fails with an error from CoinGlass. Check the key, and check your plan covers the endpoint and the interval. Hobbyist can't read 1h.
  • The run passes but nothing rings. The number did not cross your line. Set LIMIT_USD to 0 for one run to check the ring itself.
  • It rang but nobody's phone did. The ring may have fallen inside the alarm's cooldown, or the people on it have not joined yet.
  • Still stuck? Write to us from the support page.

Learn more

Sources and further reading

LFG Alarm is not affiliated with CoinGlass.

questions people ask
Does LFG Alarm see my CoinGlass data?

No. The ring link never reads what is sent to it. LFG only learns that the link was called.

Can I skip the script?

If you use a Mind from Minds, give it your CoinGlass key and it does the checking: see Make a Mind ring your phone.

Can one check ring a whole trading desk?

Yes. Everyone who joined the alarm hears it.

keep exploring

One use case opens another.

Never miss the moment.

Free on Android and iPhone.

Download on the App StoreGet it on Google Play