Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

FollowSM Official SDK (Python & TypeScript)

Official client libraries for the FollowSM Market Intelligence Engine — tracking Smart Money flows, Binance orderbook toxicity (VPIN), and Polymarket binary prediction confluence in real time.

🚀 Key Features

  • Binance Microstructure: Tick-level VPIN, 1% orderbook toxicity bands, L1 imbalances, and volume Z-scores.
  • Polymarket Confluence: Binary event odds, 15m probability deltas ($\Delta\text{Prob}$), and Smart Money whale sweeps.
  • Cross-Market Divergence: Automated HFT risk recommendations ('NONE', 'WIDEN_SPREAD_1_5X', 'WIDEN_SPREAD_2X', 'HALT_MAKER_QUOTES')

Install

pip install followsm-sdk

Quickstart

from followsm_sdk import FollowSMClient

client = FollowSMClient(api_key="fsm_live_...")  # or omit for the free, IP-rate-limited tier
snapshot = client.get_toxicity_snapshot("BTCUSDT")
print(snapshot.vpin, snapshot.is_toxic_alert)

toxic_pairs = client.get_toxic_pairs()  # also works without an api_key

SymbolToxicityMetrics response

get_toxicity_snapshot() and get_toxic_pairs() both return SymbolToxicityMetrics (pydantic models), matching the raw JSON the backend returns:

{
  "symbol": "BTCUSDT",
  "timestamp": 1758412800.0,
  "price": 62150.5,
  "vpin": 0.72,
  "ob_toxicity_1pct": 0.676,
  "ob_imbalance_l1": 0.61,
  "depth_bands": {
    "0.5%": { "bid_notional": 30400000.0, "ask_notional": 15900000.0, "imbalance_ratio": 0.657 },
    "1.0%": { "bid_notional": 46000000.0, "ask_notional": 31100000.0, "imbalance_ratio": 0.597 },
    "2.0%": { "bid_notional": 46000000.0, "ask_notional": 31100000.0, "imbalance_ratio": 0.597 }
  },
  "volume_z_score": 3.1,
  "natr_15m": 0.84,
  "taker_buy_ratio": 0.58,
  "is_toxic_alert": true,
  "ob_log_imbalance_1pct": -0.39,
  "ob_imbalance_percentile": 0.004,
  "depth_coverage_pct": 0.0097,
  "seq": 18342
}
Field Type Description
symbol str Trading pair, e.g. "BTCUSDT"
timestamp float Unix epoch seconds when the snapshot was computed
price float Last traded price
vpin float Volume-Synchronized Probability of Informed Trading, [0.0, 1.0]; 0.0 while the symbol is warming up
vpin_percentile float | None Rank of vpin within this symbol's own recent history, [0.0, 1.0]; None while warming up
ob_toxicity_1pct float Ask/bid notional ratio within ±1% of mid price, from the full order book (capped at 999)
ob_imbalance_l1 float Best bid/ask (L1) imbalance
depth_bands dict[str, OrderBookDepthBand] Keyed by band width ("0.5%", "1.0%", "2.0%"), each with bid_notional, ask_notional, imbalance_ratio
volume_z_score float Robust Z-score of recent traded volume
natr_15m float Normalized ATR over 15-minute candles
taker_buy_ratio float Share of taker volume that was buy-side
is_toxic_alert bool True when vpin_percentile >= 0.90, or the ±1% book imbalance is in either extreme tail of the symbol's own history (ob_imbalance_percentile <= 0.01 or >= 0.99); while that percentile is warming up, when ob_toxicity_1pct > 2.0
ob_log_imbalance_1pct float | None ln(ask / bid) notional within ±1%: positive = ask-heavy, negative = bid-heavy, 0 = balanced
ob_imbalance_percentile float | None Rank of ob_log_imbalance_1pct within this symbol's own recent history, [0.0, 1.0]; None while warming up. Some books are structurally bid- or ask-heavy, so compare against this rather than a fixed ratio
depth_coverage_pct float | None How far from mid (as a fraction, 0.0097 = ±0.97%) the book is fully known on both sides; depth bands wider than this are measured within it. None = the whole book is known
seq int | None Per-symbol update counter on the stream; a jump means updates were missed

Live streaming (Enterprise only)

stream_toxicity() connects to /ws/v1/toxicity, which requires an API key on an active Enterprise subscription — Developer API and free/unauthenticated keys are rejected with close code 4003. Each symbol is pushed as soon as it is recomputed (several times per second when the market is active, and at least once per second), so a frame may contain only some symbols.

import asyncio
from followsm_sdk import FollowSMClient

async def main() -> None:
    client = FollowSMClient(api_key="fsm_live_...")
    async for snapshot in client.stream_toxicity():
        print(snapshot.symbol, snapshot.vpin, snapshot.is_toxic_alert)

asyncio.run(main())

Cross-Venue Confluence (Binance × Polymarket)

get_confluence_snapshot(), get_confluence_snapshots() and stream_confluence() enrich Binance microstructure (VPIN, depth imbalance) with live Polymarket event flow (implied probability, CLOB order-flow imbalance, smart-money whale sweeps) and a composite HFT risk recommendation. They return ConfluenceSnapshot (pydantic models), matching this JSON:

{
  "symbol": "BTCUSDT",
  "timestamp_ms": 1790212800000,
  "binance_microstructure": {
    "price": 68420.50,
    "vpin": 0.78,
    "ob_toxicity_1pct": 2.14,
    "ob_imbalance_l1": 0.62,
    "depth_bands": {
      "0.5%": { "bid_notional": 9800000, "ask_notional": 21300000, "imbalance_ratio": 0.32 },
      "1.0%": { "bid_notional": 14200000, "ask_notional": 30400000, "imbalance_ratio": 0.32 }
    },
    "volume_z_score": 3.1,
    "natr_15m": 0.87,
    "taker_buy_ratio": 0.29,
    "price_delta_15m_pct": 0.004,
    "ob_log_imbalance_1pct": 0.76,
    "ob_imbalance_percentile": 0.996,
    "depth_coverage_pct": 0.0097
  },
  "polymarket_confluence": {
    "active_events": [
      {
        "market_slug": "will-btc-hit-70k-in-september",
        "question": "Will Bitcoin hit $70k in September?",
        "condition_id": "0x...",
        "yes_token_id": "12345...",
        "direction": "bullish_if_yes",
        "direction_confidence": 0.91,
        "implied_probability": 0.82,
        "prob_delta_15m": 0.09,
        "clob_order_flow_imbalance": 0.74,
        "smart_money_whale_sweeps_1h_usdt": 185000
      }
    ],
    "macro_event_risk_score": 0.85
  },
  "composite_signals": {
    "is_toxic_alert": true,
    "cross_market_divergence_flag": false,
    "recommended_action": "WIDEN_SPREAD_2X",
    "direction_ambiguous": false,
  }
}
Field Description
binance_microstructure.price_delta_15m_pct Spot price change over the last 15 minutes
polymarket_confluence.active_events[].direction Whether a rising implied_probability (YES) is bullish, bearish, or "neutral" (semantically ambiguous question) for spot
polymarket_confluence.active_events[].direction_confidence [0.0, 1.0] semantic-similarity confidence backing direction
polymarket_confluence.active_events[].prob_delta_15m Change in implied probability over the last 15 minutes
polymarket_confluence.active_events[].clob_order_flow_imbalance Bid/(bid+ask) notional on the YES orderbook
polymarket_confluence.active_events[].smart_money_whale_sweeps_1h_usdt Rolling 60-minute notional from top-ranked smart-money wallets
polymarket_confluence.macro_event_risk_score [0.0, 1.0] composite risk, max over active events
composite_signals.cross_market_divergence_flag true when spot momentum opposes the Polymarket probability shift (bull/bear trap)
composite_signals.recommended_action "NONE" | "WIDEN_SPREAD_1_5X" | "WIDEN_SPREAD_2X" | "HALT_MAKER_QUOTES"
composite_signals.direction_ambiguous true when a low-confidence direction downgraded the recommended action
snapshot = client.get_confluence_snapshot("BTCUSDT")
print(snapshot.composite_signals.recommended_action)

snapshots = client.get_confluence_snapshots(toxic_only=True)

Streaming (stream_confluence(), Enterprise only) connects to /ws/v1/confluence:

async for snapshot in client.stream_confluence():
    print(snapshot.symbol, snapshot.composite_signals.recommended_action)

Custom risk thresholds (RiskConfig)

The backend's recommended_action uses fixed, conservative thresholds. Quant clients can re-derive the risk ladder from the exposed binance_microstructure with their own thresholds via RiskConfig and evaluate_risk_action / client.evaluate_risk():

from followsm_sdk import FollowSMClient, RiskConfig

custom_config = RiskConfig(
    vpin_percentile_widen_threshold=0.85,  # vpin_percentile trigger for WIDEN_SPREAD_2X (default 0.90)
    vpin_percentile_halt_threshold=0.97,   # vpin_percentile trigger for HALT_MAKER_QUOTES (default 0.95)
    vpin_widen_threshold=0.65,             # raw-VPIN fallback while vpin_percentile is None
    vpin_halt_threshold=0.85,
    ob_toxicity_threshold=2.5,             # 1% book ask/bid ratio used while ob_imbalance_percentile warms up (default 2.0)
    ob_imbalance_percentile_low=0.005,     # bid-heavy tail of the symbol's own history (default 0.01)
    ob_imbalance_percentile_high=0.995,    # ask-heavy tail (default 0.99)
    min_semantic_confidence=0.70,          # Stricter than the backend's 0.65 safety gate
)

client = FollowSMClient(api_key="YOUR_KEY", risk_config=custom_config)

snapshot = client.get_confluence_snapshot("BTCUSDT")
print(client.evaluate_risk(snapshot))  # re-evaluated with your own thresholds

evaluate_risk_action(snapshot, config) is also importable standalone for stateless/batch use. Like the backend, it never returns HALT_MAKER_QUOTES when the divergence rests on an event whose direction_confidence is below min_semantic_confidence.

Free vs Developer API

Free / Unauthenticated DEVELOPER_API ($199/mo) Enterprise($499/mo)
Requests/min 30 300 1,000
WebSocket streaming (stream_toxicity()) ❌ ❌ ✅
Binance pairs Limited 50+ 50+
Latency Standard Sub-10ms in-memory snapshots Sub-10ms in-memory snapshots

On HTTP 429, the SDK raises RateLimitExceededException with an upgrade prompt pointing to https://follow-sm.com/pricing.

Metadata

Release files for followsm-sdk 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for followsm-sdk 1.6.0
File Size Uploaded Provenance Actions
followsm_sdk-1.6.0.tar.gz 10.5 kB With provenance Details for followsm_sdk-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for followsm-sdk 1.6.0
File Interpreter ABI Platform Actions
followsm_sdk-1.6.0-py3-none-any.whl Python 3 none any Details for followsm_sdk-1.6.0-py3-none-any.whl

Total release size: 20.1 kB

Release files / followsm_sdk-1.6.0.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL followsm_sdk-1.6.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2d7065993cc7b415b9f30d1fc701855fedd28d3278afff5ed045ef68b113edfc
BLAKE2b-256 checksum
How to use checksums
bb38b2389fb4fc9fc4709afc633edaaebc63b04b3e555871c3b140be92ff46bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / followsm_sdk-1.6.0-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL followsm_sdk-1.6.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0725607927186890dd20092ba762c7a54b08cd2e70ed47b055e77f3b8e4cb426
BLAKE2b-256 checksum
How to use checksums
be19d7e551d7449a976bf8f68f4742c35c775241993c0a6428d39465b09b1144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Security for followsm-sdk 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Change of provenance

The configuration that created this release differs from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 2 files

Attestation for followsm_sdk-1.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page