How to Use ME10002: Order Book Liquidity in Trading
How to Use ME10002: Order Book Liquidity in Trading
Order book data reveals true market depth vs spoofed orders. Essential for sizing positions, routing orders, and timing entries across spot, perpetuals, ETFs, and MSTR.
Why Madjik's ME10002 Data is Unique
- Real depth vs displayed depth - filters out orders that cancel when approached
- Cross-exchange aggregation - see total liquidity, not just one venue
- Spoof detection score - know which books are real before you trade
- Slippage estimates - predict actual execution cost for any order size
Strategy 1: Smart Order Routing (No Leverage)
import requests
MADJIK_API = "https://api.madjik.io/v1"
HEADERS = {"X-API-Key": "your_api_key"}
def optimal_execution(order_size_usd):
"""Find best execution venue based on real depth."""
depth = requests.get(f"{MADJIK_API}/metrics/ME10002/depth/now", headers=HEADERS).json()
score = requests.get(f"{MADJIK_API}/metrics/ME10002/score/now", headers=HEADERS).json()
slippage = requests.get(f"{MADJIK_API}/metrics/ME10002/slippage/now", headers=HEADERS).json()
venues = []
for exchange in ["binance", "coinbase", "kraken"]:
venues.append({
"exchange": exchange,
"depth_1pct": depth["data"][exchange]["bid_depth_1pct"],
"authenticity": score["data"][exchange],
"slippage_est": slippage["data"][exchange].get(f"slippage_{order_size_usd//1000}k", 1.0)
})
# Sort by authenticity-weighted slippage
venues.sort(key=lambda x: x["slippage_est"] * (100 / x["authenticity"]))
return {
"order_size": f"${order_size_usd:,}",
"recommended_venue": venues[0]["exchange"],
"expected_slippage": f"{venues[0]['slippage_est']:.2f}%",
"all_venues": venues,
"alternative": "Use IBIT ETF for $1M+ orders (deeper liquidity)"
}
print(optimal_execution(500000))
Strategy 2: Liquidity-Adjusted Leverage
def max_safe_leverage():
"""Reduce leverage when liquidity is thin."""
depth = requests.get(f"{MADJIK_API}/metrics/ME10002/depth/now", headers=HEADERS).json()
depth_24h = requests.get(f"{MADJIK_API}/metrics/ME10002/depth/24h", headers=HEADERS).json()
current = depth["data"]["total_depth_1pct"]
average = depth_24h["data"]["avg_depth_1pct"]
ratio = current / average
if ratio < 0.5:
return {"max_leverage": "1x", "warning": "THIN LIQUIDITY - spot only"}
elif ratio < 0.8:
return {"max_leverage": "2x", "warning": "Below average depth"}
else:
return {"max_leverage": "5x", "status": "Normal liquidity"}
print(max_safe_leverage())
AI Agent Integration (MCP)
{
"tools": [
{"name": "get_depth", "endpoint": "GET /metrics/ME10002/depth/now"},
{"name": "get_slippage", "endpoint": "GET /metrics/ME10002/slippage/now"},
{"name": "check_authenticity", "endpoint": "GET /metrics/ME10002/score/now"}
]
}
Risk Matrix
| Risk | Madjik Metric | Mitigation |
|---|---|---|
| Spoofed liquidity | ME10002/score | Only trade where score > 70 |
| Liquidity collapse | ME10002/depth | Compare to 24h avg |
| Execution slippage | ME10002/slippage | Pre-calculate, use limits |
Recommended Endpoints
| Endpoint | Use Case | Tier |
|---|---|---|
ME10002/depth/now |
Real-time depth | Basic |
ME10002/slippage/now |
Pre-trade analysis | Basic |
ME10002/score/now |
Spoof detection | Basic |
For informational purposes only. Not financial, investment, tax, legal or other advice.