<jupyter_start><jupyter_text>Major goal here is to get time-dependent characteristic function clarified and working.<jupyter_code>import os
os.chdir(r'/Users/rmccrickerd/desktop/jdheston')
import numpy as np
import pandas as pd
from jdheston import jdheston as jdh
from jdheston import utils as uts
from jdheston import config as cfg
from matplotlib import pyplot as plt
from scipy.stats import norm
from scipy.special import gamma
# import mpl
# %matplotlib inline
nx = np.newaxis
cfg.config(scale=1.5,print_keys=False)
x = 0.5
y = 0.5
uts.log_cosh_sinh(x,y), np.log(np.cosh(x) + y*np.sinh(x))
uts.tanh_frac(x,y), (y + np.tanh(x))/(1 + y*np.tanh(x))
T = np.array([1/12,3/12,6/12,1])[:,nx]
# M = ['1W','1M','3M','6M','9M','1Y']
Δ = np.linspace(5,95,19)[nx,:]/100
k = norm.ppf(Δ)*0.1*np.sqrt(T)
pd.DataFrame(k,index=T[:,0],columns=np.round(Δ[0,:],2))<jupyter_output><empty_output><jupyter_text>Forward variance appears to scale fine for low epsilon but not high. Feels like implicit SDE is not parameterised as want -- to give the right expectation.<jupyter_code>times   = np.array([0,1/12,3/12,6/12])
sigma   = np.array([ 0.1])*np.ones_like(times)
rho     = np.array([ 0.0])*np.ones_like(times)
vee     = np.array([ 1])*np.ones_like(times)
epsilon = np.array([ 1])*np.ones_like(times)
epsilon[-1] = 0
np.sqrt(np.mean([0.1**2, 0.2**2]))
params  = np.array([times, sigma, rho, vee, epsilon]).T
np.round(params,2)
np.round(jdh.parameter_steps(params,1),2)
maturities = T
logstrikes = k
call_prices = jdh.jdh_pricer(maturities, logstrikes, params)
implied_vols = jdh.surface(maturities, logstrikes, call_prices)
pd.DataFrame(implied_vols,index=T[:,0],columns=Δ[0,:])
# plt.rcParams['figure.figsize'] = [2*1.618*2,2*3]
# plt.rcParams['legend.loc'] = 'lower left'
plot,axes = plt.subplots()
for i in range(len(T[:,0])):
    axes.plot(k[i,:],100*implied_vols[i,:])
    axes.set_xlabel(r'$k$')
    axes.set_ylabel(r'$\bar{\sigma}(k,\tau)$')
# plt.savefig('temp')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18548387096774194, 'fraction_numerical': 0.03881048387096774, 'mean_word_length': 5.7979452054794525, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '295397', 'license': 'MIT', 'n_tokens_mistral': 873, 'n_tokens_neox': 837, 'n_words': 159, 'path': 'notebooks/.ipynb_checkpoints/20190624-piecewise-charfunc-checkpoint.ipynb', 'repo_name': 'zongjietan/jump-diffusion-heston', 'size': '1984'}