SPL quantitative practice series: backtesting routine
One essential step in quantitative trading is backtesting. Any strategy needs to be validated with historical data before it can be used for paper trading or even real trading. This article will introduce how to conduct backtesting in SPL. Without further ado, let’s get straight to the point. Suppose we have the following trade data generated according to a certain strategy: In this table, ‘ts_code’ refers to the stock code; ‘trade_date’ refers to the trade date; ‘shares’ refers to the number of shares traded, and ‘flag’ refers to the trade flag (1 denotes buy, -1 denotes sell). Now we need
...