Market Microstructure & Manipulation Detection

by apifyforge

181 downloads
Not rated
GitHub Website

About

Market microstructure analysis and manipulation detection via an MCP server that orchestrates 14 financial data actors in parallel.

Details

Author
apifyforge
Downloads
181
Categories
Finance

- Queue-reactive Hawkes process estimation with branching ratio computation
- Bayesian Online Changepoint Detection (BOCPD) for manipulation pattern classification
- Spectral transfer entropy and Johansen VECM with Hasbrouck information share
- MRR spread decomposition into adverse selection, inventory, and order processing costs
- Event study CAR methodology around insider and congressional trades
- LASSO-penalized Granger causality with debiased coefficients and F-statistics
- Student-t Hidden Markov Model for market regime classification
- Extensive-form game theory for regulator-manipulator Nash equilibrium

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Market Microstructure & Manipulation Detection
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Add the server URL to your MCP client configuration: "url": "https://ryanclinton--market-microstructure-manipulation-mcp.apify.actor/mcp". Then send natural-language queries such as "Analyze AAPL for spoofing patterns" or "Classify the current crypto market regime." The server routes your query to the appropriate tool and returns structured JSON with algorithm outputs, confidence metrics, and supporting live market data.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "market microstructure & manipulation detection": {
            "market-microstructure-manipulation-mcp": {
                "url": "https://ryanclinton--market-microstructure-manipulation-mcp.apify.actor/mcp"
            }
        }
    }
}

McpServers

{
    "market-microstructure-manipulation-mcp": {
        "url": "https://ryanclinton--market-microstructure-manipulation-mcp.apify.actor/mcp"
    }
}

Market Microstructure & Manipulation MCP

> View on ApifyForge | Use on Apify Store

---

Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf):

{
  "mcpServers": {
    "market-microstructure-manipulation-mcp": {
      "url": "https://ryanclinton--market-microstructure-manipulation-mcp.apify.actor/mcp"
    }
  }
}

---

Market microstructure analysis and manipulation detection via an MCP server that orchestrates 14 financial data actors in parallel. Built for quantitative researchers, compliance teams, and algorithmic traders who need production-grade econometric methods — Hawkes processes, BOCPD, spectral transfer entropy, Granger causality, and game-theoretic surveillance optimization — without managing infrastructure.

Connect any MCP-compatible AI client to analyze order book dynamics, detect spoofing and layering, measure cross-asset information flow, decompose bid-ask spreads, identify abnormal insider flows, discover causal manipulation networks, classify market regimes, and optimize surveillance resource allocation. All eight tools run against live data assembled from Finnhub, SEC EDGAR, SEC insider filings, congressional stock disclosures, CoinGecko, ECB rates, FRED, BLS, and more.

What data can you access?

| Data Point | Source | Coverage |
|------------|--------|----------|
| 📈 Stock prices and financials | Finnhub | US equities, quotes, earnings, company metrics |
| 📋 SEC regulatory filings | EDGAR | 10-K, 10-Q, 8-K, enforcement actions |
| 👤 Insider transactions | SEC Form 4 | Officer and director buys, sells, option exercises |
| 🏛️ Congressional stock trades | STOCK Act tracker | Senate and House member trade disclosures |
| 🪙 Cryptocurrency markets | CoinGecko | 10,000+ coins, prices, volumes, market caps |
| 💱 Currency exchange rates | Exchange Rate Tracker | 150+ live currency pairs |
| 🇪🇺 ECB reference rates | ECB Exchange Rates | Daily EUR reference rates for FX microstructure |
| 📉 Federal Reserve indicators | FRED | FEDFUNDS, VIX, GDP, macroeconomic series |
| 📊 Labor market statistics | BLS | CPI, unemployment, PPI for regime context |
| 📰 Federal regulations | Federal Register | SEC and CFTC rulemakings and enforcement orders |
| 💬 Tech community signals | Hacker News | Market-relevant technology and finance discussion |
| 🔍 Website change monitoring | Website Change Monitor | Regulatory and corporate page updates |
| 📩 Consumer complaints | CFPB | Financial product complaint trends |
| 📅 Historical exchange rates | Exchange Rate History | Long-term FX time series for trend analysis |

Why use Market Microstructure & Manipulation MCP?

Building market surveillance infrastructure from scratch requires accessing 10+ financial APIs, implementing BOCPD, Hawkes processes, VECM cointegration, and game-theoretic LP solvers — then keeping it maintained as APIs change. Most academic implementations run locally, require Python environments, and break in production.

This MCP server handles all of that. Send a natural-language query from Claude, Cursor, or any MCP client and receive structured analytical output backed by live financial data and peer-reviewed econometric methods.

- Scheduling — run nightly manipulation scans and regime checks on a recurring schedule to detect emerging patterns
- API access — trigger runs programmatically from Python, JavaScript, or any HTTP client via the Apify API
- Parallel data fetching — up to 8 actors execute simultaneously per tool call, assembling market data in seconds rather than minutes
- Monitoring — receive Slack or email alerts when spoofing is detected or regime transitions occur via webhooks
- Integrations — connect to Zapier, Make, or any webhook-compatible service for automated surveillance notifications

Features

- Queue-reactive Hawkes process estimation — multi-dimensional intensity lambda_d(t) = mu_d + sum alpha_{dd'} exp(-beta(t-s)) estimated via EM algorithm with E/M-step iteration; branching ratio computed as spectral radius of the alpha/beta matrix via power iteration (100 iterations to convergence)
- Bayesian Online Changepoint Detection (BOCPD) — maintains run length posterior P(r_t | x_{1:t}) with normal-inverse-gamma conjugate prior and constant hazard function; classifies detected changepoints into 4 manipulation patterns: layering, spoofing, wash trading, momentum ignition
- Spectral transfer entropy — directed information flow TE(f) = 1/(4pi) ln(S_Y(f)/S_{Y|X}(f)) computed from AR spectral estimates across asset pairs; identifies which markets lead and which follow
- Johansen VECM with Hasbrouck information share — price discovery attribution via Cholesky decomposition of the innovation covariance matrix from a vector error correction model
- MRR spread decomposition — Madhavan-Richardson-Roomans model separates bid-ask spread into adverse selection, inventory cost, and order processing components; Kyle lambda computed via OLS regression on signed order flow
- Roll measure and Amihud illiquidity — Roll measure derived from return autocovariance; Amihud ratio measures price impact per unit of trading volume
- Event study CAR methodology — Cumulative Abnormal Return computed in [-5, +30] event window around insider and congressional transactions; t-statistics for significance; HHI-based information share concentration
- LASSO-penalized Granger causality — coordinate descent with soft-thresholding selects relevant VAR lags; debiased coefficients with confidence intervals; F-statistics for Granger causality test
- Student-t Hidden Markov Model — 4-state HMM (calm, volatile, crisis, recovery) with fat-tail Student-t emissions; EM forward-backward algorithm for parameter estimation; Viterbi algorithm for MAP path decoding
- Extensive-form game theory — regulator vs. manipulator modeled as zero-sum game; Nash equilibrium computed via fictitious play (200 iterations); outputs optimal budget allocation, game value, detection probability, and deterrence effect
- Gauss elimination linear solver — partial pivoting for numerically stable solutions in OLS and game-theory computations
- 14 parallel data sources — Finnhub, CoinGecko, SEC EDGAR, SEC insider, congressional tracker, exchange rates, ECB, FRED, BLS, Federal Register, Hacker News, website monitor, CFPB, exchange rate history

Use cases for market microstructure analysis

Quantitative research and HFT strategy evaluation

Quantitative researchers testing high-frequency strategies need to understand order book dynamics before going live. The simulate_order_book_dynamics tool estimates Hawkes process parameters from real market data, returning the branching ratio and criticality index. A branching ratio approaching 1.0 signals a market near self-excitation criticality — a regime where HFT strategies face reflexivity risk. This replaces weeks of custom data pipeline work with a single tool call.

Compliance and market surveillance

Compliance teams at broker-dealers and exchanges need continuous spoofing and layering surveillance. The detect_spoofing_manipulation tool applies BOCPD to detect changepoints in order flow, classifies them by manipulation type, and returns confidence-scored alerts. Feeding these outputs into a daily webhook delivers an automated surveillance pipeline without proprietary surveillance system costs.

Regulatory economics and enforcement research

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.