Integration Guide

Confirm Bybit perpetuals entries with Smart Money API

Read live Bybit swap market data with CCXT, ask Smart Money API whether whale flow and derivatives positioning confirm your direction, then place the perpetuals entry — sized by the suggested multiplier.

Who this is for

Python developers running a Bybit USDT-perpetuals bot on CCXT who want an independent market-context check before each entry. Smart Money API is decision support — it does not place orders for you; your CCXT code stays in control of execution and risk.

Prerequisites

  • Python 3.9+ with pip install ccxt requests.
  • Bybit API keys configured for CCXT (read-only is fine to test).
  • A Smart Money API key (free tier covers BTC).

Get your API key

Every request authenticates with the X-API-Key header. To get a key:

  1. 1Create a free account, then open your dashboard.
  2. 2Copy the API key shown under API Access. The free tier covers BTC at 200 requests/day — enough to test this guide end to end.
  3. 3Need more symbols or higher limits? Compare tiers on the pricing page.

Keep the key secret — store it in an environment variable, never commit it to source control.

Setup

  1. 1Install the libraries: pip install ccxt requests.
  2. 2Export your key: export SMA_API_KEY="sm_your_key_here".
  3. 3Open Bybit swaps with CCXT (ccxt.bybit({"options":{"defaultType":"swap"}})), let your strategy pick a candidate direction, then call /v1/confirm as a final context gate.
  4. 4Place the perpetuals entry with CCXT only when the action is CONFIRM, sizing by size_mult.

Working example

This script reads a Bybit swap ticker with CCXT, derives a candidate direction, then calls GET /v1/confirm?symbol=BTC&direction=long before deciding whether to place the entry.

bybit_confirm.py
import os
import ccxt
import requests

API_KEY = os.environ["SMA_API_KEY"]            # never hard-code
SMA_BASE = "https://api.smartmoneyapi.com"

exchange = ccxt.bybit({"options": {"defaultType": "swap"}})   # Bybit perpetuals

def confirm(symbol: str, direction: str) -> dict:
    """Ask Smart Money API for market-context confirmation."""
    r = requests.get(
        f"{SMA_BASE}/v1/confirm",
        params={"symbol": symbol, "direction": direction, "source": "bybit-bot"},
        headers={"X-API-Key": API_KEY},
        timeout=10,
    )
    r.raise_for_status()
    return r.json()

# 1. Read Bybit swap market data with CCXT and pick a candidate direction
ticker = exchange.fetch_ticker("BTC/USDT:USDT")
direction = "long" if ticker["percentage"] and ticker["percentage"] > 0 else "short"

# 2. Confirm with Smart Money API before acting
sig = confirm("BTC", direction)
print(sig["action"], sig["confidence"], "size_mult", sig["size_mult"])

# 3. Act on the recommendation (CCXT executes; the API only advises)
if sig["action"] == "CONFIRM":
    base_qty = 0.01
    qty = base_qty * sig["size_mult"]          # scale by suggested multiplier
    # exchange.create_order("BTC/USDT:USDT", "market", direction, qty)
    print(f"Would place {direction} {qty} BTC/USDT:USDT perp")
elif sig["action"] == "REDUCE":
    print("Context is mixed -> trade smaller or wait for a cleaner setup")
else:  # SKIP
    print("Context does not support this trade -> stand aside")

Expected response

A successful call to /v1/confirm returns JSON like this:

200 OK · application/json
{
  "ts": 1710940821,
  "symbol": "BTC",
  "direction": "long",
  "composite": 0.74,
  "confidence": "HIGH",
  "action": "CONFIRM",
  "size_mult": 1.5,
  "deriv_score": 0.81,
  "onchain_score": 0.68,
  "whale_score": 0.73,
  "reasons": [
    "Funding rate positive across all venues",
    "LSR favors longs: 1.42",
    "Whales: 67% long consensus",
    "MVRV above 1.0 — on-chain bullish"
  ]
}

composite ranges from -1.0 (strong contra) to +1.0 (strong confirm), confidence is HIGH or MEDIUM, and size_mult is a 0.0–1.5 suggested size multiplier. See the full field reference in the API docs.

How to act on the response

CONFIRM

Context supports your direction. Proceed with your own entry and risk rules, optionally scaling size by size_mult.

REDUCE

Signals are mixed. Consider a smaller position, tighter stops, or waiting for a cleaner setup.

SKIP

Market context does not support this trade. Stand aside and re-check on the next candidate.

Ready to build?

Grab a free key and make your first confirmation call in under a minute.

Not financial advice. Crypto trading involves risk.