Skip to content

WillReynolds5/SentimentX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SentimentX💰📈🤖

SentimentX is a command-line application designed to extract structured data from financial news sources. It retrieves an article from the provided URL(s), extracts its text, and then applies sentiment analysis to the text. The sentiment score, along with other useful article information, is returned in a JSON format.

Setup 🛠️

To setup SentimentX, install the requirements by running:

pip install -r requirements.txt

Python Version 🐍

SentimentX is developed and tested with Python 3.10. Please make sure you have Python 3.10 installed on your machine.

Setting up OpenAI API Key 🔑

To use SentimentX, you'll need to have an OpenAI API key. Once you have your key, create a new file in the project root directory called .env, and add the following line:

OPENAI_API_KEY=sk-1sdf2s...

Replace sk-1sdf2s... with your actual OpenAI API key.

Running SentimentX 🏃‍♀️

To run SentimentX, use the following command:

python sentimentx.py --url https://www.cnbc.com/2023/05/17/google-to-use-new-ai-models-for-ads-and-to-help-youtube-creators.html https://www.cnbc.com/2023/05/17/amazons-alexa-head-defends-companys-work-on-ai-amid-chatgpt-boom.html

You can also pass multiple URLs to the --url argument (to pass multiple urls, separate by space).

Sample Output 📄

Here is a sample output:

    [
      {
        "authors": "Jennifer Elias",
        "date": "2023-05-17T16:30:00-0400",
        "summary": "Google plans to use generative AI, fueled by large language models (LLMs), to automate advertising and ad-supported consumer services. The company also plans to automate some customer service for its products using new AI models. Google is working on its own internal Stable Diffusion-like product for image creation.",
        "publisher": "CNBC",
        "title": "Google plans to use new A.I. models for ads and to help YouTube creators",
        "tickers": ["GOOGL"],
        "sentimentScore": "5",
        "marketImpact": "7",
        "url": "https://www.cnbc.com/2023/05/17/google-to-use-new-ai-models-for-ads-and-to-help-youtube-creators.html"
      },
      {
        "authors": ["Annie Palmer"],
        "date": "2023-05-17T10:16:00Z",
        "summary": "Rohit Prasad, Senior VP and Head Scientist for Alexa at Amazon, states that the company will be a major```html
player in generative AI. The company has already sold over 500 million Alexa-powered devices worldwide. Prasad claims that Alexa is at the forefront of AI and is an instantly available personal AI that people can communicate with by voice. Amazon is working on making Alexa more conversational and intelligent by creating a new version of its large language model, Alexa Teacher Model. Amazon may also add AI-like features to Alexa in entertainment and storytelling.",
        "publisher": "CNBC",
        "title": "Amazon's Alexa head says company is 'at the forefront of A.I.' as chatbots explode",
        "tickers": ["AMZN"],
        "sentimentScore": "8",
        "marketImpact": "6",
        "url": "https://www.cnbc.com/2023/05/17/amazons-alexa-head-defends-companys-work-on-ai-amid-chatgpt-boom.html"
      }
    ]
    

Saving Output to CSV 📁

You can save the output to a CSV file by passing the --csv flag along with a filename:

python sentimentx.py --url https://www.cnbc.com/2023/05/16/elon-musk-cnbc-interview-with-david-faber.html --csv output.csv

About

Financial News Analyzer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages