VIREXAN

Engineering Case Studies

A look under the hood at how we solve complex infrastructure, latency, and scalability challenges for proprietary trading firms.

CASE STUDY 01

Migrating Pine Script to Asyncio Python for Sub-Millisecond Execution

Client Profile Proprietary Crypto Fund
Tech Stack Python, Asyncio, Pandas, AWS EC2
Exchange Binance Futures

The Challenge

The client was running a highly profitable multi-timeframe mean reversion strategy entirely on TradingView. As their AUM scaled, they hit a wall: TradingView's webhook alerts were introducing 2-3 seconds of lag during peak volatility. By the time their local webhook-catcher processed the JSON and fired a market order to Binance, the edge was completely erased by slippage.

The Engineering Solution

We moved them completely off TradingView. First, we translated the core logic—a proprietary VWAP standard deviation channel—into a vectorized Pandas format to verify historical identicality. Then, we built the live execution engine using Python's asyncio library.

Instead of waiting for closed candles, the bot ingests the raw Binance WebSocket tick stream in real-time. We implemented an asynchronous worker queue that calculates the indicator values on the fly without blocking the WebSocket listener. When the tick crosses the threshold, the bot fires a signed REST request immediately.

The Result

Total execution latency dropped from ~2,500ms down to ~45ms. By eliminating TradingView from the loop and deploying the bot on an AWS EC2 instance physically located in Tokyo (near Binance servers), the client recovered their lost slippage and increased their Sharpe ratio by 0.6.

CASE STUDY 02

MT5 Manager API Integration for Real-Time Equity Tracking

Client Profile Family Office
Tech Stack C++, Python FastAPI, React
Platform MetaTrader 5

The Challenge

A family office was allocating capital across 50+ individual MT5 accounts managed by independent traders. They needed a centralized way to monitor live equity, floating PnL, and open positions across all accounts. Polling the accounts via standard MQL5 Expert Advisors proved unstable and resource-heavy, frequently crashing their terminal instances.

The Engineering Solution

We bypassed the client terminal entirely. Using the MT5 Manager API (C++), we built a backend microservice that connects directly to the broker's MT5 Server. This service subscribes to account updates and pushes state changes into a Redis cache.

We then wrapped this architecture in a Python FastAPI layer, exposing WebSocket endpoints to a custom React frontend. The dashboard features a hard "Kill Switch" that sends a liquidation command via the Manager API to flatten any account that breaches a predefined daily drawdown limit.

The Result

The client gained a secure, zero-refresh command center capable of tracking and managing risk across their entire portfolio. The system runs completely headless, eliminating the need to maintain 50 separate MT5 terminal instances on a VPS.