# Stocks Overview (investing.com) (`pintostudio/stocks-overview-investing-com`) Actor

This Apify actor fetches stock overview data from Investing.com for a specified country. It retrieves up to 1,000 stock entries with key financial metrics and summarizes market sentiment.

- **URL**: https://apify.com/pintostudio/stocks-overview-investing-com.md
- **Developed by:** [Pinto Studio](https://apify.com/pintostudio) (community)
- **Categories:** Other, Automation, Developer tools
- **Stats:** 3 total users, 0 monthly users, 58.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.40 / 1,000 results

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

## 📈 Stocks Overview Data (Investing.com) – Apify Actor Documentation

This Apify actor fetches stock overview data from [Investing.com](https://www.investing.com) for a specified country. It retrieves up to 1,000 stock entries with key financial metrics and summarizes market sentiment.

***

### 📌 Overview

The **Stocks Overview Data (Investing.com)** actor retrieves structured financial data for publicly traded companies based on country selection. The actor supports advanced filtering, data enrichment, and result summarization.

Typical use cases include:

- Daily stock performance snapshots
- Investment insights by region
- Real-time reporting dashboards
- Quantitative analysis pipelines

***

### ✅ Output Format

The actor pushes each stock record to the Apify dataset in the following structure:

```json
{
  "country": "united states",
  "name": "Boeing",
  "symbol": "BA",
  "last": 218.52,
  "high": 220.0,
  "low": 214.72,
  "change": "-0.11",
  "change_percentage": "-0.05%",
  "turnover": 6770000.0,
  "currency": "USD",
  "retrieved_at": "2025-07-09T09:00:18.847563",
  "data_type": "stock_overview"
}
```

Additionally, a summary object is saved under the key `stocks_overview_summary` using `Actor.set_value()`:

```json
{
  "country": "united states",
  "n_results": 100,
  "has_data": true,
  "retrieved_at": "2025-07-09T09:00:18.847563",
  "data_format": "list",
  "total_stocks": 100,
  "currencies": ["USD"],
  "sectors_count": 8,
  "avg_stock_price": 103.55,
  "highest_stock_price": 570.1,
  "lowest_stock_price": 3.2,
  "stocks_with_positive_change": 53,
  "stocks_with_negative_change": 47,
  "market_sentiment": "positive",
  "top_performers": [
    {
      "name": "Company A",
      "symbol": "CMPA",
      "change_percentage": "7.12%"
    },
    ...
  ]
}
```

***

### 📥 How It Works

1. **Input Retrieval**: Accepts a country and optional `nResults` (max 1000).
2. **Validation**: Checks that input types and values are valid.
3. **Data Fetching**: Calls `get_stocks_overview()` to retrieve data.
4. **Data Storage**: Stores each record in the dataset.
5. **Summary Generation**: Calculates:

   - Number of stocks
   - Average, highest, and lowest stock prices
   - Count of stocks with price increase/decrease
   - Market sentiment analysis
   - Top 5 performing stocks
6. **Error Handling**: Captures and logs detailed error types (`ValueError`, `IOError`, etc.) with metadata.

***

### 🧠 Key Features

- Supports **48 countries**
- Customizable result count (1–1000)
- Adds enhanced metadata for each entry
- Provides real-time summary and market insight
- Fully async for optimal performance
- Robust error handling and logging

***

### ⚠️ Error Handling

If any error occurs, a record with `data_type: "error"` is pushed, including:

```json
{
  "country": "france",
  "n_results": 100,
  "error_type": "ConnectionError",
  "error_message": "Connection timed out",
  "retrieved_at": "2025-07-09T09:00:18.847563",
  "data_type": "error"
}
```

In addition, `Actor.fail()` is called to mark the run as failed.

***

### 🧪 Example Input

```json
{
  "country": "united states",
  "nResults": 50
}
```

### 📤 Example Output (single record)

```json
{
  "country": "united states",
  "name": "Apple Inc.",
  "symbol": "AAPL",
  "last": 192.64,
  "high": 195.0,
  "low": 190.5,
  "change": "+1.24",
  "change_percentage": "+0.65%",
  "turnover": 98000000,
  "currency": "USD",
  "retrieved_at": "2025-07-09T09:00:18.847563",
  "data_type": "stock_overview"
}
```

***

### 🚀 Deployment

This actor is deployed on the [Apify platform](https://apify.com). You can run it via:

- **Apify Console UI**
- **API call**
- **Schedule (cron-like)**

***

### 🧼 Output Keys

| Field                         | Description                            |
| ----------------------------- | -------------------------------------- |
| `name`                        | Company name                           |
| `symbol`                      | Ticker symbol                          |
| `last`                        | Last traded price                      |
| `high`, `low`                 | Daily high and low prices              |
| `change`, `change_percentage` | Price change and percent delta         |
| `turnover`                    | Trade volume                           |
| `currency`                    | Currency code (e.g., USD, EUR)         |
| `retrieved_at`                | ISO timestamp when data was fetched    |
| `data_type`                   | Either `"stock_overview"` or `"error"` |

***

### Support

If you have any questions or encounter any issues, please consult the Apify documentation or reach out to us through one of the following channels:

- Verify input parameters match the schema requirements
- Check the Apify platform documentation
- Review the actor logs for detailed error messages

* **Telegram**: [@pintoflow](https://t.me/pintoflow)
* **Apify Platform**: You can also contact us directly through this platform.

***

# Actor input Schema

## `country` (type: `string`):

The country where the stock is listed

## `nResults` (type: `integer`):

Number of stocks to retrieve in the overview (1-1000). Default is 100 for the top stocks.

## Actor input object example

```json
{
  "country": "united states",
  "nResults": 100
}
```

# 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 = {
    "nResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("pintostudio/stocks-overview-investing-com").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 = { "nResults": 100 }

# Run the Actor and wait for it to finish
run = client.actor("pintostudio/stocks-overview-investing-com").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 '{
  "nResults": 100
}' |
apify call pintostudio/stocks-overview-investing-com --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pintostudio/stocks-overview-investing-com"
        }
    }
}
```

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/WcDSsluGUmV411lde/builds/5JHKBTqWb8ATemsGV/openapi.json
