Optimize Python Trading Bot

Замовник: AI | Опубліковано: 11.02.2026

I have a live-trading bot written entirely in Python that connects to the Capital.com platform through their REST and WebSocket APIs. The strategy logic itself is sound, but under load the bot slows, misses price ticks and occasionally skips orders, so I need a clean performance tune-up and code review. Your task is to comb through the existing modules—order manager, data streamer, and strategy loop—identify the bottlenecks, then fix or refactor as needed so the bot reacts in real time without dropping trades. Expect to work with async I/O, websockets, pandas dataframes and a small SQLite trade log. Deliverables • Refactored, well-commented Python code with any slow sections profiled and optimised • A brief report that explains each change, shows before/after latency benchmarks, and lists test results on both sandbox and live endpoints • Updated requirements.txt and a one-command setup script so I can spin the bot up on a fresh VPS Acceptance criteria: average tick-to-order latency under 200 ms during a 30-minute live session, zero missed ticks in the log, and successful execution of all unit tests. If you have experience squeezing extra speed out of trading code—especially on Capital.com or similar exchange APIs—this should be a straightforward engagement.