AlphaBot Financial Summary

Test this app for free
30
import os
import discord
from discord.ext import commands
from discord.ext import tasks
from alpha_vantage_api import get_company_financials
from llm_summary import summarize_financials

def generate_oauth_link(client_id):
    base_url = "https://discord.com/api/oauth2/authorize"
    redirect_uri = "http://localhost"
    scope = "bot"
    permissions = "8"  # Administrator permission for simplicity, adjust as needed.
    return f"{base_url}?client_id={client_id}&permissions={permissions}&scope={scope}"

def start_bot(token):
    intents = discord.Intents.default()
    intents.messages = True
    intents.message_content = True
    bot = commands.Bot(command_prefix='/', intents=intents)

    @bot.event
    async def on_ready():
        print(f'Bot is ready. Logged in as {bot.user}')
Get full code

Created: | Last Updated:

AlphaBot Financial Summary: A Discord bot that utilizes the Alpha Vantage API to provide AI-generated summaries of income statements, balance sheets, and cash flow for renowned US companies.

Introduction to the AlphaBot Financial Summary Template

The AlphaBot Financial Summary template is designed to create a Discord bot that utilizes the Alpha Vantage API to provide AI-generated summaries of financial statements, balance sheets, and cash flow for renowned US companies. This bot can analyze financial data and provide summaries directly in a Discord channel.

Clicking Start with this Template

To get started with the AlphaBot Financial Summary template, click the "Start with this Template" button in the Lazy Builder interface.

Initial Setup

Before testing the app, you need to set up the following environment secrets in the Environment Secrets tab within the Lazy Builder:

  • CLIENT_ID: Your Discord application's client ID. You can find this in the Discord Developer Portal under your application's settings.
  • BOT_TOKEN: Your Discord bot token. This is also available in the Discord Developer Portal under your application's settings.
  • ALPHA_VANTAGE_API_KEY: Your Alpha Vantage API key. You can obtain this by signing up for an API key on the Alpha Vantage website.

Steps to obtain the required environment secrets:

  • Discord Client ID and Bot Token:
    1. Go to the Discord Developer Portal.
    2. Create a new application or select an existing one.
    3. Navigate to the "Bot" section and create a bot if you haven't already.
    4. Copy the "Client ID" from the "General Information" section.
    5. Copy the "Bot Token" from the "Bot" section.
  • Alpha Vantage API Key:
    1. Sign up for an API key on the Alpha Vantage website.
    2. Copy the API key provided after registration.

Test

Press the "Test" button in the Lazy Builder interface to deploy the app. The Lazy CLI will handle the deployment process.

Entering Input

After pressing the "Test" button, the Lazy App's CLI interface will appear. You will be prompted to provide the following input:

  • symbol: The stock symbol of the company you want to analyze. For example, AAPL for Apple Inc.

Using the App

Once the bot is deployed and running, you can use the following commands in your Discord channel:

  • /analyse [symbol]: Analyze the financial statements of a company. Replace [symbol] with the stock symbol of the company.
  • /hi: The bot will respond with "hi" to the channel.

Integrating the App

To invite the bot to your Discord server, use the OAuth link generated in the console output after deployment. The link will look something like this:

https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=8&scope=bot Replace YOUR_CLIENT_ID with your actual client ID.

Follow these steps to invite the bot to your server:

  • Copy the OAuth link from the console output.
  • Paste the link into your web browser and press Enter.
  • Select the server you want to add the bot to and authorize the bot.

Once the bot is added to your server, you can start using the commands mentioned above to interact with the bot and analyze financial data.

Technologies

Discord Automation & Bots Discord Automation & Bots

Similar templates

We found some blogs you might like...