-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
21 lines (16 loc) · 1.13 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import risk_free_rate
import trading_calendar
import api_params
import volatility_calculator
import binomial_tree_model
symbol = input("Enter the stock symbol: ")
optionStrikePrice = float(input("Enter the call option strike price: "))
optionExpirationDate = input("Enter the call option expiration date (YYYY-MM-DD): ")
tradingDays = trading_calendar.GetNumberOfTradingDaysUntilExpiration(optionExpirationDate)
currentPrice = api_params.GetCurrentPrice(symbol)
riskFreeRate = risk_free_rate.GetRiskFreeRate()
historicalData = api_params.GetHistoricalData(symbol)
volatility, percentUp = volatility_calculator.GetVolatilityMetrics(historicalData,riskFreeRate)
modeledOptionValue = binomial_tree_model.BinomialTreeOptionValuationModel(tradingDays,currentPrice,volatility,percentUp,optionStrikePrice,riskFreeRate)
print(f"The modeled value of {symbol} ${optionStrikePrice} calls expiring {optionExpirationDate} is ${modeledOptionValue}")
print(f"This is based on the assumption of a risk free rate of {round(riskFreeRate,3)}%, expected daily volatility of {round(volatility*100,2)}%, and a {percentUp*100}% expected chance of a daily positive return")