Skip to main content
Glama
simple-vwap-slippage

simple-vwap-slippage

simple-vwap-slippage

An MCP server that prices a market order against the live Bybit spot order book and tells you what it will really cost.

Ask for "buy 250 000 USDT of BTC" and you get the volume-weighted average price, the slippage in basis points against the best ask, how many book levels it eats, whether the book is deep enough, and the limit price that would fill it. Ask for several sizes at once and you get a slippage curve measured against a single snapshot, so the numbers are actually comparable.

No API key. No account. No order is ever placed — every tool is read-only.

get_order_book           the ladder, the spread and the resting depth
quote_market_order       VWAP and slippage for one market order
get_slippage_curve       the same order at several sizes, one snapshot
check_order_constraints  the pair's published trading rules, applied
search_symbols           find a listed pair and its rules

Other languages: Español · Русский


Why this exists

The spread is not the cost of a trade, it is only the cost of the first fraction of it. A model that says "BTC costs 60 785.7" is wrong the moment you want to buy more than one level's worth, and there is no way to know how wrong without walking the book.

This server walks it. For the snapshot below (BTC/USDT on Bybit spot, 200 levels a side):

Order size

VWAP

Slippage vs the touch

Levels consumed

1 000 USDT

60 785.700000

0.0000 bps

1

100 000 USDT

60 786.548708

0.1396 bps

7

1 000 000 USDT

60 798.018536

2.0266 bps

61

Three orders of magnitude of size, still under two and a half basis points — because BTC/USDT is one of the deepest books in crypto. Try the same table on a small-cap altcoin and the third row will be tens of basis points. That is exactly the number worth knowing before a trade, and exactly the number you cannot read off a ticker.

Related MCP server: ProofGate

Install

The server speaks the Model Context Protocol over stdio, so it runs alongside any MCP client.

pip install mcp-simple-vwap-slippage

Or from a clone:

git clone https://github.com/tordagaz-ops/simple-vwap-slippage
cd simple-vwap-slippage
python -m venv .venv
.venv/Scripts/activate      # Windows
pip install -e ".[dev]"

Requires Python 3.10 or newer. Two dependencies: mcp and httpx.

Connect it to a client

Any client that can start a stdio server works. The console script and the module entry point are equivalent — use whichever you prefer.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "vwap-slippage": {
      "command": "python",
      "args": ["-m", "mcp_vwap_slippage"],
      "env": { "MCP_LOCALE": "en" }
    }
  }
}

Cursor, VS Code, Windsurf and the rest take the same command / args / env triple in their own config file. If you installed with pip, simple-vwap-slippage also works as the command with no arguments.

Prefer a hosted endpoint? Run it over HTTP instead (see Self-hosting).

The tools

All five are read-only (readOnlyHint: true) and reach the open internet (openWorldHint: true). Sizes are in base coins, prices in the quote currency, unless stated otherwise.

get_order_book

The current book for one pair: best bid and ask, spread, both ladders and the total resting size per side.

Argument

Type

Default

symbol

string

—

Pair in Bybit notation, BTCUSDT, ETHUSDC. Case does not matter.

depth

int

20

Levels per side, 1–1000. Bybit only serves 1, 5, 25, 50, 100, 200, 500 and 1000, so the value is rounded up to the nearest of those.

{
  "symbol": "BTCUSDT",
  "base_coin": "BTC",
  "quote_coin": "USDT",
  "tick_size": "0.1",
  "timestamp": "2026-11-26T09:26:15Z",
  "best_bid": 60785.6,
  "best_ask": 60785.7,
  "mid": 60785.65,
  "spread": 0.1,
  "spread_bps": 0.0165,
  "levels": { "requested": 5, "bids": 5, "asks": 5 },
  "bids": [{ "price": 60785.6, "size": 0.381057, "notional": 23162.7783792 }, "…"],
  "asks": [{ "price": 60785.7, "size": 0.993751, "notional": 60405.8501607 }, "…"],
  "depth": {
    "bids": { "levels": 5, "base": 1.27824, "quote": 77696.7122514 },
    "asks": { "levels": 5, "base": 1.032233, "quote": 62745.0208669 },
    "imbalance": 0.55323094
  }
}

imbalance is the share of resting quote value sitting on the bid. Above 0.5 means buyers are queued and sellers get the easier fill.

quote_market_order

Price one market order and say what it costs.

Argument

Type

Default

symbol

string

—

Pair in Bybit notation.

side

string

—

buy consumes the asks, sell consumes the bids.

amount

number

—

Size, in USDT for a buy by default and in coins for a sell by default.

amount_unit

string

side-dependent

quote (USDT) or base (coins). Overrides the default above.

max_levels

int

200

How deep to walk, 1–1000. Raise it for very large orders.

{
  "symbol": "BTCUSDT",
  "side": "buy",
  "amount": 250000.0,
  "amount_unit": "quote",
  "filled": 250000.0,
  "complete": true,
  "base_qty": 4.1126067434,
  "quote_qty": 250000.0,
  "vwap": 60788.6957338199,
  "reference_price": 60785.7,
  "reference": "best_ask",
  "slippage": 4.928e-05,
  "slippage_percent": 0.004928,
  "slippage_bps": 0.4928,
  "levels_consumed": 20,
  "worst_price": 60791.9,
  "suggested_limit_price": 60791.9,
  "message": null,  "book": { "best_bid": 60785.6, "best_ask": 60785.7, "spread_bps": 0.0165, "levels": { "bids": 200, "asks": 200 } }
}

Two details that matter:

  • slippage is measured against the touch, not the mid. A buy is compared to the best ask, a sell to the best bid, and the sign is always positive when the fill is worse, so the same number means "cost" on both sides. Because of that, an order that fits inside the first level has zero slippage by definition — it still pays the half-spread. The book.mid is included so you can measure against the mid yourself: (vwap - mid) / mid.

  • suggested_limit_price is the worst price the order actually reaches, rounded to the pair's tick — up for a buy, down for a sell, so the number stays executable instead of landing just inside the touch. It is only present for a complete fill: a partial fill needs a deeper book, not a different price.

If the book cannot absorb the whole order, complete is false, filled is what was absorbable, and message explains it in the active language. That is a result, not an error.

get_slippage_curve

The same order at 2 to 12 sizes, all priced against one snapshot.

Argument

Type

Default

symbol

string

—

Pair in Bybit notation.

side

string

—

buy or sell.

amounts

number[]

—

2 to 12 sizes in the same unit.

amount_unit

string

side-dependent

quote or base.

max_levels

int

200

Depth to walk.

One snapshot is the point. Two separate quote_market_order calls fetch two different books a second apart, and the resulting table is not comparable — the small order and the large order can be priced against different markets and the curve stops being monotonic. Here, points[i] and points[j] are guaranteed to share reference_price, book.timestamp and every level in between.

{
  "symbol": "BTCUSDT",
  "side": "buy",
  "amount_unit": "quote",
  "reference_price": 60785.7,
  "spread_bps": 0.0165,
  "complete_points": 3,
  "points": [
    { "amount": 1000.0, "vwap": 60785.7, "slippage_bps": 0.0, "levels_consumed": 1, "complete": true },
    { "amount": 100000.0, "vwap": 60786.5487082021, "slippage_bps": 0.1396, "levels_consumed": 7, "complete": true },
    { "amount": 1000000.0, "vwap": 60798.0185364213, "slippage_bps": 2.0266, "levels_consumed": 61, "complete": true }
  ]
}

check_order_constraints

Before sending an order anywhere, check it against the rules Bybit publishes for that pair.

Argument

Type

Default

symbol

string

—

Pair in Bybit notation.

quantity

number

—

Size in base coins.

price

number

null

Optional limit price, checked against the tick size.

{
  "symbol": "BTCUSDT",
  "status": "Trading",
  "trading": true,
  "quantity": 1e-07,
  "price": 60785.7,
  "notional": 0.00607857,
  "valid": false,
  "issues": [
    {
      "code": "min_quantity",
      "value": 1e-07,
      "minimum": 1e-06,
      "message": "Quantity 0.0000001 is below the minimum order size of 0.000001."
    },
    {
      "code": "quantity_precision",
      "value": 1e-07,
      "decimals": 6,
      "message": "Quantity 0.0000001 has more decimals than the 6 the pair accepts."
    }
  ],
  "rules": {
    "min_order_qty": 1e-06,
    "max_order_qty": 230.0,
    "min_order_amt": 5.0,
    "max_order_amt": 8000000.0,
    "tick_size": "0.1",
    "quantity_step": "0.000001",
    "price_decimals": 1,
    "quantity_decimals": 6
  }
}

Every issue carries both a machine code and the numbers behind it, so a model can fix the order instead of guessing. rules is always present, valid or not, so the same call also answers "what is the minimum?".

The rules are kept as strings on purpose: tick_size is "0.1" and quantity_step is "0.000001", and a float round-trip would turn that into 1e-06 and destroy the one thing that tells you how many decimals you may send.

This validates the exchange's rules; it does not judge whether the price is sane. A limit price of 95 000 on a 60 785 market passes every rule for BTC/USDT.

search_symbols

Not sure that a pair exists, or which quote currency it uses? Search by symbol, base coin or quote coin.

Argument

Type

Default

query

string

""

Text to match, e.g. PEPE. Empty lists the most liquid pairs.

quote_coin

string

null

Filter by quote currency, e.g. USDC.

limit

int

20

Results to return, 1–100.

{
  "query": "ETH",
  "scanned": 499,
  "matches": 16,
  "returned": 3,
  "ranked_by": "24h turnover",
  "symbols": [
    {
      "symbol": "ETHUSDT", "base_coin": "ETH", "quote_coin": "USDT",
      "tick_size": "0.01", "min_order_qty": 1e-05, "min_order_amt": 5.0,
      "last_price": 1699.17, "change_24h": 0.0337, "change_24h_percent": 3.37,
      "turnover_24h": 274748958.1081299
    }
  ]
}

Ranking is exact symbol first, then base coin, then prefix, then substring; ties are broken by 24-hour turnover, which comes from one extra request that covers the whole market. If that request fails, search still works and says "ranked_by": "symbol name".

The same coin usually has several pairs — ETHUSDT, ETHUSDC, ETHEUR, ETHBTC — and they do not have the same depth. Picking the one with the most turnover is usually the cheapest trade, which is why the field is there.

How the arithmetic works

A VWAP quote is a walk down the ladder, not a formula:

  1. Take the levels on the side you are consuming — asks for a buy, bids for a sell.

  2. For each level, take the smaller of what is left to fill and what the level can absorb.

  3. Stop when the order is filled or the book runs out.

  4. vwap = quote spent / base received.

Rounding is deliberately absent from the model: no reference price, no tick snapping, no fee model. The only number derived afterwards is suggested_limit_price, and it exists because a limit order needs one.

Fees are not included. Bybit's taker fee is additional and depends on your tier; add it yourself if you are comparing against a maker strategy.

Configuration

Variable

Default

MCP_LOCALE

en

Tool titles, descriptions, parameter docs and error messages: en, es, ru. Falls back to LANGUAGE, then LANG, then English.

MCP_TRANSPORT

stdio

stdio, or http for a streamable HTTP endpoint.

MCP_HOST

0.0.0.0

Bind address for HTTP transport.

MCP_PORT

8000

Port for HTTP transport.

Market data is cached briefly so a burst of identical calls costs one upstream request: order books for 1.5 seconds, the instrument list for an hour, the 24-hour turnover table for a minute. Quotes are therefore at most 1.5 seconds stale, which is stated in book.timestamp on every payload.

Self-hosting

# stdio, the default
python -m mcp_vwap_slippage

# streamable HTTP on :8000
MCP_TRANSPORT=http MCP_PORT=8000 python -m mcp_vwap_slippage

Docker, if you prefer a sealed image:

docker build -t simple-vwap-slippage .
docker run -i --rm simple-vwap-slippage                          # stdio
docker run -p 8000:8000 -e MCP_TRANSPORT=http simple-vwap-slippage

smithery.yaml is included, so the repo can also be deployed as a hosted Smithery server from the Python runtime with no image at all.

Development

pip install -e ".[dev]"
pytest                      # everything the network allows
pytest -m "not live"        # offline only: 197 tests, no internet needed
pytest -m live              # 31 tests against the real Bybit API
pytest -m e2e               # spawns the server and speaks JSON-RPC to it

Four layers, each catching what the one below cannot:

  • Unit — the parsers and the VWAP walk, against payloads that reproduce Bybit's wire format exactly (prices and sizes as strings, errors as HTTP 200 with a non-zero retCode).

  • Tool level — the same tests again through a real in-memory MCP session, so the generated schemas, the annotations and the structured-content wrapping are covered.

  • Live — the real API, skipped rather than failed when there is no connection.

  • End-to-end — python -m mcp_vwap_slippage in a subprocess, raw JSON-RPC over stdio. No imports, so a packaging mistake or a stray print on stdout fails here.

Limitations

  • A snapshot, not a promise. The book moves between the quote and the fill. Slippage is measured on resting liquidity and ignores queued-but-undisplayed orders, icebergs and latency.

  • Spot only. Bybit perpetuals price differently and carry funding; category=linear is not used here.

  • One venue. No cross-exchange comparison, no routing.

  • No fees, no borrow costs, no tax lot tracking.

Data source

Public market data from the Bybit V5 API. This project is not affiliated with or endorsed by Bybit.

Free, and donations welcome

This server is free: every tool can be called without payment, registration or an API key. If it saves you time or money, you can send a donation -- it goes straight to the developer, with no platform in between.

Network

Asset

Address

Base

USDC / ETH

0x832e9e0FC60c35A07cf80846A9eD27aa7cb4F637

Ethereum

ETH

0x832e9e0FC60c35A07cf80846A9eD27aa7cb4F637

Nothing in the code is gated on donations: no telemetry, no licence check, no expiring demo. The whole source is MIT-licensed.

Same market, wider view: FundingScope is a hosted MCP server for the paid half of the picture — cross-exchange funding spreads ranked by annualised yield, perp-vs-spot basis, open interest, book-walk VWAP slippage for a given notional, token safety and Bank of Russia rates, all behind one endpoint with a free trial key. This server stays free, standalone and needs no key; that one is for when a single call has to answer the whole question.

License

MIT — see LICENSE.

Available Tools

5 tools
check_order_constraintsValidate an order against exchange rulesA
Read-only

Check a proposed order against the pair's published rules before sending it: minimum and maximum quantity, minimum and maximum notional, quantity precision and price tick. Returns valid=true with an empty issue list, or the exact rules broken with their limits. This validates only; nothing is sent to the exchange. Example: symbol='BTCUSDT', quantity=0.0001, price=95000.

Inputs: symbol (required), quantity (required), price. Returns: object

get_order_bookRead a Bybit spot order bookA
Read-only

Return the live Bybit spot order book for one pair: best bid and ask, the spread in basis points, both ladders and the total resting size per side plus a bid/ask imbalance ratio. Prices are in the quote currency and sizes in the base currency. Use it to see liquidity before quoting a trade. Example: symbol='BTCUSDT', depth=20.

Inputs: symbol (required), depth. Returns: object

get_slippage_curveCompare slippage across sizesA
Read-only

Price the same order at several sizes against one snapshot of the book, which is what you want for a slippage table: separate calls would each fetch a different book and the points would not be comparable. Returns one point per size with its VWAP, slippage in basis points, levels consumed and whether it was fully fillable. Example: symbol='BTCUSDT', side='sell', amounts=[100, 1000, 10000].

Inputs: side (required), symbol (required), amounts (required), max_levels, +1 more. Returns: object

quote_market_orderPrice a market order as VWAPA
Read-only

Price a market order against the current Bybit spot book and report the VWAP, the slippage versus the best price, whether the book is deep enough, and the number of levels consumed. 'amount' is sized in the quote currency (USDT) for a buy and in base coins for a sell, which is how each side is normally described; pass amount_unit to override. Slippage is expressed as a fraction and in basis points and is always positive when the fill is worse than the touch. No order is placed. Example: symbol='BTCUSDT', side='buy', amount=5000.

Inputs: side (required), amount (required), symbol (required), max_levels, +1 more. Returns: object

search_symbolsFind a Bybit spot pairA
Read-only

Search the pairs Bybit lists on spot by symbol, base coin or quote coin and return the trading rules of each match. Use it when you are not sure a pair exists, or which quote currency it trades against -- the same coin often has USDT, USDC and BTC pairs. Example: query='PEPE', quote_coin='USDT'.

Inputs: limit, query, quote_coin. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool targets a distinct step in the pre-trade workflow: raw book inspection, single-size pricing, multi-size curve, rule validation, and symbol discovery. The only near-overlap is quote_market_order versus get_slippage_curve, since the latter is effectively a batch version of the former, but the descriptions explicitly explain when to use each (one snapshot vs. comparable points).

    Naming Consistency5/5

    All five names follow a clean verb_noun snake_case pattern (get_order_book, quote_market_order, get_slippage_curve, check_order_constraints, search_symbols). Verbs are used precisely and consistently with the read-only nature of the server.

    Tool Count5/5

    Five tools is a tight, well-scoped surface for a focused slippage/VWAP analysis server. Every tool earns its place: discovery, book data, two pricing modes, and validation, with no filler.

    Completeness4/5

    The pre-trade lifecycle is well covered end to end: find the symbol, inspect liquidity, price one or many sizes, and validate against exchange rules. Minor gaps exist, such as fee/commission-adjusted cost or a way to compare across venues, but the stated read-only quoting purpose is fully served.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Enables cryptocurrency trading on Bybit exchange through comprehensive market data access, account management, and automated trading operations. Features smart position validation, trailing stop losses, and risk management tools with demo mode support for safe testing.
      21
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only analysis of Binance Spot markets through a single MCP tool that fetches live public market data and generates a Trade Readiness Passport with WATCH, RESEARCH_MORE, or NO_TRADE outcomes.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables read-only crypto market analysis, derivatives positioning, coin and token safety checks, trade sizing, backtests, swap quote comparison, wallet reviews, portfolio stress tests, and 35 live market feeds.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to query live cross-exchange perpetual funding-rate spreads, per-symbol venue breakdowns, Top-20 L2 orderbook slippage, rotation breakeven calculations, and cash-and-carry opportunities across seven venues.
      MIT