计算收益最大回撤的思想和代码

Posted 寻自己

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了计算收益最大回撤的思想和代码相关的知识,希望对你有一定的参考价值。

在财务风险指标中,最大回撤是一个很重要的指标。

自己在计算最大回撤时,最开始是网上想找一些成熟的解决方案。

但是最后发现,要不是代码不通用,要不就是性能不好,还有一些本来就是错误的。

所以最后只能理解最大回撤的算法思路,再写出代码,最后再优化性能了!

 

例子:

初始资金是1块钱的话,资金连续一周的变化如下:

周一:1.01

周二:1.02

周三:0.98

周四:1.0

周五:0.97

那么我们要计算的样本为:[1, 1.01, 1.02, 0.98, 1.0, 0.97]

如果计算截至到周二的最大回撤,那么我们要拿到周二的值:1.02,再拿周二之前最大的值,即,周一的1.01,再计算回撤:(1.02/1.01-1)*100=0.99%,这时间 0.99% >0 ,所以是不存在回撤的。

如果计算截至到周三的最大回撤,那么我们要拿到周三的值:0.98,再拿周三之前最大的值,即,周二的1.02,再计算回撤:(0.98/1.02-1)*100=-3.9215%,这时间 -3.9215% < 0 ,所以是存在回撤的。

如果计算截至到周五的最大回撤,那么我们要拿到周五的值:0.97,再拿周五之前最大的值,即,周二的1.02,再计算回撤:(0.97/1.02-1)*100=-4.9019%,这时间 -4.9019% < 0 ,所以是存在回撤的。

这时间再比较 Min(-4.9019%, -3.9215%),得出最大回撤为 -4.9019%。

 

用Python 代码来实现:

returns = [1.0, 1.01, 1.05, 1.1, 1.11, 1.07, 1.03, 1.03, 1.01, 1.02, 1.04, 1.05, 1.07, 1.06, 1.05, 1.06, 1.07, 1.09, 1.12, 1.18, 1.15, 1.15, 1.18, 1.16, 1.19, 1.17, 1.17, 1.18, 1.19, 1.23, 1.24, 1.25, 1.24, 1.25, 1.24, 1.25, 1.24, 1.25, 1.24, 1.27, 1.23, 1.22, 1.18, 1.2, 1.22, 1.25, 1.25, 1.27, 1.26, 1.31, 1.32, 1.31, 1.33, 1.33, 1.36, 1.33, 1.35, 1.38, 1.4, 1.42, 1.45, 1.43, 1.46, 1.48, 1.52, 1.53, 1.52, 1.55, 1.54, 1.53, 1.55, 1.54, 1.52, 1.53, 1.53, 1.5, 1.45, 1.43, 1.42, 1.41, 1.43, 1.42, 1.45, 1.45, 1.49, 1.49, 1.51, 1.54, 1.53, 1.56, 1.52, 1.53, 1.58, 1.58, 1.58, 1.61, 1.63, 1.61, 1.59, 1.58, 1.6, 1.6, 1.61, 1.61, 1.62, 1.6, 1.61, 1.61, 1.62, 1.64, 1.64, 1.67, 1.66, 1.67, 1.66, 1.67, 1.68, 1.68, 1.7, 1.72, 1.73, 1.73, 1.74, 1.76, 1.75, 1.75, 1.75, 1.73, 1.73, 1.73, 1.73, 1.75, 1.74, 1.74, 1.74, 1.75, 1.75, 1.74, 1.74, 1.74, 1.76, 1.78, 1.81, 1.79, 1.81, 1.8, 1.79, 1.8, 1.8, 1.82, 1.8, 1.8, 1.81, 1.82, 1.82, 1.83, 1.81, 1.78, 1.76, 1.75, 1.72, 1.68, 1.69, 1.69, 1.7, 1.71, 1.71, 1.71, 1.71, 1.68, 1.64, 1.65, 1.65, 1.63, 1.62, 1.63, 1.65, 1.62, 1.64, 1.64, 1.67, 1.66, 1.64, 1.63, 1.63, 1.63, 1.65, 1.65, 1.67, 1.68, 1.68, 1.71, 1.69, 1.69, 1.7, 1.68, 1.7, 1.7, 1.7, 1.7, 1.71, 1.72, 1.74, 1.76, 1.79, 1.81, 1.81, 1.82, 1.83, 1.85, 1.84, 1.85, 1.86, 1.82, 1.84, 1.86, 1.85, 1.84, 1.85, 1.86, 1.87, 1.85, 1.84, 1.84, 1.82, 1.84, 1.83, 1.82, 1.82, 1.83, 1.82, 1.85, 1.85, 1.84, 1.83, 1.84, 1.84, 1.84, 1.87, 1.88, 1.9, 1.9, 1.91, 1.89, 1.9, 1.92, 1.92, 1.91, 1.85, 1.87, 1.87, 1.87, 1.89, 1.86, 1.85, 1.85, 1.81, 1.83, 1.83, 1.83, 1.84, 1.83, 1.83, 1.83, 1.82, 1.75, 1.74, 1.77, 1.8, 1.81, 1.81, 1.82, 1.83, 1.84, 1.84, 1.84, 1.87, 1.89, 1.9, 1.88, 1.89, 1.9, 1.89, 1.91, 1.91, 1.94, 1.96, 1.93, 1.95, 1.98, 1.97, 1.96, 1.97, 1.98, 1.97, 1.93, 1.94, 1.95, 1.93, 1.93, 1.93, 1.95, 1.95, 1.98, 2.0, 1.98, 1.97, 1.95, 1.94, 1.94, 1.92, 1.9, 1.91, 1.91, 1.92, 1.93, 1.94, 1.93, 1.93, 1.94, 1.95, 1.95, 1.95, 1.96, 1.96, 1.95, 1.94, 1.93, 1.89, 1.87, 1.9, 1.89, 1.89, 1.88, 1.88, 1.89, 1.89, 1.89, 1.89, 1.89, 1.9, 1.88, 1.88, 1.84, 1.85, 1.84, 1.86, 1.87, 1.88, 1.88, 1.87, 1.87, 1.87, 1.85, 1.85, 1.85, 1.84, 1.83, 1.82, 1.83, 1.82, 1.81, 1.81, 1.78, 1.78, 1.78, 1.78, 1.8, 1.78, 1.75, 1.73, 1.71, 1.69, 1.63, 1.61, 1.64, 1.61, 1.61, 1.54, 1.54, 1.54, 1.58, 1.63, 1.64, 1.61, 1.6, 1.58, 1.58, 1.58, 1.58, 1.55, 1.55, 1.53, 1.48, 1.49, 1.5, 1.49, 1.48, 1.46, 1.51, 1.51, 1.5, 1.45, 1.49, 1.5, 1.49, 1.48, 1.45, 1.43, 1.44, 1.45, 1.44, 1.44, 1.43, 1.43, 1.4, 1.39, 1.39, 1.36, 1.38, 1.34, 1.31, 1.34, 1.34, 1.31, 1.3, 1.28, 1.26, 1.24, 1.34, 1.38, 1.34, 1.34, 1.36, 1.34, 1.36, 1.37, 1.36, 1.35, 1.35, 1.27, 1.25, 1.27, 1.27, 1.26, 1.27, 1.27, 1.29, 1.31, 1.35, 1.36, 1.38, 1.4, 1.39, 1.41, 1.42, 1.42, 1.44, 1.45, 1.45, 1.43, 1.45, 1.45, 1.45, 1.42, 1.41, 1.39, 1.37, 1.35, 1.37, 1.35, 1.31, 1.32, 1.3, 1.31, 1.33, 1.31, 1.31, 1.3, 1.28, 1.26, 1.25, 1.23, 1.21, 1.2, 1.14, 1.14, 1.16, 1.1, 1.11, 1.08, 1.08, 1.17, 1.18, 1.19, 1.1, 1.12, 1.12, 1.2, 1.21, 1.26, 1.26, 1.24, 1.27, 1.27, 1.29, 1.29, 1.31, 1.32, 1.29, 1.33, 1.36, 1.38, 1.42, 1.45, 1.48, 1.49, 1.44, 1.48, 1.45, 1.46, 1.48, 1.5, 1.51, 1.5, 1.5, 1.48, 1.47, 1.46, 1.42, 1.44, 1.41, 1.4, 1.44, 1.42, 1.43, 1.46, 1.48, 1.46, 1.47, 1.47, 1.46, 1.46, 1.43, 1.45, 1.45, 1.44, 1.43, 1.42, 1.46, 1.49, 1.48, 1.48, 1.48, 1.47, 1.46, 1.46, 1.44, 1.38, 1.4, 1.38, 1.44, 1.43, 1.44, 1.4, 1.41, 1.42, 1.4, 1.4, 1.39, 1.37, 1.38, 1.34, 1.4, 1.42, 1.4, 1.41, 1.4, 1.39, 1.37, 1.37, 1.4, 1.38, 1.39, 1.44, 1.54, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.54, 1.55, 1.56, 1.54, 1.52, 1.52, 1.52, 1.51, 1.51, 1.51, 1.51, 1.52, 1.51, 1.5, 1.49, 1.49, 1.49, 1.5, 1.5, 1.5, 1.5, 1.51, 1.51, 1.52, 1.53, 1.51, 1.5, 1.49, 1.5, 1.5, 1.5, 1.51, 1.5, 1.51, 1.52, 1.53, 1.52, 1.52, 1.52, 1.52, 1.52, 1.52, 1.52, 1.53, 1.52, 1.51, 1.51, 1.5, 1.5, 1.49, 1.49, 1.49, 1.48, 1.48, 1.47, 1.49, 1.48, 1.48, 1.48, 1.48, 1.46, 1.45, 1.45, 1.41, 1.4, 1.39, 1.39, 1.39, 1.41, 1.38, 1.38, 1.39, 1.42, 1.43, 1.41, 1.39, 1.37, 1.39, 1.4, 1.39, 1.39, 1.42, 1.45, 1.44, 1.45, 1.4, 1.38, 1.36, 1.35, 1.33, 1.33, 1.32, 1.33, 1.28, 1.24, 1.25, 1.26, 1.22, 1.23, 1.26, 1.27, 1.23, 1.24, 1.26, 1.25, 1.25, 1.25, 1.23, 1.23, 1.24, 1.26, 1.27, 1.28, 1.29, 1.29, 1.31, 1.3, 1.3, 1.29, 1.25, 1.25, 1.23, 1.23, 1.19, 1.18, 1.2, 1.2, 1.23, 1.25, 1.25, 1.25, 1.31, 1.32, 1.34, 1.34, 1.34, 1.31, 1.31, 1.31, 1.33, 1.35, 1.35, 1.35, 1.33, 1.35, 1.37, 1.37, 1.38, 1.38, 1.37, 1.38, 1.38, 1.36, 1.35, 1.39, 1.39, 1.39, 1.39, 1.4, 1.4, 1.39, 1.38, 1.37, 1.35, 1.35, 1.35, 1.35, 1.35, 1.34, 1.33, 1.32, 1.32, 1.33, 1.34, 1.33, 1.32, 1.35, 1.35, 1.36, 1.38, 1.39, 1.39, 1.4, 1.41, 1.4, 1.4, 1.43, 1.45, 1.49, 1.5, 1.46, 1.45, 1.45, 1.43, 1.43, 1.42, 1.39, 1.37, 1.36, 1.35, 1.36, 1.34, 1.28, 1.3, 1.35, 1.38, 1.4, 1.38, 1.37, 1.37, 1.38, 1.39, 1.41, 1.4, 1.41, 1.44, 1.45, 1.43, 1.42, 1.42, 1.41, 1.4, 1.41, 1.42, 1.42, 1.43, 1.43, 1.43, 1.42, 1.41, 1.4, 1.39, 1.4, 1.39, 1.39, 1.39, 1.38, 1.37, 1.37, 1.36, 1.36, 1.35, 1.37, 1.37, 1.38, 1.37, 1.36, 1.38, 1.38, 1.38, 1.36, 1.35, 1.36, 1.36, 1.35, 1.34, 1.34, 1.35, 1.35, 1.35, 1.35, 1.36, 1.37, 1.37, 1.38, 1.37, 1.37, 1.38, 1.37, 1.36, 1.35, 1.35, 1.35, 1.35, 1.35, 1.35, 1.33, 1.33, 1.33, 1.33, 1.33, 1.35, 1.35, 1.36, 1.36, 1.34, 1.34, 1.34, 1.34, 1.34, 1.31, 1.29, 1.3, 1.28, 1.27, 1.27, 1.28, 1.28, 1.28, 1.27, 1.25, 1.24, 1.25, 1.25, 1.25, 1.28, 1.28, 1.27, 1.27, 1.26, 1.26, 1.25, 1.26, 1.3, 1.29, 1.29, 1.26, 1.24, 1.22, 1.21, 1.21, 1.21, 1.22, 1.19, 1.13, 1.12, 1.11, 1.12, 1.11, 1.12, 1.14, 1.13, 1.12, 1.15, 1.21, 1.19, 1.24, 1.27, 1.27, 1.24, 1.26, 1.29, 1.29, 1.3, 1.3, 1.33, 1.31, 1.31, 1.31, 1.3, 1.31, 1.3, 1.29, 1.27, 1.26, 1.23, 1.26, 1.27, 1.26, 1.26, 1.26, 1.25, 1.25, 1.25, 1.25, 1.27, 1.27, 1.29, 1.31, 1.32, 1.32, 1.35, 1.35, 1.37, 1.37, 1.42, 1.4, 1.45, 1.5, 1.52, 1.54, 1.52, 1.55, 1.56, 1.58, 1.59, 1.58, 1.62, 1.63, 1.64, 1.64, 1.67, 1.64, 1.62, 1.59, 1.6, 1.62, 1.63, 1.63, 1.61, 1.61, 1.6, 1.57, 1.55, 1.59, 1.6, 1.6, 1.63, 1.64, 1.64, 1.62, 1.64, 1.66, 1.66, 1.65, 1.67, 1.67, 1.65, 1.66, 1.67, 1.68, 1.7, 1.71, 1.74, 1.75, 1.74, 1.72, 1.72, 1.71, 1.68, 1.67, 1.69, 1.68, 1.67, 1.66, 1.68, 1.66, 1.63, 1.61, 1.61, 1.59, 1.59, 1.56, 1.56, 1.59, 1.58, 1.55, 1.53, 1.58, 1.58, 1.57, 1.59, 1.57, 1.53, 1.54, 1.58, 1.57, 1.57, 1.59, 1.58, 1.56, 1.57, 1.55, 1.53, 1.52, 1.54, 1.53, 1.48, 1.51, 1.53, 1.48, 1.47, 1.49, 1.5, 1.48, 1.46, 1.44, 1.41, 1.45, 1.43, 1.49, 1.5, 1.49, 1.5, 1.48, 1.49, 1.47, 1.42, 1.41, 1.39, 1.4, 1.44, 1.45, 1.45, 1.45, 1.4, 1.41, 1.38, 1.37, 1.38, 1.41, 1.38, 1.36, 1.35, 1.38, 1.36, 1.37, 1.36, 1.36, 1.34, 1.32, 1.32, 1.3, 1.29, 1.29, 1.27, 1.27, 1.26, 1.28, 1.28, 1.27, 1.25, 1.26, 1.28, 1.27, 1.28, 1.28, 1.27, 1.27, 1.27, 1.23, 1.24, 1.19, 1.23, 1.29, 1.32, 1.37, 1.41, 1.42, 1.39, 1.42, 1.39, 1.4, 1.39, 1.37, 1.35, 1.37, 1.38, 1.37, 1.38, 1.32, 1.32, 1.34, 1.33, 1.31, 1.32, 1.34, 1.33, 1.35, 1.39, 1.38, 1.34, 1.3, 1.29, 1.32, 1.32, 1.32, 1.33, 1.34, 1.39, 1.38, 1.37, 1.4, 1.39, 1.38, 1.4, 1.41, 1.41, 1.42, 1.41, 1.4, 1.4, 1.38, 1.38, 1.39, 1.39, 1.4, 1.39, 1.37, 1.37, 1.38, 1.36, 1.36, 1.36, 1.37, 1.38, 1.37, 1.35, 1.36, 1.4, 1.37, 1.37, 1.35, 1.34, 1.35, 1.33, 1.31, 1.29, 1.3, 1.3, 1.32, 1.32, 1.33, 1.34, 1.33, 1.3, 1.28, 1.3, 1.31, 1.27, 1.3, 1.34, 1.33, 1.31, 1.3, 1.28, 1.28, 1.27, 1.32, 1.32, 1.35, 1.35, 1.36, 1.34, 1.36, 1.41, 1.42, 1.43, 1.42, 1.42, 1.43, 1.4, 1.4, 1.39, 1.39, 1.42, 1.43, 1.39, 1.39, 1.37, 1.36, 1.34, 1.33, 1.32, 1.31, 1.26, 1.27, 1.3, 1.28, 1.25, 1.23, 1.21, 1.23, 1.26, 1.22, 1.19, 1.17, 1.18, 1.22, 1.22, 1.18, 1.23, 1.23, 1.19, 1.17, 1.17, 1.13, 1.1, 1.1, 1.08, 1.1, 1.08, 1.09, 1.08, 1.05, 1.05, 1.06, 1.04, 1.04, 1.03, 1.04, 1.05, 1.05, 1.06, 1.03, 1.05, 1.04, 1.03, 1.03, 1.03, 1.03, 1.0, 0.99, 0.99, 1.01, 1.01, 1.09, 1.1, 1.08, 1.08, 1.07, 1.03, 1.04, 1.04, 1.06, 1.06, 1.07, 1.06, 1.07, 1.1, 1.09, 1.09, 1.06, 1.02, 1.02, 1.01, 1.0, 1.01, 0.98, 0.96, 0.98, 0.97, 0.98, 0.97, 0.96, 0.97, 0.98, 0.98, 1.0, 1.0, 1.03, 1.06, 1.06, 1.07, 1.06, 1.09, 1.1, 1.1, 1.14, 1.14, 1.15, 1.16, 1.19, 1.16, 1.19, 1.2, 1.21, 1.18, 1.2, 1.21, 1.19, 1.2, 1.2, 1.2, 1.18, 1.2, 1.24, 1.25, 1.27, 1.28, 1.25, 1.27, 1.28, 1.26, 1.26, 1.29, 1.32, 1.32, 1.32, 1.34, 1.34, 1.33, 1.29, 1.28, 1.28, 1.27, 1.27, 1.27, 1.28, 1.27, 1.29, 1.29, 1.27, 1.26, 1.27, 1.3, 1.29, 1.27, 1.28, 1.28, 1.26, 1.23, 1.22, 1.17, 1.18, 1.18, 1.19, 1.18, 1.19, 1.19, 1.2, 1.2, 1.17, 1.18, 1.19, 1.16, 1.16, 1.17, 1.2, 1.21, 1.19, 1.2, 1.21, 1.2, 1.18, 1.17, 1.18, 1.18, 1.18, 1.16, 1.16, 1.18, 1.17, 1.21, 1.22, 1.21, 1.22, 1.21, 1.23, 1.24, 1.24, 1.24, 1.25, 1.28, 1.29, 1.29, 1.29, 1.31, 1.29, 1.31, 1.33, 1.34, 1.36, 1.36, 1.33, 1.35, 1.36, 1.35, 1.35, 1.39, 1.4, 1.41, 1.41, 1.43, 1.43, 1.48, 1.48, 1.51, 1.5, 1.51, 1.51, 1.51, 1.49, 1.44, 1.43, 1.42, 1.45, 1.45, 1.45, 1.47, 1.47, 1.47, 1.48, 1.46, 1.48, 1.47, 1.44, 1.43, 1.43, 1.44, 1.44, 1.44, 1.44, 1.45, 1.45, 1.48, 1.48, 1.49, 1.51, 1.49, 1.49, 1.48, 1.5, 1.48, 1.48, 1.52, 1.55, 1.57, 1.57, 1.59, 1.61, 1.64, 1.62, 1.57, 1.59, 1.6, 1.59, 1.57, 1.54, 1.56, 1.54, 1.52, 1.58, 1.61, 1.63, 1.66, 1.73, 1.77, 1.73, 1.81, 1.9, 1.88, 1.91, 1.91, 1.96, 2.05, 1.92, 1.92, 1.99, 2.01, 2.05, 2.09, 2.05, 2.11, 2.12, 2.19, 2.14, 1.98, 1.96, 1.94, 1.93, 1.94, 1.94, 1.96, 2.0, 2.05, 2.08, 2.08, 2.08, 2.11, 2.13, 2.13, 2.12, 2.16, 2.17, 2.21, 2.2, 2.19, 2.24, 2.25, 2.25, 2.26, 2.26, 2.16, 2.17, 2.23, 2.22, 2.15, 2.18, 2.2, 2.2, 2.23, 2.23, 2.21, 2.24, 2.18, 2.18, 2.15, 2.13, 2.08, 2.05, 2.07, 2.08, 2.11, 2.12, 2.09, 2.13, 2.2, 2.18, 2.17, 2.17, 2.2, 2.2, 2.22, 2.22, 2.26, 2.28, 2.3, 2.33, 2.3, 2.34, 2.36, 2.38, 2.34, 2.33, 2.36, 2.38, 2.36, 2.36, 2.39, 2.42, 2.42, 2.41, 2.44, 2.4, 2.37, 2.36, 2.4, 2.41, 2.43, 2.48, 2.49, 2.48, 2.54, 2.53, 2.53, 2.59, 2.58, 2.56, 2.57, 2.51, 2.53, 2.5, 2.48, 2.41, 2.44, 2.45, 2.53, 2.54, 2.55, 2.56, 2.56, 2.53, 2.52, 2.5, 2.43, 2.43, 2.46, 2.42, 2.43, 2.43, 2.45, 2.48, 2.52, 2.55, 2.69, 2.7, 2.7, 2.75, 2.79, 2.84, 2.84, 2.82, 2.79, 2.67, 2.74, 2.75, 2.77, 2.82, 2.83, 2.92, 2.97, 3.0, 2.98, 2.97, 2.98, 2.94, 2.95, 2.87, 2.92, 2.96, 3.04, 3.15, 3.23, 3.28, 3.34, 3.19, 3.35, 3.43, 3.46, 3.54, 3.61, 3.73, 3.74, 3.8, 3.73, 3.7, 3.86, 3.78, 3.66, 3.65, 3.66, 3.73, 3.76, 3.83, 3.9, 3.88, 3.97, 4.06, 4.15, 4.26, 4.29, 4.44, 4.29, 4.46, 4.47, 4.61, 4.63, 4.73, 4.89, 4.9, 4.83, 4.81, 4.86, 4.77, 4.86, 4.9, 4.89, 4.83, 4.91, 4.97, 4.99, 5.13, 5.18, 5.14, 5.05, 5.04, 5.1, 5.21, 5.32, 5.37, 5.43, 5.55, 5.68, 5.72, 5.69, 5.6, 5.72, 5.71, 5.72, 5.33, 5.5, 5.69, 5.66, 5.55, 5.65, 5.47, 5.49, 5.63, 5.63, 5.64, 5.71, 5.74, 5.71, 5.93, 6.09, 6.06, 6.21, 6.3, 6.41, 6.37, 6.51, 6.8, 6.88, 6.25, 6.42, 6.38, 5.91, 5.8, 5.83, 6.12, 6.12, 6.23, 6.23, 6.6, 6.56, 6.59, 6.74, 6.78, 6.82, 6.79, 6.32, 6.06, 6.08, 6.24, 5.95, 5.79, 5.85, 5.93, 5.84, 5.44, 5.58, 5.7, 5.54, 5.56, 5.57, 5.54, 5.36, 5.43, 5.44, 5.43, 5.58, 5.89, 5.81, 5.94, 6.05, 6.07, 6.21, 6.25, 6.27, 6.41, 6.54, 6.65, 6.63, 6.53, 6.63, 6.59, 6.77, 6.84, 6.98, 6.9, 6.76, 6.96, 7.14, 7.24, 7.39, 7.34, 7.44, 7.46, 7.47, 7.73, 7.72, 7.93, 8.06, 8.06, 7.8, 7.84, 7.67, 7.5, 7.51, 7.59, 7.79, 7.83, 7.65, 7.78, 7.68, 7.73, 7.63, 7.66, 7.75, 7.93, 7.99, 8.18, 8.19, 8.09, 7.76, 7.69, 7.9, 7.86, 7.67, 7.59, 7.41, 7.38, 7.37, 6.76, 6.72, 6.76, 7.0, 7.35, 7.0, 6.75, 6.84, 6.96, 6.85, 6.63, 6.61, 6.4, 6.43, 6.62, 6.51, 6.49, 6.67, 6.73, 6.56, 6.3, 6.42, 6.4, 6.4, 6.35, 6.49, 6.34, 6.38, 6.43, 6.54, 6.6, 6.68, 6.86, 7.01, 7.0, 6.75, 6.93, 6.95, 6.9, 7.07, 7.21, 7.37, 7.47, 7.55, 7.58, 7.87, 7.77, 7.87, 7.93, 8.06, 8.27, 8.23, 8.46, 8.6, 8.65, 8.69, 8.82, 8.61, 8.33, 8.46, 8.22, 7.7, 7.71, 7.8, 7.94, 7.39, 7.35, 7.44, 7.42, 7.28, 7.81, 7.79, 7.7, 7.92, 7.82, 8.01, 8.28, 8.14, 8.14, 7.96, 7.73, 7.68, 7.78, 7.73, 7.78, 7.92, 7.77, 7.71, 7.76, 7.58, 7.31, 7.3, 7.13, 6.85, 6.79, 6.37, 6.26, 6.31, 6.42, 6.57, 6.38, 6.45, 6.63, 6.41, 6.62, 6.49, 6.11, 6.09, 6.1, 6.26, 6.5, 6.13, 6.34, 6.36, 5.86, 5.92, 5.84, 5.57, 5.34, 5.43, 5.34, 5.61, 5.91, 6.13, 6.07, 6.16, 6.54, 6.67, 6.64, 6.31, 6.38, 6.38, 6.53, 6.51, 6.89, 6.83, 6.86, 6.85, 6.49, 6.4, 6.33, 6.21, 5.99, 6.08, 6.31, 6.1, 6.12, 6.22, 6.12, 5.99, 6.0, 6.02, 5.49, 5.47, 5.42, 5.21, 5.04, 4.94, 5.09, 4.62, 4.65, 4.54, 4.71, 5.03, 5.09, 4.76, 4.71, 4.66, 4.73, 4.94, 4.91, 5.26, 5.38, 5.49, 5.49, 5.37, 5.46, 5.22, 5.04, 5.0, 5.14, 5.48, 5.48, 5.48, 5.6, 5.52, 5.64, 5.58, 5.47, 5.27, 5.17, 5.07, 4.99, 5.01, 5.05, 4.82, 4.75, 4.76, 4.82, 4.82, 4.8, 4.53, 4.55, 4.92, 4.81, 4.68, 4.62, 4.42, 4.38, 4.42, 4.67, 4.58, 4.58, 4.55, 4.58, 4.35, 4.14, 4.13, 4.05, 3.97, 3.94, 3.85, 3.81, 3.71, 3.87, 3.97, 3.95, 3.97, 4.06, 4.16, 3.98, 3.99, 3.83, 3.78, 3.61, 3.64, 3.52, 3.42, 3.37, 3.48, 3.65, 3.69, 3.68, 3.68, 3.71, 3.47, 3.56, 3.43, 3.59, 3.58, 3.6, 3.56, 3.71, 3.62, 3.72, 4.04, 4.05, 4.15, 4.39, 4.63, 4.65, 4.35, 4.54, 4.5, 4.41, 4.24, 4.2, 4.19, 4.27, 4.16, 4.22, 4.27, 4.49, 4.57, 4.65, 4.89, 4.83, 4.94, 4.81, 4.63, 4.74, 4.79, 4.84, 4.93, 5.04, 5.07, 4.79, 4.72, 4.68, 4.7, 4.66, 4.63, 4.58, 4.76, 4.89, 4.8, 4.69, 4.77, 4.81, 4.73, 4.9, 4.85, 5.06, 5.06, 5.09, 5.03, 5.19, 5.19, 5.24, 5.39, 5.47, 5.38, 5.67, 5.97, 5.99, 6.07, 6.1, 6.3, 6.49, 6.27, 5.97, 6.09, 6.2, 6.38, 5.98, 5.92, 5.62, 5.53, 5.56, 5.45, 5.89, 5.88, 5.89, 5.68, 5.96, 5.84, 5.78, 5.75, 5.8, 6.06, 6.2, 6.33, 6.32, 6.44, 6.49, 6.29, 6.3, 6.38, 6.49, 6.6, 6.56, 6.56, 6.49, 6.55, 6.4, 6.52, 6.69, 6.82, 6.84, 6.96, 7.02, 7.07, 7.15, 7.07, 6.79, 6.77, 6.74, 6.62, 6.93, 6.83, 6.81, 6.9, 6.87, 6.85, 6.76, 6.76, 6.7, 6.69, 6.69, 6.95, 7.13, 7.25, 7.23, 7.14, 7.01, 7.0, 7.06, 7.08, 7.09, 7.17, 7.31, 7.34, 7.51, 7.53, 7.52, 7.6, 7.62, 7.63, 7.46, 7.55, 7.52, 7.58, 7.63, 7.66, 7.59, 7.51, 7.62, 7.56, 7.56, 7.6, 7.51, 7.54, 7.68, 7.69, 7.67, 7.78, 7.83, 7.99, 8.01, 8.2, 8.24, 8.19, 8.1, 8.08, 8.35, 8.22, 8.3, 8.32, 8.38, 8.5, 8.51, 8.06, 8.16, 8.22, 8.19, 8.43, 8.6, 8.49, 8.29, 8.32, 8.39, 8.06, 8.03, 7.79, 7.38, 7.42, 7.17, 7.35, 7.48, 7.57, 7.43, 7.66, 7.73, 7.54, 7.0, 6.94, 7.0, 7.35, 7.39, 7.49, 7.62, 7.6, 7.68, 7.76, 7.89, 7.88, 7.89, 8.14, 7.95, 7.99, 7.82, 7.61, 7.63, 7.61, 7.47, 7.49, 7.5, 7.81, 7.71, 7.8, 7.87, 7.87, 7.89, 8.09, 8.24, 8.2, 8.27, 8.42, 8.32, 8.06, 8.16, 8.02, 8.02, 8.21, 8.33, 8.43, 8.61, 9.0, 9.01, 9.01, 9.05, 9.02, 9.1, 9.34, 9.36, 9.49, 9.54, 9.61, 9.66, 9.34, 9.62, 9.2, 8.82, 9.1, 9.26, 9.46, 9.53, 9.51, 9.76, 9.72, 9.55, 9.58, 9.6, 9.8, 9.59, 9.52, 9.22, 8.92, 9.02, 8.63, 8.69, 8.83, 8.84, 8.97, 8.93, 9.05, 9.1, 9.02, 9.04, 8.99, 8.86, 8.99, 8.93, 9.11, 8.9, 8.98, 9.06, 9.22, 9.23, 8.93, 9.08, 9.11, 8.9, 8.47, 8.42, 8.53, 8.53, 8.5, 8.44, 8.67, 8.6, 8.35, 8.34, 8.38, 8.57, 8.62, 8.74, 8.65, 8.54, 8.7, 8.92, 8.88, 8.97, 9.05, 9.04, 8.77, 8.76, 8.89, 9.14, 9.05, 9.04, 8.9, 8.8, 8.85, 9.12, 9.19, 9.24, 9.22, 9.15, 9.13, 8.97, 9.08, 9.27, 9.24, 9.22, 9.46, 9.47, 9.36, 9.32, 9.15, 9.2, 9.02, 9.05, 9.09, 8.99, 8.92, 8.39, 8.27, 8.62, 8.56, 8.54, 8.51, 8.28, 8.29, 8.31, 8.34, 7.99, 8.04, 7.58, 7.43, 7.53, 7.33, 7.41, 7.65, 7.58, 7.01, 7.26, 7.22, 7.05, 7.18, 7.42, 7.35, 7.39, 7.51, 7.44, 7.09, 7.04, 7.13, 7.1, 7.22, 7.16, 7.21, 7.47, 7.42, 7.42, 7.44, 7.38, 7.62, 7.74, 7.63, 7.58, 7.48, 7.41, 6.97, 6.91, 6.81, 6.81, 6.68, 6.91, 7.01, 6.95, 7.31, 7.43, 7.33, 7.39, 7.24, 7.37, 7.67, 7.99, 8.08, 8.17, 8.23, 8.43, 8.4, 8.56, 8.68, 8.64, 8.86, 8.75, 8.75, 8.65, 8.85, 8.91, 8.62, 8.64, 8.5, 8.65, 9.01, 9.11, 9.07, 9.17, 8.93, 8.96, 9.13, 8.89, 8.94, 8.9, 9.03, 8.93, 8.9, 9.04, 9.01, 9.34, 9.41, 9.35, 9.06, 8.99, 9.01, 8.96, 8.94, 8.69, 8.66, 8.57, 8.58, 8.69, 8.57, 8.65, 8.81, 9.16, 9.4, 9.37, 9.72, 9.55, 9.68, 10.08, 10.19, 10.39, 10.49, 10.61, 10.84, 10.89, 10.86, 10.82, 10.8, 11.03, 11.1, 11.06, 11.16, 11.38, 11.53, 11.52, 11.57, 11.76, 11.27, 11.34, 11.02, 11.03, 11.17, 11.2, 11.22, 11.05, 11.18, 11.54, 11.25, 11.25, 11.14, 11.18, 11.33, 11.32, 11.23, 11.28, 11.21, 10.99, 11.15, 11.39, 11.46, 11.33, 11.44, 11.45, 11.37, 11.96, 11.93, 12.06, 12.15, 11.84, 11.77, 11.81, 11.67, 11.77, 11.99, 11.95, 11.99, 12.3, 11.99, 12.23, 12.38, 12.27, 12.17, 11.63, 11.62, 11.76, 11.43, 11.62, 11.61, 11.71, 11.86, 11.93, 11.83, 11.87, 11.92, 11.74, 11.96, 11.98, 12.31, 12.37, 12.46, 12.58, 12.46, 12.53, 12.24, 12.36, 12.41, 12.41, 12.44, 12.62, 12.72, 12.88, 12.94, 13.05, 13.13, 13.04, 13.02, 12.98, 13.17, 12.99, 13.17, 12.78, 12.84, 12.85, 12.81, 12.8, 12.78, 12.96, 12.61, 12.17, 12.22, 12.34, 12.31, 12.06, 12.09, 12.5, 12.51, 12.49, 12.71, 12.76, 12.63, 12.63, 12.68, 12.81, 13.02, 12.89, 12.75, 12.56, 12.38, 12.11, 12.28, 12.5, 12.29, 12.44, 12.58, 12.61, 12.66, 12.59, 12.38, 12.45, 12.38, 12.36, 12.64, 12.65, 12.63, 12.26, 12.22, 11.99, 11.75, 11.58, 11.54, 11.71, 11.78, 11.67, 11.85, 11.93, 11.91, 11.56, 11.6, 11.58, 11.71, 11.5, 11.37, 11.17, 11.03, 11.17, 11.06, 11.41, 11.8, 12.04, 12.3, 12.22, 12.28, 12.26, 12.63, 12.82, 12.82, 12.95, 12.85, 13.08, 12.96, 13.3, 13.24, 13.22, 13.5, 13.5, 13.5, 13.27, 13.33, 12.75, 12.65, 12.73, 12.71, 12.63, 12.62, 12.28, 12.3, 12.35, 12.06, 11.66, 11.44, 11.53, 11.67, 11.79, 12.0, 12.04, 11.98, 11.88, 11.63, 11.7, 12.01, 11.96, 12.15, 12.23, 12.0, 11.89, 11.89, 11.77, 11.62, 11.32, 11.28, 11.54, 11.5, 11.49, 11.35, 11.43, 11.37, 11.29, 10.96, 10.96, 11.38, 11.0, 10.88, 10.74, 10.85, 10.82, 10.65, 10.74, 10.75, 10.69, 11.08, 11.23, 11.21, 11.16, 10.7, 10.76, 10.53, 10.52, 10.83, 11.2, 11.47, 11.39, 11.77, 11.84, 11.82, 11.94, 12.27, 12.39, 12.41, 12.26, 12.45, 12.29, 12.26, 12.56, 12.61, 12.21, 12.12, 11.65, 11.67, 11.57, 11.59, 11.49, 11.51, 11.49, 11.74, 11.21, 11.39, 11.07, 10.79, 10.71, 10.67, 10.62, 10.53, 10.5, 10.29, 10.02, 9.82, 9.95, 9.87, 9.93, 9.63, 9.56, 9.62, 9.8, 9.46, 9.58, 9.57, 9.86, 9.57, 9.26, 9.54, 10.11, 10.45, 10.49, 10.63, 10.44, 9.96, 10.69, 10.75, 10.57, 10.61, 10.57, 10.56, 10.48, 10.64, 10.92, 11.12, 10.86, 11.09, 11.3, 11.46, 11.64, 11.75, 11.87, 12.19, 12.09, 12.1, 12.11, 12.39, 12.64, 12.87, 12.78, 12.64, 12.54, 12.52, 12.75, 12.8, 12.77, 12.78, 13.06, 13.19, 13.46, 13.71, 13.27, 13.34, 13.83, 13.91, 13.68, 13.57, 13.49, 13.22, 13.16, 13.18, 12.62, 12.45, 12.36, 12.67, 12.59, 12.59, 12.55, 12.56, 13.07, 13.23, 13.12, 13.03, 13.43, 13.43, 13.52, 13.45, 13.34, 13.35, 13.47, 13.39, 13.6, 13.72, 13.97, 14.17, 14.21, 14.28, 14.33, 14.19, 14.18, 14.04, 13.86, 14.08, 13.89, 13.78, 14.17, 14.36, 14.2, 14.1, 14.3, 14.43, 14.41, 14.52, 14.58, 14.37, 14.37, 14.33, 14.3, 14.13, 14.34, 14.27, 14.62, 14.91, 15.15, 15.24, 15.13, 15.16, 14.9, 14.59, 14.52, 14.53, 14.31, 14.45, 14.55, 14.53, 14.51, 14.22, 14.44, 13.93, 13.7, 13.89, 14.48, 14.57, 14.16, 14.27, 14.36, 14.43, 14.28, 14.16, 14.02, 13.85, 13.83, 13.77, 13.45, 13.32, 13.52, 13.35, 13.81, 14.03, 14.1, 14.06, 14.21, 14.31, 13.85, 14.05, 13.88, 13.79, 13.77, 13.69, 13.97, 13.87, 14.0, 13.57, 13.22, 13.35, 13.19, 13.23, 13.39, 13.63, 13.63, 13.85, 13.86, 14.42, 14.6, 14.53, 14.76, 14.93, 15.07, 14.62, 14.46, 14.66, 14.45, 14.32, 14.32, 14.1, 13.96, 14.23, 14.56, 14.35, 14.75, 14.85, 14.67, 14.65, 14.21, 14.25, 14.3, 14.67, 14.66, 14.72, 14.68, 14.53, 14.55, 14.32, 14.35, 14.64, 14.55, 14.82, 14.93, 14.93, 14.85, 14.92, 14.45, 14.26, 14.36, 14.12, 14.22, 13.99, 13.91, 13.73, 13.66, 13.72, 13.58, 13.64, 13.58, 13.2, 12.95, 12.88, 12.94, 12.73, 12.87, 13.4, 13.41, 13.67, 13.95, 13.83, 13.83, 13.53, 14.08, 14.24, 14.22, 14.38, 14.42, 14.45, 14.68, 14.92, 15.23, 15.18, 15.39, 15.58, 15.54, 15.79, 15.96, 16.05, 16.06, 15.79, 16.17, 16.52, 16.34, 16.37, 16.38, 16.34, 16.23, 16.08, 15.65, 15.36, 15.49, 15.59, 15.6, 15.51, 15.53, 15.41, 15.72, 15.75, 15.81, 15.94, 15.96, 15.86, 16.08, 15.9, 16.2, 16.32, 15.73, 15.51, 15.85, 15.84, 15.24, 15.47, 16.34, 16.28, 16.18, 16.29, 16.22, 15.77, 15.65, 15.71, 15.73, 15.92, 16.25, 16.35, 16.35, 16.33, 16.02, 16.01, 15.58, 15.69, 15.91, 15.9, 15.66, 15.48, 15.64, 16.07, 16.03, 16.13, 16.06, 16.06, 16.24, 16.11, 16.39, 15.89, 15.56, 15.51, 15.46, 15.21, 15.02, 15.07, 15.45, 15.69, 15.72, 15.49, 15.77, 15.71, 15.55, 15.43, 15.59, 16.03, 16.18, 16.31, 16.21, 16.09, 16.1, 16.06, 16.41, 16.29, 16.44, 16.47, 16.75, 16.6, 16.77, 16.45, 16.19, 15.54, 15.57, 15.65, 15.58, 15.39, 15.07, 14.86, 14.2, 14.03, 14.13, 13.64, 13.69, 14.01, 14.03, 13.83, 14.01, 14.12, 13.71, 13.84, 14.27, 14.85, 14.99, 15.19, 15.23, 15.18, 15.06, 14.66, 14.75, 15.12, 15.03, 14.85, 14.83, 14.5, 14.76, 15.27, 15.42, 15.5, 15.68, 16.17, 16.09, 15.99, 16.01, 16.47, 16.69, 16.42, 16.26, 16.25, 16.29, 16.36, 16.44, 16.52, 16.34, 16.53, 16.69, 16.79, 16.97, 17.25, 17.25, 17.37, 17.48, 17.27, 17.22, 17.56, 18.17, 18.27, 18.41, 18.52, 18.47, 18.2, 18.34, 18.83, 18.97, 18.81, 18.6, 18.79, 18.84, 19.07, 19.14, 18.89, 19.05, 19.22, 19.29, 18.91, 18.73, 18.57, 18.88, 18.79, 18.82, 18.8, 18.27, 18.45, 18.44, 19.01, 18.84, 19.3, 19.39, 19.4, 19.08, 18.97, 18.73, 19.14, 19.23, 18.98, 19.18, 19.48, 19.76, 19.53, 19.66, 19.42, 19.56, 19.56, 19.45, 19.49, 19.78, 19.92, 18.99, 19.24, 19.46, 19.44, 19.44, 19.51, 19.35, 19.25, 19.63, 19.58, 19.26, 19.25, 19.33, 19.1, 18.93, 19.12, 19.23, 19.37, 18.94, 19.29, 19.32, 19.41, 19.88, 19.7, 19.05, 19.09, 19.04, 18.73, 18.59, 18.58, 18.82, 18.59, 18.2, 17.99, 17.95, 18.09, 18.63, 18.53, 19.03, 18.77, 18.63, 18.54, 18.23, 18.39, 18.9, 19.29, 19.35, 19.28, 19.39, 19.6, 19.23, 19.35, 19.53, 19.07, 18.32, 17.7, 17.82, 17.44, 17.56, 17.87, 17.48, 17.64, 17.13, 17.08, 16.7, 17.11, 17.3, 17.56, 17.36, 17.84, 17.9, 17.63, 17.23, 17.93, 18.09, 18.25, 18.12, 17.85, 17.76, 17.73, 18.16, 18.24, 18.33, 18.4, 18.5, 18.5, 18.4, 18.38, 18.56, 18.44, 18.5, 18.43, 18.35, 18.03, 17.92, 18.11, 18.08, 17.97, 17.67, 17.43, 17.58, 17.76, 17.73, 17.38, 17.31, 17.07, 17.52, 17.47, 17.37, 17.07, 17.01, 16.79, 16.93, 17.11, 17.05, 17.09, 17.13, 17.19, 17.34, 17.04, 17.34, 17.46, 17.5, 17.57, 17.46, 17.64, 17.71, 17.82, 17.82, 17.81, 17.85, 17.79, 17.7, 17.5, 17.47, 17.55, 17.88, 17.76, 17.94, 18.09, 18.34, 18.31, 18.42, 18.52, 18.57, 18.69, 18.83, 18.59, 18.17, 18.54, 18.47, 18.45, 18.47, 18.43, 18.17, 17.86, 18.14, 18.18, 18.39, 18.61, 18.8, 19.08, 19.41, 19.42, 19.21, 19.31, 19.67, 19.83, 19.64, 19.93, 20.2, 20.13, 20.04, 19.98, 20.04, 20.24, 20.39, 20.43, 20.4, 20.46, 20.11, 19.75, 19.97, 19.68, 19.82, 20.13, 20.63, 20.87, 20.98, 21.53, 21.61, 21.61, 21.58, 21.83, 22.19, 22.17, 22.13, 22.22, 22.64, 22.33, 22.52, 22.71, 22.69, 22.58, 22.84, 22.9, 23.03, 22.95, 22.72, 22.62, 22.46, 22.39, 22.09, 21.76, 21.9, 21.64, 21.43, 21.08, 21.14, 21.11, 21.51, 21.64, 21.56, 21.44, 21.47, 21.17, 21.05, 20.9, 20.75, 21.26, 20.88, 21.17, 21.06, 21.37, 21.61, 21.64, 21.59, 21.48, 21.44, 21.67, 22.19, 22.15, 22.37, 22.2, 22.43, 22.67, 23.56, 23.67, 23.04, 22.78, 22.27, 22.75, 22.77, 22.92, 23.12, 22.81, 22.61, 22.51, 22.47, 21.89, 21.62, 22.02, 22.33, 22.2, 21.73, 21.67, 21.67, 22.24, 22.7, 22.56, 22.54, 22.47, 22.22, 22.84, 22.58, 22.78, 23.1, 22.3, 23.18, 23.79, 24.25, 23.86, 24.39, 24.47, 24.74, 24.54, 24.42, 24.2, 24.49, 24.19, 24.02, 23.6, 23.6, 23.63, 24.07, 24.44, 24.74, 25.35, 25.5, 25.33, 25.74, 25.84, 26.29, 26.31, 26.87, 27.01, 27.23, 27.32, 27.72, 27.62, 27.66, 28.0, 28.72, 28.99, 29.38, 29.71, 29.57, 30.17, 30.5, 30.91, 31.09, 31.3, 31.77, 31.72, 33.11, 33.42, 33.51, 34.23, 34.9, 35.18, 35.55, 36.22, 35.97, 34.72, 35.37, 36.37, 36.03, 37.38, 38.57, 37.85, 39.12, 39.02, 37.53, 38.06, 37.67, 38.23, 37.91, 38.06, 38.22, 39.58, 41.15, 41.15, 40.71, 40.74, 40.17, 40.62, 42.18, 42.15, 42.97, 45.09, 45.47, 46.82, 47.71, 45.47, 44.47, 45.83, 47.91, 47.13, 46.26, 46.83, 47.68, 47.13, 48.06, 48.78, 49.61, 49.26, 48.11, 48.46, 46.74, 44.42, 44.39, 44.44, 42.71, 40.17, 40.06, 42.69, 39.34, 37.67, 37.56, 36.3, 35.61, 33.08, 33.4, 33.52, 36.7, 37.0, 36.69, 37.06, 38.56, 39.04, 39.08, 38.54, 39.69, 39.09, 35.27, 34.7, 34.71, 33.23, 32.28, 32.1, 33.05, 32.58, 32.87, 33.85, 35.81, 35.67, 35.3, 36.54, 36.67, 37.44, 34.04, 34.4, 33.22, 31.9, 30.49, 29.65, 28.65, 30.15, 32.08, 31.97, 30.18, 30.07, 30.47, 32.63, 33.04, 32.89, 32.6, 29.64, 29.34, 31.51, 31.35, 31.72, 33.12, 34.18, 33.38, 33.93, 32.59, 33.32, 32.75, 32.81, 34.74, 35.12, 37.06, 37.14, 38.55, 39.55, 40.8, 40.24, 40.64, 38.31, 39.28, 40.37, 40.63, 40.19, 39.22, 39.28, 39.99, 39.65, 39.52, 42.01, 43.66, 44.12, 44.23, 44.03, 45.04, 45.68, 45.2, 46.62, 45.83, 46.43, 48.94, 49.12, 48.93, 48.82, 48.95, 48.98, 45.65, 44.61, 44.75, 46.22, 46.49, 45.73, 45.86, 44.22, 44.39, 44.18, 44.01, 45.2, 45.04, 45.27, 46.3, 46.11, 47.07, 47.17, 46.72, 46.02, 46.38, 44.92, 45.47, 45.69, 45.62, 41.74, 42.07, 43.26, 39.5, 39.38, 37.87, 38.18, 36.78, 37.17, 35.93, 36.35, 37.48, 38.84, 36.6, 37.39, 37.54, 34.87, 33.79, 33.43, 34.78, 35.84, 36.28, 36.23, 37.01, 36.82, 37.32, 38.32, 38.81, 38.65, 38.67, 40.04, 39.71, 40.24, 36.92, 36.9, 36.21, 37.0, 38.97, 39.07, 37.72, 38.51, 39.11, 38.57, 38.08, 38.19, 39.45, 39.75, 39.12, 40.27, 41.82, 42.73, 42.32, 42.61, 41.84, 42.26, 42.12, 41.37, 43.51, 43.32, 42.94, 43.85, 44.29, 44.23, 45.6, 46.51, 45.9, 46.31, 46.56, 46.5, 45.55, 45.57, 43.05, 42.73, 42.87, 42.37, 43.07, 42.75, 42.74, 42.66, 43.72, 43.78, 43.9, 42.31, 40.69, 40.64, 40.32, 39.92, 39.68, 40.31, 40.06, 38.88, 39.01, 39.34, 39.97, 39.43, 39.87, 39.98, 39.86, 39.75, 41.57, 41.68, 41.9, 41.94, 41.62, 41.75, 41.76, 39.69, 39.83, 42.21, 42.66, 42.56, 42.68, 42.31, 42.86, 43.27, 43.14, 43.71, 44.19, 44.96, 44.69, 46.44, 47.02, 47.32, 48.67, 48.58, 48.14, 48.43, 48.87, 49.78, 49.58, 50.77, 50.93, 51.85, 52.03, 54.28, 53.86, 54.3, 54.69, 52.35, 52.89, 53.76, 52.5, 52.74, 52.52, 52.72, 52.68, 53.03, 54.01, 54.19, 53.43, 54.66, 56.23, 56.97, 56.7, 56.95, 56.89, 55.66, 55.84, 55.75, 55.43, 55.69, 56.03, 55.92, 56.12, 56.45, 56.38, 55.91, 56.34, 56.26, 56.03, 55.82, 54.24, 54.14, 53.95, 54.26, 54.45, 54.53, 54.87, 54.51, 53.53, 53.81, 53.69, 53.95, 54.41, 55.63, 56.34, 56.2, 56.0, 55.96, 55.47, 56.09, 56.2, 57.04, 56.33, 56.73, 56.77, 54.96, 55.0, 54.78, 54.66, 54.81, 54.54, 55.28, 55.67, 55.44, 56.24, 55.21, 56.22, 56.42, 56.64, 57.22, 57.41, 56.9, 56.69, 56.36, 57.11, 58.08, 57.77, 58.15, 58.19, 58.38, 58.49, 58.46, 57.78, 57.77, 57.49, 58.34, 57.81, 57.55, 55.81, 55.58, 55.11, 55.41, 56.05, 56.31, 56.36, 56.59, 56.59, 56.08, 56.56, 56.36, 56.6, 56.25, 56.31]

# # Bak Performance 
# max_draw_down = 0
# for i in range(1, len(returns)):
#     for j in range(0, i):
#         temp_draw_down = returns[i]/returns[j] - 1
#         max_draw_down = min(max_draw_down, temp_draw_down)
# print(str(max_draw_down))

# Good Performance 
max_draw_down = 0
temp_max_value = 0
for i in range(1, len(returns)):
    temp_max_value = max(temp_max_value, returns[i-1])
    max_draw_down = min(max_draw_down, returns[i]/temp_max_value-1)
print(str(max_draw_down))

注视掉的代码是性能很差劲,请勿使用。

同时,如果你拿到到的是每日的涨跌幅,而不是资金总量变化,计算思想和上面类似,但是要考虑回撤的复利情况,不能直接套用, 但是思想相同!

以上是关于计算收益最大回撤的思想和代码的主要内容,如果未能解决你的问题,请参考以下文章

量化金融收益率对数收益率年华收益波动率夏普比率索提诺比率阿尔法和贝塔最大回撤

量化金融收益率对数收益率年华收益波动率夏普比率索提诺比率阿尔法和贝塔最大回撤

市场风险的度量-下行风险&最大回撤

Python 中最大回撤的开始、结束和持续时间

双因子动量过滤模型

基金回撤越大收益越高吗?