Skip to content

Instantly share code, notes, and snippets.

View 39mikufans's full-sized avatar

Udonge 39mikufans

  • Gensokyo
View GitHub Profile
@39mikufans
39mikufans / IV.py
Created April 25, 2021 07:19
隐含波动率
import pandas as pd
import datetime
import tushare as ts
import numpy as np
from math import log,sqrt,exp
from scipy import stats
import plotly.graph_objects as go
import plotly
import plotly.express as px
<html>
<body bgcolor=000000>
<table boder=0 cellpadding=0 cellspacing=0>
<tr height=3>
<td width=3 bgcolor=888888 rowspan=105></td>
<td bgcolor=888888 colspan=54></td>
<td width=3 bgcolor=888888 rowspan=105></td>
</tr>
#include <cmath>
#include <tuple>
// Copyright (c) <2020> <TouhouSupport(Ameame)>
// "Anti 996" License Version 1.0 (Draft)
// Permission is hereby granted to any individual or legal entity
// obtaining a copy of this licensed work (including the source code,
// documentation and/or related items, hereinafter collectively referred
// to as the "licensed work"), free of charge, to deal with the licensed
# -*- coding: utf-8 -*-
import math
import numpy
import matplotlib.pyplot
import scipy.stats
def d1(S0, K, r, sigma, T):
return (math.log(S0 / K) + (r + sigma**2 / 2) * T) / (sigma * math.sqrt(T))
def d2(S0, K, r, sigma, T):
# -*- coding: utf-8 -*-
import abc
from math import exp
import math
import numbers
import time
import numpy as np
import scipy.optimize
import scipy.stats