INNER CODE UNIT · Python

fetch_twitter_data

zoharbabin/quantum-trader · src/analysis/qualitative_analysis.py:35

    def fetch_twitter_data(self, symbol):
        """
        Fetch Twitter data for a given stock symbol.
        
        :param symbol: Stock symbol to fetch tweets for
        :return: Dictionary containing tweet data
        """
        try:
            url = "https://api.twitter.com/2/tweets/search/recent"
            headers = {
                'Authorization': f'Bearer {self.twitter_api_key}'
            }
            params = {
                'query': f'${symbol}',
                'max_results': 100
            }
            response = requests.get(url, headers=headers, params=params)
            response.raise_for_status()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…