Spaces:
Sleeping
Sleeping
Update get_market_cap_tier to use ScreenerScraper
Browse files- forecaster_cli.py +7 -10
forecaster_cli.py
CHANGED
|
@@ -96,20 +96,17 @@ def fetch_live_features(ticker):
|
|
| 96 |
return None
|
| 97 |
|
| 98 |
def get_market_cap_tier(ticker):
|
| 99 |
-
print(f"[{ticker}] Resolving market cap classification
|
| 100 |
try:
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
if ticker in large: return "Large"
|
| 104 |
-
|
| 105 |
-
mid = pd.read_csv(TIERS["Mid"], storage_options=ua)['Symbol'].tolist()
|
| 106 |
-
if ticker in mid: return "Mid"
|
| 107 |
|
| 108 |
-
|
| 109 |
-
if
|
|
|
|
| 110 |
|
| 111 |
except Exception as e:
|
| 112 |
-
print(f"Warning: Could not fetch
|
| 113 |
|
| 114 |
return "Small" # Default to small cap model for everything else
|
| 115 |
|
|
|
|
| 96 |
return None
|
| 97 |
|
| 98 |
def get_market_cap_tier(ticker):
|
| 99 |
+
print(f"[{ticker}] Resolving market cap classification via Screener...")
|
| 100 |
try:
|
| 101 |
+
scraper = ScreenerScraper()
|
| 102 |
+
cap_class = scraper.get_cap_info(ticker)['market_cap_class']
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
if "Large" in cap_class: return "Large"
|
| 105 |
+
if "Mid" in cap_class: return "Mid"
|
| 106 |
+
if "Small" in cap_class: return "Small"
|
| 107 |
|
| 108 |
except Exception as e:
|
| 109 |
+
print(f"Warning: Could not fetch market cap ({e}). Defaulting to Small.")
|
| 110 |
|
| 111 |
return "Small" # Default to small cap model for everything else
|
| 112 |
|