CCockrum commited on
Commit
02ccdc1
·
verified ·
1 Parent(s): 54c7fde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -15,19 +15,24 @@ POLYGON_API_KEY = os.getenv("POLYGON_API_KEY")
15
 
16
  # Helper Functions
17
  def get_company_info(symbol):
18
- url = f"https://api.polygon.io/v3/reference/tickers/{symbol}?apiKey={POLYGON_API_KEY}"
 
 
 
19
  try:
20
  response = requests.get(url)
 
 
21
  response.raise_for_status()
22
  data = response.json()['results']
23
  return {
24
  'Name': data.get('name', 'N/A'),
25
  'Industry': data.get('sic_description', 'N/A'),
26
  'Market Cap': data.get('market_cap', 0),
27
- 'Total Revenue': data.get('total_employees', 0) * 100000 # Rough estimation
28
  }
29
  except Exception as e:
30
- print(f"DEBUG: Error fetching company info: {e}")
31
  return None
32
 
33
  def get_current_price(symbol):
 
15
 
16
  # Helper Functions
17
  def get_company_info(symbol):
18
+ api_key = os.getenv(\"POLYGON_API_KEY\")
19
+ print(f\"DEBUG: Using API Key: {api_key}\")
20
+ url = f\"https://api.polygon.io/v3/reference/tickers/{symbol}?apiKey={api_key}\"
21
+ print(f\"DEBUG: Fetching company info URL: {url}\")
22
  try:
23
  response = requests.get(url)
24
+ print(f\"DEBUG: Response Status: {response.status_code}\")
25
+ print(f\"DEBUG: Response JSON: {response.json()}\")
26
  response.raise_for_status()
27
  data = response.json()['results']
28
  return {
29
  'Name': data.get('name', 'N/A'),
30
  'Industry': data.get('sic_description', 'N/A'),
31
  'Market Cap': data.get('market_cap', 0),
32
+ 'Total Revenue': data.get('total_employees', 0) * 100000 # Rough estimate
33
  }
34
  except Exception as e:
35
+ print(f\"DEBUG: Error fetching company info: {e}\")
36
  return None
37
 
38
  def get_current_price(symbol):