Designing a Live-Data Paper Trading System with Order Matching
Summary
The document describes PaperTrader, a proposed simulation layer that uses live exchange market data to test strategy behavior between historical backtests and funded trading. Its design combines a PaperTrader account object, a background matching engine, and a local database for completed or canceled orders. The engine reads order book depth, checks whether resting orders can trade, updates fill quantities and average prices, applies maker or taker fees, and manages frozen assets and order status.
The design aims to preserve familiar exchange interfaces so a strategy can use the simulator with minimal changes. A code example and a demonstration outline illustrate the approach, but the text does not provide quantitative validation. The author characterizes the implementation as preliminary: spot support is more complete, while futures support remains unfinished. Floating-point errors, edge cases, delivery contracts, and liquidation behavior are identified as areas needing further work.
Key ideas
- The simulator uses live exchange prices and order book depth to drive simulated fills.
- The matching engine models order states, asset freezes, cancellations, average fill prices, and fees.
- An interface modeled on exchange APIs is intended to let existing strategies run with few changes.
- The proposed system is preliminary and has more complete spot support than futures support.
- The document identifies floating-point precision, edge cases, and liquidation modeling as unresolved concerns.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.