写点什么

Test

用户头像
bobcatzoo
关注
发布于: 22 分钟前

LaTeX 测试

C++测试

#include <iostream>using namespace std;
int main(){ cout << "Hello, InfoQ" << endl; return 0;}
复制代码


Python 测试

import mathimport numpy as npfrom scipy.stats import norm
//定义以下简写变量//K: strikePrice//T: maturity//S_t: spotPrice//vol: volatility//r: riskFreeRate
//定义d1和d2def d1f(K, T, S_t, vol, r) : return math.pow(vol * np.sqrt(T), -1) * \ (np.log(S_t / K) + (r + 0.5 * math.pow(vol, 2) * np.sqrt(T)))
def d2f(K, T, S_t, vol, r) : return d1f(K, T, S_t, vol, r) - vol * np.sqrt(T)
//定义看涨-看跌期权计算公式def blackScholesCallPrice(K, T, S_t, vol, r) : d1 = d1f(K, T, S_t, vol, r) d2 = d2f(K, T, S_t, vol, r)
callPrice = norm.cdf(d1) * S_t - norm.cdf(d2) * K * np.exp(-r * T) return callPrice
def blackScholesPutPrice(K, T, S_t, vol, r) : d1 = d1f(K, T, S_t, vol, r) d2 = d2f(K, T, S_t, vol, r)
putPrice = norm.cdf(-d2) * K * np.exp(-r * T) - norm.cdf(-d1) * S_t return putPrice
//定义看涨-看跌期权平价测试公式def callPutParity(K, T, S_t, r) : return S_t - np.exp(-r * T) * K
//对给定变量进行测试K = 100.0S_t = 110.0vol = 0.1r = 0.03T = 0.5
call = blackScholesCallPrice(K, T, S_t, vol, r)put = blackScholesPutPrice(K, T, S_t, vol, r)callPutParity_ = callPutParity(K, T, S_t, r)
print("The call option price is: {0}".format(call))print("The put option price is: {0}".format(put))print("Call price - put price is: {0}".format(call - put))print("The Call-Put-Parity is: {0}".format(callPutParity_))
复制代码

测试写作内容常用语言及代码高亮,够 50 个字了吧?不够的话我再写,还不够?再继续打几个字。还不够?是的,继续继续继续。哈哈哈哈哈

用户头像

bobcatzoo

关注

还未添加个人签名 2021.06.23 加入

还未添加个人简介

评论

发布
暂无评论
Test