API Documentation
Programmatic access to our normalized market-data feed and the metrics engine behind our open-source order-flow library. Built for low-latency research and backtesting.
Quick Start
Market Data Streams (WebSockets)
Our WebSocket API provides ultra-low latency, real-time market data directly from our normalized feed. Subscribe to multiple channels (L1, L2 order books, trades) across different venues over a single connection. The feed is optimized for minimal bandwidth footprint and maximum speed.
Metrics Engine (REST / FIX)
Submit a window of trades or book snapshots via REST or FIX Protocol 4.4 and receive computed microstructure metrics — order-flow imbalance, VPIN, effective spread — in a single round trip. Every computation mirrors a function in our dependency-free open-source library, so results are fully reproducible offline. Standard rate limits apply for REST, while FIX sessions offer dedicated bandwidth.
Endpoint Reference (REST)
The base URL for all REST API endpoints is https://api.twowaymind.com/v1/. All requests must be authenticated using a JWT token in the Authorization: Bearer header. Every endpoint mirrors a function in our open-source library, so you can prototype locally with no credentials before moving to the hosted feed.
| Method | Endpoint | Description | Rate Limit |
|---|---|---|---|
| GET | /markets/symbols | List all tradable instruments. | 100/sec |
| POST | /metrics/ofi | Compute order-flow imbalance over a submitted trade / book window. | 1000/sec |
| POST | /metrics/vpin | Compute VPIN flow-toxicity over a volume-bucketed window. | 1000/sec |
| GET | /data/l2 | Fetch a Level-2 order-book snapshot for a symbol. | 50/sec |
Payload Structure & Types
Metric requests accept strictly typed JSON payloads. The metric field supports ofi, vpin, effective_spread, and kyle_lambda.
For volume-clock metrics we recommend setting the bucket parameter (volume, dollar, or tick) to match the sampling used in your research.
Responses are returned in JSON format with a standard wrapper containing a success boolean, an error_code (if applicable), and a data object.