Stock Market Bot#
This is an example chatbot for retrieving live stock prices for the stock of a specified company or organization. This bot also provides answers to queries related to the stock market and stocks. Here, the Yahoo Finance API is used for getting the stock prices of a stock. This bot only answers the questions related to stock prices and the stock market and does not have the ability to answer any off-topic queries.
Note
We use yfinance to extract market capital and yahoo-fin to extract real-time stock prices. If you’re seeing issues with packages, you can build the stock plugin using Alpha Vantage or a similar API to get this information and integrate it with the existing bot.
The Stock Market Bot uses the following ACE Agent features:
Answering questions from a Knowledge Base
Plugin Server for fetching live stock prices
Handling profane questions
Handling off-topic questions
Answering contextual questions
Colang 2.0 based bot
Support deployment using the Chat Engine Server Architecture and Event Architecture
Docker-based bot deployment
The Stock bot uses the gpt-4-turbo model
from OpenAI as the main model. This sample is present in the quickstart directory at ./samples/stock_bot
.
Set the OpenAI API key environment variable.
export OPENAI_API_KEY=...
Prepare the environment for the Docker compose commands.
export BOT_PATH=./samples/stock_bot source deploy/docker/docker_init.sh
Deploy the Speech and NLP models required for the bot. This might take 20-40 minutes for the first time. With the Stock Market sample bot, Riva ASR (Automatic Speech Recognition) and TTS (Text to Speech) models will be deployed.
docker compose -f deploy/docker/docker-compose.yml up model-utils-speech
Deploy the ACE Agent microservices. Deploy the Chat Controller, Chat Engine, Plugin server, and NLP server microservices.
docker compose -f deploy/docker/docker-compose.yml up speech-event-bot-d
Wait for a few minutes for all services to be ready. You can check the Docker logs for individual microservices to confirm. You will see log print
Server listening on 0.0.0.0:50055
in the Docker logs for the Chat Controller container.Interact with the bot using the URL
http://<workstation IP>:7006/
. For accessing the mic on the browser, we need to either converthttp
tohttps
endpoint by adding SSL validation or update yourchrome://flags/
oredge://flags/
to allowhttp://<workstation IP>:7006
as a secure endpoint.
![Stock Market bot sample conversation](../../../_images/stock-market-bot.png)