Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,8 @@ from datetime import datetime, timedelta
|
|
| 5 |
import mibian
|
| 6 |
from yahoofinancials import YahooFinancials
|
| 7 |
import matplotlib.pyplot as plt
|
| 8 |
-
|
|
|
|
| 9 |
from selenium.webdriver.common.by import By
|
| 10 |
from selenium.webdriver.support.ui import WebDriverWait
|
| 11 |
from selenium.webdriver.support import expected_conditions as EC
|
|
@@ -47,14 +48,15 @@ def main():
|
|
| 47 |
risk_free_rate = round(yahoo_financials_treasuries.get_current_price()/100, 4)
|
| 48 |
st.write(f"Risk-free rate: {risk_free_rate}")
|
| 49 |
|
| 50 |
-
# Set up Selenium with
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
driver.get(url)
|
| 59 |
|
| 60 |
# Wait for the expiration button to be clickable
|
|
|
|
| 5 |
import mibian
|
| 6 |
from yahoofinancials import YahooFinancials
|
| 7 |
import matplotlib.pyplot as plt
|
| 8 |
+
from selenium import webdriver
|
| 9 |
+
from selenium.webdriver.chrome.options import Options
|
| 10 |
from selenium.webdriver.common.by import By
|
| 11 |
from selenium.webdriver.support.ui import WebDriverWait
|
| 12 |
from selenium.webdriver.support import expected_conditions as EC
|
|
|
|
| 48 |
risk_free_rate = round(yahoo_financials_treasuries.get_current_price()/100, 4)
|
| 49 |
st.write(f"Risk-free rate: {risk_free_rate}")
|
| 50 |
|
| 51 |
+
# Set up Selenium with headless Chrome
|
| 52 |
+
chrome_options = Options()
|
| 53 |
+
chrome_options.add_argument("--headless")
|
| 54 |
+
chrome_options.add_argument("--no-sandbox")
|
| 55 |
+
chrome_options.add_argument("--disable-dev-shm-usage")
|
| 56 |
+
|
| 57 |
+
driver = webdriver.Chrome(options=chrome_options)
|
| 58 |
|
| 59 |
+
url = f"https://finance.yahoo.com/quote/{stock}/options/?straddle=false"
|
| 60 |
driver.get(url)
|
| 61 |
|
| 62 |
# Wait for the expiration button to be clickable
|