Rivier-Computer-Science / AI-Agent-Stock-Prediction

Multi-Agent Stock Prediction
GNU Affero General Public License v3.0
5 stars 16 forks source link

AI-Agent-Stock-Prediction

Executing the Code

There are two programs that are not yet integrated. From the root directory run:

(stocks) jglossner@jglossner:~/GitRepos/AI-Agent-Stock-Prediction$ streamlit run src/UI/app.py

or

(stocks) jglossner@jglossner:~/GitRepos/AI-Agent-Stock-Prediction$ python -m src.UI.main

Installation

Install Anaconda Python.

conda create -n stocks python=3.12 anaconda
conda activate stocks

Install yfinance and langchain

conda install langchain langchain-community
conda install -c conda-forge yfinance
conda update --all

Install CrewAI

If you are running on Windows, download Visual Studio. You need a c++ compiler to generate the wheels for crewai. Minimally, you must have buildtools installed. If you've already installed Visual Studio, you do not need to separately install build tools.

Documentation for CrewAI.

conda config --set pip_interop_enabled True
pip install openai crewai crewai-tools pandas_ta unstructured sec_api

Install faiss

If you have an nVidia GPU

conda install -c conda-forge faiss-gpu

Else

conda install -c conda-forge faiss-cpu

newspaper3k and supporting libraries

pip install newspaper3k beautifulsoup4 lxml lxml_html_clean

Set Environment Variables

Sign up to get an OpenAI Key Sign up to get a free SEC API Key Sign up to get a free SERPER API Key

export OPENAI_API_KEY=sk-     # available form platform.openai.com
export SEC_API_API_KEY= your long list of numbers   # Sign up for a free key
export SERPER_API_KEY= your key # Free for 2500 queries

Note: for Windows use set instead of export

Set up Selenium and the Chromium webdriver

pip install selenium

Download the chromedriver from the stable channel.

Place it is a folder named chromedriver in the root directory. This will not be on github because some students need Linux or MAC versions.

Note that it must match the version of Chrome on your computer. You can check it by starting the Chrome browser. Then navigate to on your browser to the top right 3 dots, help->About Chrome. It should say 128.xxxxx.

Set up back testing

pip install backtrader
pip install backtrader[plotting]