The engineering behind the edge
A trading algorithm is software, and it fails the way software fails — through bugs, bad state and untested edge cases, except here the bugs cost money. These pages cover the engineering practices that separate a robust system from a fragile script: language choices, structuring strategy code, configuration, logging, testing, version control and continuous integration.
Programming: Programming for algorithmic trading is applied software engineering: expressing strategy logic clearly (often in Python for research and JavaScript/Python for execution), choosing the right data structures, structuring code into testable strategy classes, externalising settings into configuration files, logging everything for auditability, writing tests to catch regressions, using version control to track every change, and automating checks with CI/CD. Discipline here prevents the silent bugs that quietly lose money.
Python for Trading
LanguagePython is the most widely used language for trading research and most retail execution because its data libraries (pandas, NumPy), readable syntax an…
JavaScript for Trading
LanguageJavaScript, running server-side on Node.js, suits event-driven trading execution and tooling because its single-threaded non-blocking event loop hand…
Data Structures for Trading
FundamentalsChoosing the right data structure, contiguous arrays and DataFrames for research, ring buffers for bounded streaming windows, hash maps for order boo…
Strategy Classes
Code structureA strategy class encapsulates one trading strategy as an object with well-defined lifecycle methods (such as on_data, on_signal and on_fill) and its …
Configuration Files
PracticeConfiguration files externalise a trading system's parameters, credentials and environment settings out of the code, so the same tested code can run …
Logging in Code
PracticeLogging is the practice of emitting a durable, timestamped, structured record of what a trading program does and decides, using severity levels and c…
Testing
PracticeTesting in trading is the practice of verifying, with automated unit, integration, deterministic-replay and property tests, that strategy logic, risk…
Version Control
PracticeVersion control (in practice, Git) records every change to a trading codebase as a history of commits, letting you know exactly what code was running…
CI/CD Concepts
PracticeCI/CD is the practice of automatically building, testing and linting a trading codebase on every commit (continuous integration) and delivering it to…