Skip to content

Instantly share code, notes, and snippets.

@Fabiocke
Created September 17, 2022 04:14
Show Gist options
  • Save Fabiocke/5f7da5dc83c2592aab2a146fcc30d758 to your computer and use it in GitHub Desktop.
Save Fabiocke/5f7da5dc83c2592aab2a146fcc30d758 to your computer and use it in GitHub Desktop.
ativo = 'BBAS3'
vencimento = '2022-12-16'
K = 36.55
df = cotacoes(ativo, 365)
S = df['Adj Close'][-1]
df['Returns'] = np.log(df['Adj Close']/df['Adj Close'].shift(1))
sigma = df['Returns'].std() * 252 ** 0.5
r = selic()
T = (datetime.strptime(vencimento, '%Y-%m-%d') - datetime.now()).days/365
print(S) # 39.400001525878906
print(K) # 36.55
print(r) # 0.13649989315282562
print(sigma) # 0.2941359350202654
print(T) # 0.24383561643835616
bsm_call(S, K, r, sigma, T) # 4.761216571682159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment