Drawdown

Trading financier en Python

Chelsea Yang

Data Science Instructor

Qu'est-ce qu'un drawdown ?

Un drawdown est la baisse du pic au creux sur une période donnée pour un actif ou un compte de trading.

Graphique de drawdown

Trading financier en Python

Max drawdown

$\text{Max Drawdown} = (V_p - V_l)/ V_l $

$V_p$ : Valeur au pic avant la plus forte chute

$V_l$ : Valeur la plus basse avant un nouveau plus haut

Exemple de max drawdown

Max drawdown

= (valeur au point A - valeur au point D)/valeur au point A = (1700 - 800)/1700 = 53 %

Trading financier en Python

Obtenir les drawdowns depuis les stats du backtest

resInfo = bt_result.stats

# Get the max drawdown max_drawdown = resInfo.loc['max_drawdown'] print('Maximum drawdown: %.2f'% max_drawdown)
# Get the average drawdown avg_drawdown = resInfo.loc['avg_drawdown'] print('Average drawdown: %.2f'% avg_drawdown)
# Get the average drawdown days avg_drawdown_days = resInfo.loc['avg_drawdown_days'] print('Average drawdown days: %.0f'% avg_drawdown_days)
Maximum drawdown: -0.59
Average drawdown: -0.11
Average drawdown days: 22
Trading financier en Python

Le ratio de Calmar

CALMAR : CALifornia Managed Accounts Report

$ Calmar = CAGR / \text{Max Drawdown} $

  • Plus le ratio de Calmar est élevé, meilleure est la performance ajustée du risque.
  • En général, un ratio de Calmar supérieur à 3 est excellent.
Trading financier en Python

Calculer manuellement le ratio de Calmar

resInfo = bt_result.stats
# Get the CAGR
cagr = resInfo.loc['cagr']
# Get the max drawdown
max_drawdown = resInfo.loc['max_drawdown']

# Calculate Calmar ratio mannually calmar_calc = cagr / max_drawdown * (-1) print('Calmar Ratio calculated: %.2f'% calmar_calc)
Calmar Ratio calculated: 4.14
Trading financier en Python

Obtenir le ratio de Calmar depuis les stats du backtest

resInfo = bt_result.stats

# Get the Calmar ratio
calmar = resInfo.loc['calmar']
print('Calmar Ratio: %.2f'% calmar)
Calmar Ratio: 4.14
Trading financier en Python

Passons à la pratique !

Trading financier en Python

Preparing Video For Download...