For crypto traders who want an edge, monitoring the wallets of large holders — commonly called whales — can reveal early positioning before major price moves. Building a crypto trading bot with on-chain whale signals in Python allows you to automate the capture and reaction to these high‑value data points. This tutorial walks through a practical implementation using the Smart Money API, a specialized source of aggregated whale activity from Hyperliquid’s leaderboard combined with cross‑exchange derivatives data.
Understanding On-Chain Whale Signals
Whale wallets are addresses that hold or trade significant amounts of cryptocurrency. When a whale deposits assets to an exchange, opens a large position, or withdraws from a decentralized exchange, it often signals intent — and the market frequently follows. Smart Money API automatically discovers approximately 2,000 whale wallets from Hyperliquid’s multi‑timeframe leaderboard and tracks their events across supported exchanges (Bybit, Binance, and Hyperliquid only). These events include large inflows, outflows, and position changes.
By wiring these signals into a trading bot, you can program responses such as placing limit orders, adjusting stop‑losses, or sending alerts — all without emotional delay.
Getting Started with Smart Money API
First, sign up at smartmoneyapi.com to obtain an API key. The free tier grants 200 calls per day, limited to Bitcoin data — sufficient for testing. For full functionality (all symbols, whale events, derivatives, and on‑chain metrics), the Trader tier (3,000 calls/day) or Pro tier (15,000 calls/day) is recommended.
All requests are authenticated via the X-API-Key header. The base endpoint is https://api.smartmoneyapi.com. Below is a minimal Python script to test your connection:
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.smartmoneyapi.com"
headers = {"X-API-Key": API_KEY}
# Check health
resp = requests.get(f"{BASE_URL}/v1/health", headers=headers)
print(resp.json())
Fetching Whale Wallet Data
The most direct whale signal is available via /v1/whales/summary, which returns aggregated metrics for all tracked wallets, such as total net flow and the number of active wallets. For individual events (deposits, withdrawals, position openings), use /v1/whales/events.
Example: Retrieve the latest 5 whale events:
endpoint = f"{BASE_URL}/v1/whales/events"
params = {"limit": 5}
resp = requests.get(endpoint, headers=headers, params=params)
events = resp.json()
for event in events:
print(f"Symbol: {event['symbol']}, Type: {event['event_type']}, "
f"Amount: {event['amount_usd']}, Wallet: {event['wallet_address'][:8]}...")
Events include fields like event_type (e.g., “deposit”, “withdrawal”, “open_long”), symbol, amount_usd, and a timestamp. Your bot can filter by specific symbols or thresholds — for example, only act when a whale deposits over $500,000 USD into an exchange.
Integrating Whale Data into a Trading Strategy
A simple strategy might use a “whale momentum” signal: if multiple whales are depositing to an exchange for the same symbol within a short window, it could indicate an upcoming sell pressure. Conversely, large withdrawals to self‑custody often signal accumulation.
You can build a scoring mechanism:
- Track net USD flow per symbol over the last hour.
- If net flow exceeds a threshold (in absolute value), generate a signal.
- Combine with derivatives data (next section) for confirmation.
Important: This is a data‑driven methodology that carries no guarantees. Backtest thoroughly and never rely solely on one signal.
Adding Derivatives Data for Confirmation
Smart Money API offers cross‑exchange derivatives data from Bybit, Binance, and Hyperliquid only (no OKX). Use the /v1/derivatives/screener endpoint to pull metrics like open interest, funding rates, and long/short ratios for any of the ~229 auto‑discovered symbols.
Example: Fetch the current funding rate and open interest for BTC‑USDT perpetual:
screener = f"{BASE_URL}/v1/derivatives/screener"
params = {"symbol": "BTC/USDT:USDT", "exchange": "binance"}
resp = requests.get(screener, headers=headers, params=params)
data = resp.json()
print(f"OI: {data['open_interest']}, Funding Rate: {data['funding_rate']}")
By pairing whale deposit events with rising open interest and a negative funding rate (indicating short dominance), you can generate more robust trade ideas.
Node Intelligence for Token Risk (BSC & Avalanche)
If your bot trades on Binance Smart Chain (PancakeSwap) or Avalanche C‑chain (Trader Joe), you can leverage Smart Money API’s Node Intelligence product. This runs on your own full node (or a resellable RPC) and provides:
- New pair detection
- Large swap monitoring
- Honeypot detection (
/v1/node/{bsc|avax}/honeypot/{token}) - Token risk scoring (
/v1/node/{bsc|avax}/token-risk/{token}) - Wallet tracking
For example, before buying a newly discovered token, call the honeypot endpoint to check if the contract has sell restrictions. The response includes flags like is_honeypot and risk_score (0‑100).
token = "0x123...abc"
resp = requests.get(f"{BASE_URL}/v1/node/bsc/honeypot/{token}", headers=headers)
honeypot_check = resp.json()
if honeypot_check.get("is_honeypot"):
print("Token is a honeypot — skipping.")
Smart Money API offers Node plans (Starter, Pro, API per chain) for this service.
Building the Bot Loop
Assemble the components into a continuous loop. Use time.sleep() or a scheduler (e.g., schedule library) to respect API rate limits. A typical interval is 5–15 minutes for whale events and 1 minute for derivatives data if your tier allows.
Pseudo‑code structure:
while True:
whales = get_whale_events(min_amount_usd=500_000)
for event in whales:
if is_bullish_signal(event):
oi, funding = get_derivatives(event['symbol'])
if oi > threshold and funding < -0.01:
execute_trade(event['symbol'], side="short")
time.sleep(300) # 5 minutes
Remember to implement error handling, logging, and dry‑run mode before live trading.
Frequently Asked Questions
What is the best Python library for building a crypto trading bot?
For premium APIs like Smart Money API, requests is sufficient. For exchange connectivity, ccxt is the standard library supporting many exchanges. For backtesting, backtrader or vectorbt are popular.
How many whale wallets does Smart Money API track?
Approximately 2,000 wallets auto‑discovered from Hyperliquid’s multi‑timeframe leaderboard, across Bybit, Binance, and Hyperliquid exchanges only.
Can I use this bot for tokens on BSC or Avalanche?
Yes, via the Node Intelligence product. You need a full node (or resellable RPC) for the respective chain. The API provides new pair detection, large swaps, honeypot checks, and wallet tracking for BSC and Avalanche.
Do I need real Bitcoin data to start?
No. The free tier gives 200 daily calls for BTC, ETH and SOL, but you can still test endpoints for whitelisted symbols. For other symbols, upgrade to Trader or Pro.
Forward‑Looking Conclusion
Building a crypto trading bot with on‑chain whale signals in Python is increasingly accessible thanks to specialized aggregators like Smart Money API. By combining wallet events, derivatives sentiment, and on‑chain risk checks, you create a multi‑faceted decision engine — one that reduces reliance on lagging price action. As the DeFi ecosystem expands, the ability to programmatically react to large‑holder behavior will remain a valuable tool for systematic traders. Always start with paper trading and iterative backtesting before deploying capital.