Broker sessions expire daily
Automated token lifecycle management with forced paper mode until the trader reconnects via OAuth.
Case study
Algorithmic F&O Trading Platform
mynrobo.com
Product preview
Architected MYN Robo — a multi-broker algorithmic F&O platform for Indian markets. Split worker architecture handles market feed, strategy signals, and broker execution independently. Redis powers live tick caching and async command routing. MongoDB stores users, strategy maps, trades, and orders. A unified broker adapter layer connects Master Trust, Fyers, Alice Blue, and Flattrade behind a single order gateway with live WebSocket P&L for traders and a full admin console.
Problem & goal
Retail and prop-style traders need automated index-option and commodity-future strategies across multiple brokers — with centralized risk controls, live P&L, and operations tooling — without building separate integrations per broker or running fragile single-process bots.
MYN Robo delivers production-grade algo strategies, maps subscribers to live settings, executes orders on Master Trust, Fyers, Alice Blue, and Flattrade, and gives admins full control over market data, holidays, subscriptions, and platform safeguards.
Target users
Traders & clients — connect broker accounts, view live trades and history, manage paper vs live mode
Admins & super admins — strategy settings, user mapping, market feed, holidays, client lifecycle
Operations — market-open runbooks, worker health checks, and incident response
Core capabilities
Secure login with email verification, role-based permissions, and admin tooling for client lifecycle management.
Multi-broker OAuth connections, daily session lifecycle, and paper vs live trading modes per account.
Live feed integration, instrument sync, and centralized market configuration for NSE, BSE, and MCX.
Pluggable strategies for index options (MYN_OPT, MYN_OPT_FULL_DAY) and MCX futures (MYN_FUT).
Single order gateway with duplicate-order prevention and fill reconciliation across brokers.
Map master strategy settings to many users with independent lot scaling and premium overrides.
Live WebSocket streams for LTP, open-position P&L, and admin strategy monitoring.
Plan management, active subscription gating, audit logging, and operational dashboards.
High-level design
The platform separates the Next.js frontend (trader dashboard, admin console, OAuth flows) from a stateless FastAPI backend that handles REST APIs, WebSocket hubs, RBAC, and health checks. MongoDB stores users, strategies, orders, maps, and audit data. Redis powers LTP caching, pub/sub fan-out, idempotency, and the trade command bus.
Dedicated worker processes handle market feed ingestion, strategy signal generation, and broker order execution — so API restarts never interrupt live trading. A broker adapter layer unifies Master Trust, Fyers, Alice Blue, and Flattrade behind a single order gateway. Role-based admin controls and encrypted broker credential storage protect sensitive operations.
Production stack
Strategies & risk
Per-trade and per-day stop-loss and target limits, entry fill reconciliation, unfilled entry timeouts, and automatic session square-off.
Admin start, stop, and halt controls plus manual entry and exit APIs for operational override.
Unified adapter layer
Master Trust, Fyers, Alice Blue, and Flattrade connected through a shared broker client interface and single order gateway.
OAuth onboarding, order placement and cancellation, fill status polling, position queries, and symbol resolution from a unified instrument catalog.
Explicit paper-mode fallback with reason codes for safe testing before live execution.
Live data pipeline
Market ticks flow from the feed worker into an in-memory cache and pub/sub layer, then through the API WebSocket hub to connected clients. Traders receive live trade snapshots, tick-driven P&L updates, and closed-trade notifications. Stale tick detection and throttled fan-out keep the UI responsive during high-volume sessions. Admin streams provide live strategy runtime and trade monitoring.
Scaled strategy execution
Each master strategy setting fans out to mapped subscribers — per user, per broker account, with independent lot scaling and premium overrides. Signal waves create one trade and one broker order per mapped client, with per-user day limits and safeguards against duplicate entries on shared settings.
Challenges solved
Automated token lifecycle management with forced paper mode until the trader reconnects via OAuth.
Split worker architecture — feed, strategy, and execution processes run independently of the API.
In-memory LTP cache with pub/sub decoupling and throttled WebSocket fan-out to clients.
Duplicate-order prevention and quantity-aware exit keys at the order gateway.
Per-account safeguards that halt only the affected account, not the entire strategy.
Holiday calendar integration with trading-day-aware worker scheduling.
Automated rollover workflow — force-exit expiring futures and sync next-month instruments.
Built for production load
In-memory LTP cache avoids REST polling on every tick
Pub/sub decouples feed workers from the API WebSocket hub
Throttled partial updates reduce client render load
Async command bus decouples signal workers from broker execution
Stateless API supports horizontal scaling behind a reverse proxy
Split strategy workers allow independent load per product line
Paginated admin lists and metrics for operational visibility
Operations
The platform runs in Docker containers — database, cache, API, workers, frontend, and reverse proxy — with automated TLS and Asia/Kolkata timezone across all services. Scheduled trading-day automation starts workers on market days and skips weekends and exchange holidays. Structured logging, health endpoints, and optional error monitoring support production operations.
Roadmap
Self-serve subscription payments
Push and SMS alerts on SL, target, and session square-off
Historical backtesting on candle data
Strategy marketplace for third-party algos
Portfolio analytics across accounts and strategies
Additional broker integrations via the same adapter interface