Seeking Feedback on Broker-Agnostic Trading Engine Design
Asked by
murmur3
I'm in the process of designing a broker-agnostic trading engine aimed at separating the strategy logic from broker-specific APIs. My current approach includes having an adapter layer for each broker to normalize orders and balances, a consistent internal data model, and a flexible execution pipeline that's independent of strategy logic. I'm grappling with several challenges, such as ensuring consistent execution behavior across brokers, reliably managing order states and reconciliation, preventing configuration drift from impacting runtime behavior, and ensuring that backtests mirror live executions accurately. I'm looking for insights on common failure points in execution systems, suggestions for improving adapter layer structures, and any pitfalls that might occur in real-world situations.
Answers
You've already highlighted significant failure points in your challenges section. Not addressing these could lead to common pitfalls. Additionally, look into fill information for various order types, managing orders (like front-running and opposing orders), and issues specific to derivatives and OTC products. A major point of failure is designing a system that can withstand user errors โ for instance, people might not always follow the correct sequence of operations. Your system needs to handle such scenarios smoothly to avoid breaking the data interaction.
Reply to this answer
Your design has a solid foundation, particularly with the broker adapter layer and a canonical internal data model. To maintain consistency among brokers, implementing a robust testing framework that simulates various broker behaviors can be helpful. For order state management, think about incorporating a state machine to manage intricate transitions. Containerization might also help avoid configuration drift, and it's vital to use the same execution pipeline for backtesting to ensure accuracy. Real-world conditions inevitably reveal flaws that testing might miss, so thorough stress testing and monitoring are essential.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions