GoQuant Real-Time Trade Simulator with Live OKX Order Book Data

Β·

⚑ Overview

The GoQuant Real-Time Trade Simulator is a Python-based platform that simulates live trading scenarios using OKX's Level 2 (L2) order book data. Designed for quant traders and developers, it predicts execution costs (slippage, fees, market impact), analyzes maker/taker behavior, and measures internal latencyβ€”all integrated into an interactive Streamlit UI for actionable insights.


πŸ“ˆ Core Features

βœ… Live Order Book Processing

πŸ” Execution Cost Predictions

  1. Slippage Estimation

    • Uses Quantile Regression (50th percentile) with inputs:

      • Spread
      • USD Amount
      • Order Book Depth
    • Output: Median slippage in basis points (bps).
  2. Fee Calculation

    • Rule-based model for maker/taker fees (e.g., Tier 1: 0.02%/0.06%).
  3. Market Impact Modeling

    • Almgren-Chriss Optimal Execution with dynamic programming:

      • Temporary Impact: ( \eta \cdot v^\alpha )
      • Permanent Impact: ( \gamma \cdot v^\beta )
      • Execution Risk: Volatility + inventory/time horizon.
  4. Net Execution Cost
    [
    \text{Net Cost} = \text{Slippage} + \text{Fees} + \text{Market Impact}
    ]
  5. Maker/Taker Classification

    • Logistic Regression trained on real-time data (100% accuracy).
  6. Latency Profiling

    • Tracks processing time per tick via time.perf_counter().

🧠 Machine Learning Models

πŸ“Œ Quantile Regression (Slippage)

πŸ“Œ Logistic Regression (Maker/Taker)


πŸ–₯️ Streamlit UI

πŸ‘‰ Explore the live demo


βš™οΈ Optimizations


πŸ“¦ Setup

pip install -r requirements.txt  
streamlit run ui_app.py  

❓ FAQ

Q: How accurate are the slippage predictions?
A: The quantile regression model achieves an RΒ² of 0.798, reflecting realistic median execution costs.

Q: Can I test different fee tiers?
A: Yes! The UI supports customizable fee structures.

Q: Is historical data available?
A: Currently, the tool processes live data only.

πŸ‘‰ Learn more about OKX WebSocket APIs