LoslegenKostenlos loslegen

Review performance with drawdowns

You implemented a signal-based strategy using two moving average indicators. You performed a backtest using the Tesla stock historical price data from 2019 to 2020, and the result plot is shown on the right. Now you would like to evaluate the strategy performance, specifically the downside volatility, by reviewing the drawdown result from the backtest.

The bt backtest result has been provided in bt_result and is ready to use.

Diese Übung ist Teil des Kurses

Financial Trading in Python

Kurs anzeigen

Anleitung zur Übung

  • Obtain all backtest stats from bt_result and save them in resInfo.
  • Get the average drawdown from resInfo.
  • Get the average drawdown days from resInfo.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Obtain all backtest stats
resInfo = ____

# Get the average drawdown
avg_drawdown = ____
print('Average drawdown: %.2f'% avg_drawdown)

# Get the average drawdown days
avg_drawdown_days = ____
print('Average drawdown days: %.0f'% avg_drawdown_days)
Code bearbeiten und ausführen