Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
cantaro86
GitHub Repository: cantaro86/Financial-Models-Numerical-Methods
Path: blob/master/src/FMNM/Parameters.py
1700 views
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
"""
4
Created on Mon Jun 10 09:56:25 2019
5
6
@author: cantaro86
7
"""
8
9
10
class Option_param:
11
"""
12
Option class wants the option parameters:
13
S0 = current stock price
14
K = Strike price
15
T = time to maturity
16
v0 = (optional) spot variance
17
exercise = European or American
18
"""
19
20
def __init__(self, S0=15, K=15, T=1, v0=0.04, payoff="call", exercise="European"):
21
self.S0 = S0
22
self.v0 = v0
23
self.K = K
24
self.T = T
25
26
if exercise == "European" or exercise == "American":
27
self.exercise = exercise
28
else:
29
raise ValueError("invalid type. Set 'European' or 'American'")
30
31
if payoff == "call" or payoff == "put":
32
self.payoff = payoff
33
else:
34
raise ValueError("invalid type. Set 'call' or 'put'")
35
36