A conversational AI application that provides financial insights using stock market data from Finnhub and Azure OpenAI.
Streamlit | Langchain | LangGraph | FastAPI | FinnHub
Three core components work together:
client.py
- Streamlit frontend with chat interfaceserver.py
- FastAPI backend handling AI processingllm.py
- LangGraph workflow with financial data tools
- Real-time stock data analysis
- Company recommendation trends visualization
- Earnings history and news summaries
- Conversational AI with financial expertise
- Python 3.12
- Conda package manager
- API keys for Finnhub and Azure OpenAI
# Create conda environment
conda create -y -p ./conda python=3.12
conda activate ./.conda
# Install dependencies
pip install -r requirements.txt
# Create .env file
touch .env
OPENAI_API_DEPLOYMENT=your-deployment-name
OPENAI_API_MODEL=your-model-name
AZURE_OPENAI_ENDPOINT=your-azure-endpoint
OPENAI_API_VERSION=2023-05-15
OPENAI_API_KEY=your-openai-key
FINNHUB_API_KEY=your-finnhub-key
- Start Server (in separate terminal)
uvicorn server:app --reload
- Start Client
streamlit run client.py
- Sample Queries:
Q. "Show me recommendation trends for AAPL"
Q. "What's the current price of TSLA?"
Q. "Summarize recent news for Microsoft"
Q. "Display earnings history for Amazon"
- Client (Streamlit Frontend)
- Handles user interface and chat history
- Sends prompts to server via POST requests
- Visualizes responses using Streamlit charts
- Maintains session-based chat history
- Server (FastAPI Backend)
- Receives POST requests with user prompts
- Maintains conversation state using LangGraph
- Coordinates with financial data tools
- Returns AI-generated responses in JSON format
- LLM Workflow (LangGraph)
- Processes natural language queries using Azure OpenAI
- Routes to appropriate financial tools:
getStockData
: Company profilesgetStockRecommendation
: Analyst trendsgetCompanyNews
: Recent news summariesgetStockPrice
: Real-time quotesgetCompanyEarnings
: Historical performance
MIT License - Use responsibly with proper API key management. Always verify financial insights with professional advisors.