Below is a Detailed Product Requirements Document (PRD) for building the Position Tracker microservice in TypeScript (Node.js). The document covers system architecture, data flows, error handling, logging, and code samples separated into core modules for clarity. Each section is numbered and includes steps, edge cases, and instructions to add error checks, comments, and logging.
The Position Tracker is a standalone microservice that:
- Connects to the Tradovate WebSocket API for real-time market data and order updates.
- Processes updates and maintains trading positions (market, limit, and stop orders) with risk management (stop-loss, take-profit).