早期写的python障碍式期权的定价脚本,供大家参考,具体内容如下 #coding:utf-8
'''
障碍期权
q=x/s
H = h/x H 障碍价格
[1] Down-and-in call cdi
[2] Up-and-in call cui
[3] Down-and-in put pdi
[4] Up-and-in put pui
[5] Down-and-out call cdo
[6] Up-and-out call cuo
[7] Down-and-out put pdo
[8] Up-and-out put puo
'''
from math import log,sqrt,exp,ceil
from scipy import stats
import datetime
import tushare as ts
import pandas as pd
import numpy as np
import random
import time as timess
import os
def get_codes(path='D:\\code\\20180313.xlsx'): #从代码表格从获取代码
codes = pd.read_excel(path)
codes = codes.iloc[:,1]
return codes
def get_datas(code,N=1,path='D:\\data\\'): #获取数据N=1当天数据</