alpaca_daily_losers.openai
Classes
Module Contents
- class alpaca_daily_losers.openai.OpenAIAPI
- completion_with_backoff(**kwargs)
Makes a completion call to the OpenAI API with exponential backoff in case of failures.
- Returns:
The response object from the OpenAI API.
- Return type:
response (openai.Completion)
- chat(msgs)
Chat with the OpenAI API.
- Parameters:
msgs (list) – List of messages.
- Returns:
The response from OpenAI.
- Return type:
response (openai.ChatCompletion)
- get_sentiment_analysis(title, symbol, article)
Get the sentiment analysis for financial news.
- Parameters:
title (str) – The title of the news.
symbol (str) – The stock symbol associated with the news.
article (str) – The content of the news article.
- Returns:
The sentiment analysis result - “BEARISH”, “BULLISH”, or “NEUTRAL”.
- Return type:
signal (str)