擅长:python、mysql、java
<p>我认为这是从旧的统计数据包到新的统计数据包的正确转换。你们怎么看?你知道吗</p>
<pre><code>import sympy as sy
import sympy.stats as systats
def euro_put_sym(S, K, T, r, sigma):
#S: spot price
#K: strike price
#T: time to maturity
#r: interest rate
#sigma: volatility of underlying asset
N = systats.Normal('x', 0.0, 1.0)
d1 = (sy.ln(S / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sy.sqrt(T))
d2 = (sy.ln(S / K) + (r - 0.5 * sigma ** 2) * T) / (sigma * sy.sqrt(T))
put = (K * sy.exp(-r * T) * systats.cdf(N)(-d2) - S * systats.cdf(N)(-d1))
return put
</code></pre>