Developers

API Documentation

Integrate institutional-grade evaluation and data into your testing loop. Designed for microsecond performance.

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.

connect_websocket.py
import asyncio
import websockets
import json

async def stream_market_data():
    uri = "wss://data.twowaymind.com/v1/stream"
    async with websockets.connect(uri) as ws:
        # Subscribe to ES (S&P 500) Level 2 Order Book
        sub_msg = {
            "action": "subscribe",
            "channel": "l2_book",
            "symbols": ["CME:ES"]
        }
        await ws.send(json.dumps(sub_msg))

        while True:
            data = await ws.recv()
            print(data)

Evaluation Entry (REST / FIX)

Submit signals via REST endpoints or FIX Protocol 4.4 for institutional-grade reliability. Every signal passes through our hardware-accelerated validation checks in under 0.01ms before being processed in the evaluation engine. Standard rate limits apply for REST, while FIX sessions offer dedicated bandwidth.

submit_signal.cpp
// C++ Low-Latency Evaluation Entry (cURL)
#include <iostream>
#include <curl/curl.h>

int main() {
    CURL *curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://api.twowaymind.com/v1/signals");
        
        // Payload for Buy Signal Validation
        const char* json = "{\"symbol\": \"BTC/USD\", \"side\": \"buy\", \"type\": \"limit\", \"price\": 64000.50, \"qty\": 1.5}";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);

        CURLcode res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
    }
    return 0;
}

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. Ensure that your IP address is whitelisted in the Client Portal before making production requests.

Method Endpoint Description Rate Limit
GET /markets/symbols List all tradable instruments. 100/sec
POST /orders Submit a new limit or market signal to the evaluation engine. 1000/sec
DELETE /orders/{id} Cancel an open signal by ID. 1000/sec
GET /account/balances Retrieve current wallet/margin balances. 50/sec

Payload Structure & Types

Signal requests accept strictly typed JSON payloads. The type field supports limit, market, stop_loss, and take_profit. For algorithmic strategies, we highly recommend utilizing the time_in_force parameter (supporting GTC, IOC, FOK) to prevent unintended validations during volatile spikes.

Responses are returned in JSON format with a standard wrapper containing a success boolean, an error_code (if applicable), and a data object.