Trading Script

Trading Automation capturing the spread

Project Description

TradeMation is a desktop platform I built to research, simulate, and execute automated equity strategies with real-time feedback and rigorous order lifecycle control. The core purpose was to automate the standard trading workflow I previously performed manually in Thinkorswim (Schwab), especially the continuous process of monitoring stocks for profitability and acting on opportunities without manual intervention. I translated the human loop of scanning, evaluating, and executing into a reliable system that tracks profitability signals and manages orders end to end.

I architected the system as a modular Electron application with a Node.js backend. Multiple trading engines (streamlined, high-performance, and large-order) plug into a shared data layer and task queue so strategies can coordinate quotes, positions, and orders cleanly. A live debugging dashboard surfaces market data, trading groups, positions, and order events, enabling swift strategy iteration and safe tuning in real time.

A major focus was correctness and recovery. I implemented order tracking and replacement flows with strict API compliance to handle edge cases like rate limits, transient 400s, and replacement conflicts. Centralized structured logging and a trading session monitor provide comprehensive visibility, while defensive validations and backoffs keep strategies compliant without sacrificing execution speed.

The hardest challenges included making order replacement reliable under concurrency, building a rate-aware request layer that prevents lockups while minimizing latency, and maintaining state consistency between quotes, positions, and orders across multiple engines. I solved these with deterministic replacement tracking and callbacks, selective retry and pacing tuned to Schwab constraints, and a central market-data manager that continuously reconciles session state.

The result is an automated version of the Thinkorswim-style workflow that improves fill reliability on complex order flows, reduces wasted API calls, and shortens debug and iteration cycles through live introspection and consolidated telemetry. The stack combines Electron and HTML/CSS/JS for the desktop UI, Node.js services for strategy and orchestration, and a direct Schwab API integration reinforced by robust observability and session control