Skip to content

Python code snippet that queries the Finnhub APIuses the OpenAI ChatGPT API to analyze the sentiment, identifies the top 25 stocks likely to trend during the London Stock Exchange market open.

Notifications You must be signed in to change notification settings

marketweek/stockmarketopenai

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

stockmarketopenai

Python code snippet that queries the Finnhub API for the latest stock news and uses the OpenAI ChatGPT API to analyze the sentiment, then identifies the top 25 stocks likely to trend during the London Stock Exchange market open.

Prerequisites:

Finnhub API Key: Sign up at Finnhub and get your API key.
OpenAI API Key: Sign up at OpenAI and get your API key.

Install necessary packages:

pip install requests openai

Notes:

Stock Tickers: You may need to expand the list of tickers based on your requirements. Consider using a more extensive list or fetching them dynamically.
Sentiment Logic: The sentiment analysis logic is basic; you may want to refine it further based on your needs.
API Rate Limits: Be mindful of the rate limits for both Finnhub and OpenAI APIs. You may need to implement error handling or rate limiting in production code.

Important:

Replace YOUR_FINNHUB_API_KEY and YOUR_OPENAI_API_KEY with your actual API keys. Adjust the tickers and logic based on your specific requirements for better accuracy.

Disclaimer of Liability:

By using this open-source code, you acknowledge and agree that the author and contributors shall not be held liable for any direct, indirect, incidental, or consequential damages arising from the use or inability to use this code. This includes, but is not limited to, damages related to loss of data, financial loss, or any other type of loss that may occur, even if advised of the possibility of such damages. Use this code at your own risk, and it is your responsibility to ensure that it is suitable for your specific needs and environment.

About

Python code snippet that queries the Finnhub APIuses the OpenAI ChatGPT API to analyze the sentiment, identifies the top 25 stocks likely to trend during the London Stock Exchange market open.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%