fix(dataflows): map crypto to StockTwits/Reddit sentiment symbols
- crypto reached StockTwits as Yahoo's BTC-USD (404) instead of BTC.X, and Reddit searched the dashed pair that barely matches; both now resolve the base via a shared crypto_base() helper, restoring crypto sentiment - also fixes a StockTwits resilience test class that pytest never collected #1113
This commit is contained in:
6 files changed
+114
-13
No files matched your search
@@ -30,6 +30,8 @@ from urllib.error import HTTPError
|
||||
from urllib.parse import urlencode
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
from .symbol_utils import crypto_base
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_API = "https://www.reddit.com/r/{sub}/search.json?{qs}"
|
||||
@@ -200,6 +202,9 @@ def fetch_reddit_posts(
|
||||
stay under Reddit's public per-IP rate limit; combined with the RSS-first
|
||||
path it makes 429s rare even when several analyses run back-to-back.
|
||||
"""
|
||||
# Crypto reaches us as a Yahoo pair (BTC-USD); search Reddit for the base
|
||||
# ("BTC") so the query actually matches discussion instead of near-nothing.
|
||||
ticker = crypto_base(ticker) or ticker
|
||||
blocks = []
|
||||
total_posts = 0
|
||||
for i, sub in enumerate(subreddits):
|
||||
|
||||
Reference in new issue
Block a user