Paper trading runs the strategy in real time on a demo account, with no money at stake. It reveals what the backtest does not show: latency, refused orders, real execution prices, connection drops.
Backtrader connects to some brokers through stores, for example bt.stores.IBStore for Interactive Brokers: you plug the store’s feed and broker into Cerebro, and the same strategy runs on live data.
Live, notify_data(self, data, status, *args, **kwargs) reports the state of the feed: data.LIVE when data arrives in real time, data.DELAYED while history is being backfilled, or a disconnection. Only send orders when the feed is truly live.
Set the duration and criteria in advance: several months, enough trades (often several dozen) and an acceptable gap with the backtest. Meanwhile you watch and take notes, without changing the rules.
Examples
UPSILON-X (fictional market) : Left of the line, the past tested by the backtest; right of it, the future that paper trading lets you live through without risking money. You then compare the two: number of trades, prices obtained, performance.
1 August 2012: the Knight Capital accident : That morning, a badly deployed Knight Capital trading program sent millions of unintended orders to US markets. In about 45 minutes the firm lost roughly 440 million dollars; it had to be rescued and was later taken over. Testing a system in real conditions without money, then at small size, is meant to avoid this kind of accident.
Key terms
Paper trading
Simulated real-time trading on a demo account
Store
Backtrader connector to a broker or a live data source
Latency
Delay between the signal and the actual execution of the order
Slippage
Gap between the expected price and the price obtained