About this question

Vectorized Backtest Engine

Medium · backtesting · Quant Researcher interview question · pandas, numpy, finance, vectorization

Backtesting simulates a trading strategy using historical data to evaluate potential risk and profitability before capital deployment. A critical requirement for any backtest is the elimination of look-ahead bias, ensuring that strategy decisions at any given time rely solely on data available up to that moment. Task Implement a function solution(prices, signal) that calculates the performance metrics of a trading strategy based on a series of asset prices and trading signals. The function must