arvindk1 commited on
Commit
653e0a8
·
verified ·
1 Parent(s): 9e2c964

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
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
- import undetected_chromedriver as uc
 
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 undetected-chromedriver
51
- url = f"https://finance.yahoo.com/quote/{stock}/options/?straddle=false"
52
- options = uc.ChromeOptions()
53
- options.add_argument('--headless')
54
- options.add_argument('--no-sandbox')
55
- options.add_argument('--disable-dev-shm-usage')
 
56
 
57
- driver = uc.Chrome(options=options)
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