import requests
from bs4 import BeautifulSoup 

URL = 'https://finance.yahoo.com/quote/'
secutities = []

with open("ticker-updates,cong", r) as conf_file:
    securities = conf_file.readlines()
    securities = [s.strip() for s in securities]
    
for security in securities:
   query = URL + security

   page = requests.get(query)
   soup = BeautifulSoup(page.content, 'html.parser')
   span = soup.find('span', {'class': "Trsdu(0.3s) Fw(b) Fz(36px) Mb(-4px) D(ib)"})
   price = span.get_text()
   table_row = soup.select('table td')
   open = table_row[3].text
   
   print(f"{security:>6}: {open:<6}  {price:<6}")

import requests
from bs4 import BeautifulSoup 

URL = 'https://finance.yahoo.com/quote/'
CONF_FILE = "ticker-updates.conf"
secutities = []

with open(CONF_FILE, "r") as conf_file:
    securities = conf_file.readlines()
    securities = [s.strip() for s in securities]
    print(securities)
    
for security in securities:
   print(security)
   symbol, sell_price = security.split(',')
   print(f"sy: {symbol}  p: {sell_price}")
   query = URL + symbol

   page = requests.get(query)
   soup = BeautifulSoup(page.content, 'html.parser')
   span = soup.find('span', {'class': "Trsdu(0.3s) Fw(b) Fz(36px) Mb(-4px) D(ib)"})
   price = float(span.get_text())
   table_row = soup.select('table td')
   open = float(table_row[3].text)
   
   print(f"{symbol:>6}: {sell_price:<6}  {open:<6}  {price:<6}  {open - price:<6}")

Fix file read, start on sell price
Fix file read, start on sell price
  import requests
  from bs4 import BeautifulSoup 
  
  URL = 'https://finance.yahoo.com/quote/'
+ CONF_FILE = "ticker-updates.conf"
  secutities = []
  
- with open("ticker-updates,cong", r) as conf_file:
+ with open(CONF_FILE, "r") as conf_file:
      securities = conf_file.readlines()
      securities = [s.strip() for s in securities]
+     print(securities)
      
  for security in securities:
+    print(security)
+    symbol, sell_price = security.split(',')
+    print(f"sy: {symbol}  p: {sell_price}")
-    query = URL + security
+    query = URL + symbol
  
     page = requests.get(query)
     soup = BeautifulSoup(page.content, 'html.parser')
     span = soup.find('span', {'class': "Trsdu(0.3s) Fw(b) Fz(36px) Mb(-4px) D(ib)"})
-    price = span.get_text()
+    price = float(span.get_text())
     table_row = soup.select('table td')
-    open = table_row[3].text
+    open = float(table_row[3].text)
     
-    print(f"{security:>6}: {open:<6}  {price:<6}")
+    print(f"{symbol:>6}: {sell_price:<6}  {open:<6}  {price:<6}  {open - price:<6}")
  
Fix file read, start on sell price
## Code Before:
import requests
from bs4 import BeautifulSoup 

URL = 'https://finance.yahoo.com/quote/'
secutities = []

with open("ticker-updates,cong", r) as conf_file:
    securities = conf_file.readlines()
    securities = [s.strip() for s in securities]
    
for security in securities:
   query = URL + security

   page = requests.get(query)
   soup = BeautifulSoup(page.content, 'html.parser')
   span = soup.find('span', {'class': "Trsdu(0.3s) Fw(b) Fz(36px) Mb(-4px) D(ib)"})
   price = span.get_text()
   table_row = soup.select('table td')
   open = table_row[3].text
   
   print(f"{security:>6}: {open:<6}  {price:<6}")

## Instruction:
Fix file read, start on sell price
## Code After:
import requests
from bs4 import BeautifulSoup 

URL = 'https://finance.yahoo.com/quote/'
CONF_FILE = "ticker-updates.conf"
secutities = []

with open(CONF_FILE, "r") as conf_file:
    securities = conf_file.readlines()
    securities = [s.strip() for s in securities]
    print(securities)
    
for security in securities:
   print(security)
   symbol, sell_price = security.split(',')
   print(f"sy: {symbol}  p: {sell_price}")
   query = URL + symbol

   page = requests.get(query)
   soup = BeautifulSoup(page.content, 'html.parser')
   span = soup.find('span', {'class': "Trsdu(0.3s) Fw(b) Fz(36px) Mb(-4px) D(ib)"})
   price = float(span.get_text())
   table_row = soup.select('table td')
   open = float(table_row[3].text)
   
   print(f"{symbol:>6}: {sell_price:<6}  {open:<6}  {price:<6}  {open - price:<6}")
