Backtesting Frameworks
Subject: Stock-Market | Chapter: 6.2 Backtesting Frameworks Level: 1 — Recognition Time Limit: 20 minutes Total Marks: 40
Section A — Multiple Choice (1 mark each, 10 marks)
Choose the single best answer.
Q1. Survivorship bias in a backtest occurs when the dataset:
- A) Includes too many small-cap stocks
- B) Excludes companies that were delisted or went bankrupt
- C) Contains duplicate price entries
- D) Uses daily instead of intraday data
Q2. Look-ahead bias is best described as:
- A) Using information in a decision that would not have been available at that point in time
- B) Testing a strategy only on future data
- C) Assuming zero transaction costs
- D) Trading too frequently
Q3. CAGR stands for:
- A) Compound Average Growth Rate
- B) Compound Annual Growth Rate
- C) Cumulative Annual Gross Return
- D) Continuous Average Gross Return
Q4. Which Python library is a dedicated event-driven backtesting framework?
- A) NumPy
- B) Matplotlib
- C) Backtrader
- D) Requests
Q5. Slippage refers to:
- A) The commission charged by a broker
- B) The difference between expected execution price and actual fill price
- C) The tax on capital gains
- D) The bid-ask spread only
Q6. Out-of-sample testing is used primarily to:
- A) Speed up computation
- B) Detect overfitting by validating on unseen data
- C) Reduce transaction costs
- D) Increase the number of trades
Q7. Maximum drawdown measures:
- A) The largest single-day loss
- B) The largest peak-to-trough decline in portfolio value
- C) The total number of losing trades
- D) The average return per trade
Q8. Paper trading is best defined as:
- A) Trading only in low-liquidity stocks
- B) Simulated live trading with no real capital at risk
- C) Backtesting on historical data
- D) Trading using printed order forms
Q9. Monte Carlo simulation in backtesting is mainly used to:
- A) Guarantee future returns
- B) Assess the range/distribution of possible outcomes via randomization
- C) Remove survivorship bias
- D) Source clean historical data
Q10. Clean historical data should ideally be:
- A) Adjusted for splits and dividends, and free of gaps/errors
- B) Only closing prices with no volume
- C) Rounded to whole numbers
- D) Limited to one year
Section B — Matching (1 mark each, 8 marks)
Q11–Q18. Match each term in Column X to its correct description in Column Y. Write the letter.
| # | Column X |
|---|---|
| Q11 | Survivorship bias |
| Q12 | Look-ahead bias |
| Q13 | Slippage |
| Q14 | Transaction cost |
| Q15 | In-sample data |
| Q16 | Max drawdown |
| Q17 | CAGR |
| Q18 | Paper trading |
| Letter | Column Y |
|---|---|
| A | Commissions/fees deducted per trade |
| B | Data used to build/optimize the strategy |
| C | Simulated real-time trading with no real money |
| D | Excluding failed firms from the dataset |
| E | Peak-to-trough portfolio decline |
| F | Using future data unavailable at decision time |
| G | Annualized smoothed rate of return |
| H | Gap between expected and actual fill price |
Section C — True/False with Justification (2 marks each, 22 marks)
State True or False (1 mark) and give a one-line justification (1 mark).
Q19. Ignoring transaction costs makes a backtest look more profitable than it would be in reality.
Q20. Survivorship bias tends to understate a strategy's historical returns.
Q21. Using the closing price of a day to trigger a trade executed at that same day's open is a form of look-ahead bias.
Q22. A strategy that performs well in-sample is guaranteed to perform well out-of-sample.
Q23. Higher slippage assumptions make a backtest more conservative.
Q24. Max drawdown of 40% means the portfolio lost 40% of its value from a peak before recovering.
Q25. Monte Carlo simulation can prove exactly what a strategy will return next year.
Q26. pandas can be used to compute returns and drawdowns but is not itself an event-driven backtest engine.
Q27. Paper trading eliminates all differences between simulated and live performance.
Q28. A CAGR of 10% over 3 years means the investment grew by a total of exactly 30%.
Q29. Dividend and split adjustments are part of preparing clean historical data.
Answer keyMark scheme & solutions
Section A (1 mark each)
| Q | Ans | Why |
|---|---|---|
| Q1 | B | Survivorship bias = dropping delisted/bankrupt firms, inflating returns. |
| Q2 | A | Look-ahead = using info not yet available at decision time. |
| Q3 | B | Compound Annual Growth Rate. |
| Q4 | C | Backtrader is a dedicated event-driven backtesting library. |
| Q5 | B | Slippage = expected vs actual fill price difference. |
| Q6 | B | OOS testing validates on unseen data to catch overfitting. |
| Q7 | B | Max DD = largest peak-to-trough decline. |
| Q8 | B | Paper trading = simulated live trading, no real capital. |
| Q9 | B | Monte Carlo produces a distribution of possible outcomes. |
| Q10 | A | Clean data is split/dividend adjusted and gap/error free. |
Section B (1 mark each)
| Q | Ans | Q | Ans |
|---|---|---|---|
| Q11 | D | Q15 | B |
| Q12 | F | Q16 | E |
| Q13 | H | Q17 | G |
| Q14 | A | Q18 | C |
Section C (1 mark T/F + 1 mark justification)
Q19. True — Real costs reduce net returns; ignoring them overstates profit.
Q20. False — Survivorship bias overstates returns because only successful firms remain.
Q21. True — At the open you cannot yet know that day's close; using it is look-ahead bias.
Q22. False — In-sample success may be overfitting; OOS is required to confirm.
Q23. True — Larger slippage lowers modeled fills/returns, making results more conservative/realistic.
Q24. True — 40% drawdown = 40% drop from a prior peak. (Note: recovery is not required for a drawdown to count, but the statement remains true.)
Q25. False — Monte Carlo gives probabilistic ranges, not exact predictions.
Q26. True — pandas is a data/analytics library; engines like backtrader/zipline handle event-driven simulation.
Q27. False — Paper trading omits real slippage, liquidity, psychology, latency differences.
Q28. False — 10% CAGR over 3 years compounds to , not 30%.
Q29. True — Adjusting for corporate actions is a core data-cleaning step.
Worked calculation for Q28
So it is not exactly 30% — statement is False.
CAGR reference (for context)
[
{"claim":"Q28: 10% CAGR over 3 years gives ~33.1% total, not 30%","code":"total = (1 + Rational(1,10))**3 - 1; result = (total == Rational(331,1000)) and (total != Rational(3,10))"},
{"claim":"Q24: a 40% drawdown corresponds to multiplier 0.6","code":"peak = 100; trough = peak*(1 - Rational(40,100)); result = (trough == 60)"},
{"claim":"CAGR formula: doubling in 2 years => ~41.4% CAGR","code":"cagr = (Integer(2))**(Rational(1,2)) - 1; result = simplify(cagr - (sqrt(2)-1)) == 0"}
]