<jupyter_start><jupyter_text>Backet Option<jupyter_code>sigma = 0.4*np.ones(4)
spot = np.ones(4)*100
texp=5
m = pf.BsmNdMc(sigma, cor=0.5, rn_seed=1234)
_ = m.simulate(tobs = [texp], n_path=100000)
print(m.n_path)
m.path
_ = m.simulate(tobs = [texp], n_path=10000, store=2)
print(m.n_path)
# varying strikes
payoff = lambda x: np.fmax(np.mean(x, axis=1) - strike, 0)

strikes = np.arange(50, 151, 10)
price = []
for strike in strikes:
    price.append(m.price_european(spot, texp, payoff))
np.array(price)
# varying forwards
payoff = lambda x: np.fmax(np.mean(x, axis=1) - strike, 0)
strike = 100
price = []
for spot in np.arange(50, 151, 10):
    price.append(m.price_european(spot, texp, payoff))
np.array(price)
# varying except sigma1=100%
strike = spot = 100
payoff = lambda x: np.fmax(np.mean(x, axis=1) - strike, 0)
price = []
for sigma1 in np.array([5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 100])/100:
    sigma = sigma1 * np.ones(4)
    sigma[0] = 1
    #print(sigma)
    m = pf.BsmNdMc(sigma, cor=0.5, rn_seed=1234)
    m.simulate(tobs = [texp], n_path=400000)
    price.append(m.price_european(spot, texp, payoff))
np.array(price)<jupyter_output><empty_output><jupyter_text>For SABR Model<jupyter_code># You can use BsmNdMc because sigma_t is also a geometric Brownian motion

vov = 0.1
m = pf.BsmNdMc(vov, rn_seed=1234)
tobs = np.arange(0, 101)/100*texp
m.simulate(tobs = tobs, n_path=1000)
print(np.squeeze(m.path))<jupyter_output>[[1.         1.         1.         ... 1.         1.         1.        ]
 [1.00118402 0.9983181  1.01856407 ... 1.01792387 0.98656839 1.01310779]
 [1.01765418 0.98166993 0.98295842 ... 0.9652479  0.99062338 1.00845641]
 ...
 [1.35936004 0.70046279 1.08451555 ... 0.54520725 0.89730747 1.06115368]
 [1.34417254 0.70802306 1.10211743 ... 0.53382163 0.86305561 1.10271591]
 [1.41330074 0.67305521 1.0961984  ... 0.53251188 0.84203739 1.12967599]]
{'fraction_non_alphanumeric': 0.16286472148541115, 'fraction_numerical': 0.20583554376657826, 'mean_word_length': 3.65679012345679, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '203961', 'license': 'MIT', 'n_tokens_mistral': 1096, 'n_tokens_neox': 844, 'n_words': 170, 'path': 'py/BsmNdMc_Demo.ipynb', 'repo_name': 'CharlieSCC/ASP', 'size': '1885'}