The Financial Data Handler is a tool that helps get important financial information from online sources. It allows businesses or individuals to easily access real-time data like stock prices, company financial details, and income statements. This information can be used for tracking market trends, analyzing a company’s performance, or making better investment decisions.

Refer the link to know more details about symbol from the document here.

Example

This code sets up a FinancialHandler to access financial data using an API key and specifies the stock symbol for Amazon (AMZN). This allows for retrieving stock market information and other financial data programmatically.

To use Financial Modeling, you’ll need to create an Financial Modeling account and get an API key. For more details refer here.

Set up a FINANCIAL_DATA_API_KEY key as an environmental variable and run the following code.

export FINANCIAL_DATA_API_KEY = "**************************"
financial_handler.py
import os
import asyncio

from superagentx.handler.financial_data import FinancialHandler


async def get_stock_price():
    financial_handler = FinancialHandler(
        symbol='AMZN'
    )
    return await financial_handler.get_stock_price()


async def main():
    res = await get_stock_price()
    print(res)

if __name__ == '__main__':
    asyncio.run(main())

Result

Stock price Output:
{
  "data": [
    {
      "symbol": "AA",
      "name": "Alcoa Corporation",
      "price": 41.71,
      "changesPercentage": 3.3705,
      "change": 1.36,
      "dayLow": 40.86,
      "dayHigh": 42.1659,
      "yearHigh": 45.48,
      "yearLow": 23.07,
      "marketCap": 10775361358,
      "priceAvg50": 34.709,
      "priceAvg200": 34.4335,
      "exchange": "NYSE",
      "volume": 4489893,
      "avgVolume": 6216657,
      "open": 41.77,
      "previousClose": 40.35,
      "eps": -1.56,
      "pe": -26.74,
      "earningsAnnouncement": "2025-01-15T05:00:00.000+0000",
      "sharesOutstanding": 258339999,
      "timestamp": 1729281602
    }
  ]
}