Overview
A real-time trading automation system that mirrors positions from MetaTrader 5 to Pocket Option — enabling signal providers to broadcast trades to subscribers.
Architecture
MT5 Terminal
└─► Python MT5 Connector
└─► RabbitMQ (signal exchange)
└─► Node.js Consumer
└─► Pocket Option WebSocket API
How it works
- The Python connector connects to the MT5 terminal via the
MetaTrader5library and polls for new/closed positions on a 1-second interval. - Position changes are published to a RabbitMQ exchange as typed events (
POSITION_OPENED,POSITION_MODIFIED,POSITION_CLOSED). - The Node.js consumer subscribes to the exchange and maps MT5 trade parameters to Pocket Option equivalents.
- Trades are executed via the Pocket Option WebSocket API with latency typically under 200ms.
Key Challenges
- Handling WebSocket reconnection and session re-auth on Pocket Option's API
- Maintaining monotonic order of events under high throughput
- Mapping MT5 lot sizes to PO trade amounts with configurable ratios