Building a Financial Chat Application Powered by AI

Jul 14, 2024 | Educational

Welcome to the journey of creating a groundbreaking financial chat application that harnesses the synergy of several advanced tools like LangChain, LangGraph, OpenBB, Claude 3 Opus, and Streamlit. In this article, we will walk you through the process of setting up your own financial chat application, highlighting its features, installation steps, and providing solutions to common troubleshooting scenarios.

Features of the Financial Chat Application

Our financial chat application is packed with features that ensure an interactive and insightful experience.

  • Fetches financial data using OpenBB
  • Generates technical analysis summaries using AI
  • Provides stock price history, quantitative stats, and more
  • Calculates relative strength for stocks
  • Conducts sentiment analysis on news articles
  • Universe scanning using FinViz filters
  • Implements risk management techniques with technically-derived stops and R Multiples
  • Interactive Streamlit UI for chat-based interaction
  • Multiple Agent Workflows using LangGraph
  • Deployment to AWS with the Copilot CLI

Installation Guide

To get started with the application, follow these steps:

Step 1: Install Required Dependencies

Use Poetry to install the necessary dependencies:

poetry install

Step 2: Set Up Environment Variables

Create a .env file at the project root with the following entries:

export OPENAI_API_KEY=your-api-key
export OPENBB_TOKEN=your-openbb-token
export TIINGO_API_KEY=your-tiingo-api-key
export IMGUR_CLIENT_ID=your-imgur-client-id
export IMGUR_CLIENT_SECRET=your-imgur-client-secret
export FMP_API_KEY=fmp-api-key
export INTRINIO_API_KEY=intrinio-api-key

Usage Instructions

Running the Streamlit UI

To launch the Streamlit app, execute the following command:

streamlit run appui.py

Starting the FastAPI Server

For the FastAPI server, use the command below:

uvicorn app.server:app --host 0.0.0.0 --port 8080

You can then access the Swagger Docs and test the Playground.

Using Docker

If you prefer Docker, you can build and run the Docker container with these commands:

docker build -t financial-chat .
docker run -p 8080:8080 --env-file .env financial-chat

Understanding the Project Structure

The project structure is organized as follows:

  • app: Main application code
  • chains: LangChain agent and prompts
  • features: Feature-specific code (technical analysis, charting)
  • tools: Custom tools for data retrieval and analysis
  • ui.py: Streamlit UI
  • server.py: FastAPI server
  • Dockerfile: Dockerfile for building the application
  • pyproject.toml: Project dependencies and configuration
  • README.md: Project documentation

Troubleshooting Tips

If you encounter issues when setting up or running the application, here are some common troubleshooting steps:

  • Ensure that all required environment variables are correctly set in your .env file.
  • Check for compatibility of Poetry and the installed Python version.
  • Verify that your API keys are valid and have not expired.
  • Ensure Docker is properly installed and running on your machine.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Additional Resources

If you’re eager to dive deeper into the technical workings of this project, don’t miss out on the following blog articles:

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox