# Finance Monitoring Agent (`jakub.kopecky/finance-monitoring-agent`) Actor

The Finance Monitoring AI Agent 📊💹 analyzes specific tickers, gathering, and processing data to generate insightful reports 📈📉. Designed for investors and analysts, this agent provides detailed performance analysis and trends. The agent is built using LangGraph and Python.

- **URL**: https://apify.com/jakub.kopecky/finance-monitoring-agent.md
- **Developed by:** [Jakub Kopecký](https://apify.com/jakub.kopecky) (community)
- **Categories:** AI, News, Open source
- **Stats:** 89 total users, 0 monthly users, 100.0% runs succeeded, 11 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 price per 100 openai tokens for gpt-4os

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Finance Monitoring Agent 📊💹

[![Agent Actor Inspector](https://apify.com/actor-badge?actor=jakub.kopecky/finance-monitoring-agent)](https://apify.com/jakub.kopecky/finance-monitoring-agent)
[![GitHub Repo stars](https://img.shields.io/github/stars/apify/actor-finance-monitoring-agent)](https://github.com/apify/actor-finance-monitoring-agent/stargazers)

The **Finance Monitoring Agent** is an Apify AI Actor tailored for investors and analysts, providing comprehensive analysis of specific stock tickers. It gathers, processes, and produces insightful reports to help understand market trends, performance metrics, and sentiment analysis.

### 🌟 What is Finance Monitoring Agent?

This agent is designed to:

- **Analyze stock tickers**: Focuses on specific stocks to deliver detailed performance insights.
- **Generate reports**: Creates structured reports in markdown format, summarizing key financial data, trends, and sentiment analysis.
- **Leverage AI**: Utilizes OpenAI's capabilities, allowing customization between more advanced (GPT-4o) or faster, cheaper (GPT-4o Mini) models for analysis.
- **Provide downloadable output**: The **report.md** file can be downloaded from the **key-value store** in the storage section of the Actor run details.

***

### 🎯 Features of Finance Monitoring AI Agent

- **Detailed Stock Analysis**: Provides in-depth analysis including sentiment, performance, and market trends.
- **Customizable AI Models**: Choose between gpt-4o, gpt-4o-mini and the reasoning models o1 and o3-mini.

***

### 📈 Data Providers

The **Finance Monitoring Agent** leverages multiple data sources to ensure comprehensive and accurate analysis:

- **Google Finance**: Provides essential ticker information and financial data for the ticker analysis. Using [Google Finance](https://apify.com/scraped_org/google-finance-scraper) Apify Actor.
- **Google News**: Searches for relevant news articles to include in the sentiment analysis and overall report. Using [Google News Scraper](https://apify.com/lhotanova/google-news-scraper) Apify Actor.

***

### 🚀 How it works

1. **Input**: Specify the stock ticker, choose your AI model, and provide your OpenAI API key.
2. **Processing**: The agent fetches real-time data, processes it using the selected AI model, and compiles a report.
3. **Output**: Generates a markdown report with analysis, which is pushed to Apify's dataset for review.

#### 💰 Pricing

This Actor uses the [Pay Per Event](https://docs.apify.com/sdk/js/docs/next/guides/pay-per-event) (PPE) monetization model, which provides flexible pricing based on defined events. Currently the Actor charges for Actor startup and for total token usage (based on OpenAI API output token price).

The Actor's pricing is based on the following events:

| Event | Price (USD) |
|-------|-------------|
| Actor startup (each 1 GB of memory) | $0.005 |
| gpt-4o (100 tokens) | $0.001 |
| gpt-4o-mini (100 tokens) | $0.00006 |
| o1 (100 tokens) | $0.006 |
| o3-mini (100 tokens) | $0.00044 |

#### Input Example

```json
{
  "ticker": "TSLA",
  "model": "gpt-4o",
}
```

#### Output Example

Sample report from the **Finance Monitoring Agent** for the `TSLA` ticker is available [here](docs/report.md).

Actor dataset output with structured sentiment analysis looks like this:

```json
{
  "ticker": "TSLA",
  "sentiment": "hold",
  "sentiment_reason": "Despite strong market position, the recall and negative outlook...",
  "report": "..."
}
```

***

### ✨ Why use Finance Monitoring AI Agent?

- **Time Efficiency**: Automates the analysis process, providing quick insights without manual data crunching.
- **Enhanced Decision Making**: Offers sentiment analysis alongside performance metrics, aiding in investment decisions.
- **Scalability**: Can analyze multiple tickers by running multiple instances of the Actor in parallel.
- **AI-Driven Insights**: Leverages the latest in AI technology for nuanced market analysis.

***

### 🔧 Technical Highlights

- **Built with Apify SDK**: Ensures robust, scalable web scraping and data processing.
- **AI Integration**: Seamless interaction with OpenAI models for dynamic content generation.

***

### 📖 Learn more

- [Apify platform](https://apify.com)
- [Apify SDK documentation](https://docs.apify.com/sdk/python)
- [What are AI Agents?](https://blog.apify.com/what-are-ai-agents/)
- [AI agent architecture](https://blog.apify.com/ai-agent-architecture)
- [How to build an AI agent on Apify](https://blog.apify.com/how-to-build-an-ai-agent/)

***

Start leveraging AI for your financial analysis today and make informed investment decisions with ease! 📈🤖

***

🌐 Open source

This Actor is open source, hosted on [GitHub](https://github.com/apify/actor-finance-monitoring-agent).

***

### Development

Clone the repository and install the dependencies:

```bash
git clone https://github.com/apify/finance-monitoring-agent
cd finance-monitoring-agent

uv sync
## or make install-dev
```

To run the Actor locally, use the following command:

```bash
apify run -p -i '{"ticker": "TSLA", "model": "gpt-4o"}'
## in debug mode
#apify run -p -i '{"debug": true, "ticker": "TSLA", "model": "gpt-4o"}'
```

The output report will be saved in the **storage/key_value_stores/default/** directory.

# Actor input Schema

## `ticker` (type: `string`):

The ticker of the stock to analyze (e.g. TSLA, AAPL, AMZN).

## `model` (type: `string`):

The OpenAI model to use. Currently supported models are gpt-4o and gpt-4o-mini and the reasoning models o1 and o3-mini. For best results, use gpt-4o.

## `debug` (type: `boolean`):

If enabled, the Actor will run in debug mode and produce more output.

## Actor input object example

```json
{
  "ticker": "TSLA",
  "model": "gpt-4o-mini",
  "debug": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "ticker": "TSLA",
    "model": "gpt-4o-mini"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jakub.kopecky/finance-monitoring-agent").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "ticker": "TSLA",
    "model": "gpt-4o-mini",
}

# Run the Actor and wait for it to finish
run = client.actor("jakub.kopecky/finance-monitoring-agent").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "ticker": "TSLA",
  "model": "gpt-4o-mini"
}' |
apify call jakub.kopecky/finance-monitoring-agent --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jakub.kopecky/finance-monitoring-agent"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CSqK7TApjVrnH9LpJ/builds/zgc7XTp0D1lfucZMS/openapi.json
