-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathoption_pricing.py
28 lines (26 loc) · 935 Bytes
/
option_pricing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class BlackScholesModel:
# ... (existing code) ...
def get_calculation_steps(self):
steps = {
"Input Parameters": {
"Spot Price": self.S,
"Strike Price": self.K,
"Time to Maturity (days)": self.T,
"Risk-free Rate": self.r,
"Volatility": self.sigma
},
"Intermediate Calculations": {
"d1": self.d1,
"d2": self.d2,
"N(d1)": self.N_d1,
"N(d2)": self.N_d2,
"N(-d1)": self.N_minus_d1,
"N(-d2)": self.N_minus_d2
},
"Final Calculations": {
"Call Option Price": self.call_price,
"Put Option Price": self.put_price
}
}
return steps
# Similarly, add get_calculation_steps() methods to MonteCarloPricing and BinomialTreeModel classes