Commit 7ecdc557 authored by 赵杰's avatar 赵杰

波动率

parent 935c679d
...@@ -69,7 +69,10 @@ def volatility(simple_return, n): ...@@ -69,7 +69,10 @@ def volatility(simple_return, n):
:param n:数据类型, 周(52), 月(12), 日(250) :param n:数据类型, 周(52), 月(12), 日(250)
:return: :return:
""" """
d = math.sqrt(n) * simple_return.std(ddof=1) new_s_r = simple_return / simple_return.shift(1)
new_s_r.fillna(1)
new_s_r = simple_return.apply(lambda x: math.log(x))
d = math.sqrt(len(simple_return)) * new_s_r.std(ddof=1)
return d return d
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment