# Stock Recent Data (`pintostudio/stock-recent-data`) Actor

The Stock Recent Data (Investing.com) actor is a powerful tool designed to fetch recent stock market data from Investing.com for any specified stock symbol across multiple countries.

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

## Pricing

$9.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Stock Recent Data (Investing.com) - Actor Documentation

### Overview

The **Stock Recent Data (Investing.com)** actor is a powerful tool designed to fetch recent stock market data from Investing.com for any specified stock symbol across multiple countries. This actor provides comprehensive historical stock data including price movements, trading volumes, and other essential market metrics.

### Features

- **Multi-Country Support**: Fetch stock data from 46+ countries including major markets like US, UK, Germany, Japan, China, and more
- **Flexible Data Intervals**: Choose from Daily, Weekly, or Monthly data intervals
- **Customizable Ordering**: Get data in ascending (oldest first) or descending (newest first) order
- **JSON Output**: Returns structured JSON data for easy integration
- **Comprehensive Data**: Includes open, high, low, close prices, volume, and currency information
- **Error Handling**: Robust error handling with detailed logging
- **Summary Statistics**: Automatically calculates average, min, max values and volume statistics

### Input Parameters

#### Required Parameters

- **stockSymbol** (string, required)
  - Stock symbol to retrieve data for (e.g., 'AAPL', 'BBVA', 'MSFT')
  - Must be 1-10 characters long
  - Example: `"AAPL"`

#### Optional Parameters

- **country** (string, optional)
  - The country where the stock is listed
  - Default: `"united states"`
  - Supported countries include:
    - United States, United Kingdom, Germany, France, Italy, Spain
    - Japan, China, South Korea, India, Australia, Canada
    - Brazil, Mexico, Argentina, Chile, Colombia, Peru
    - And many more (46+ countries total)

- **order** (string, optional)
  - Controls the chronological order of returned data
  - Options: `"ascending"`, `"asc"`, `"descending"`, `"desc"`
  - Default: `"ascending"`
  - `"ascending"`: Oldest data first
  - `"descending"`: Newest data first

- **interval** (string, optional)
  - Time interval for the historical data
  - Options: `"Daily"`, `"Weekly"`, `"Monthly"`
  - Default: `"Daily"`

### Example Input

```json
{
  "stockSymbol": "AAPL",
  "country": "united states",
  "order": "ascending",
  "interval": "Daily"
}
```

### Output Structure

The actor returns a comprehensive dataset with the following structure:

#### Main Output Object

```json
{
  "stock": "aapl",
  "country": "united states",
  "stock_symbol": "AAPL",
  "as_json": true,
  "order": "ascending",
  "interval": "Daily",
  "retrieved_at": "2025-07-08T12:20:06.605899",
  "data_format": "recent_data",
  "has_data": true,
  "recent_data": {
    "name": "Apple",
    "recent": [
      // Array of historical data points
    ]
  },
  "total_records": 19,
  "latest_date": "07/07/2025",
  "latest_close": 209.95,
  "latest_volume": 50228984,
  "currency": "USD",
  "stock_name": "Apple"
}
```

#### Historical Data Points

Each data point in the `recent_data.recent` array contains:

```json
{
  "date": "07/07/2025",
  "open": 212.68,
  "high": 216.23,
  "low": 208.8,
  "close": 209.95,
  "volume": 50228984,
  "currency": "USD"
}
```

#### Field Descriptions

- **stock**: Normalized stock symbol (lowercase)
- **country**: Country where the stock is listed
- **stock\_symbol**: Original stock symbol (uppercase)
- **as\_json**: Always `true` (data format indicator)
- **order**: Data ordering preference
- **interval**: Data interval (Daily/Weekly/Monthly)
- **retrieved\_at**: Timestamp when data was fetched
- **data\_format**: Always `"recent_data"`
- **has\_data**: Boolean indicating if data was successfully retrieved
- **recent\_data**: Object containing stock name and historical data array
- **total\_records**: Number of historical data points retrieved
- **latest\_date**: Date of the most recent data point
- **latest\_close**: Most recent closing price
- **latest\_volume**: Most recent trading volume
- **currency**: Currency of the stock prices
- **stock\_name**: Full company name

#### Statistical Data (when available)

The output may also include calculated statistics:

- **avg\_close**: Average closing price across all data points
- **min\_close**: Minimum closing price
- **max\_close**: Maximum closing price
- **avg\_volume**: Average trading volume
- **total\_volume**: Total trading volume across all data points

### Usage Examples

#### Basic Usage

```json
{
  "stockSymbol": "AAPL"
}
```

#### Advanced Usage

```json
{
  "stockSymbol": "BBVA",
  "country": "spain",
  "order": "descending",
  "interval": "Weekly"
}
```

#### Multiple Market Example

```json
{
  "stockSymbol": "SONY",
  "country": "japan",
  "order": "ascending",
  "interval": "Daily"
}
```

### Error Handling

The actor includes comprehensive error handling for various scenarios:

- **Validation Errors**: Invalid input parameters
- **IO Errors**: Network or data access issues
- **Runtime Errors**: Unexpected execution problems
- **Connection Errors**: Network connectivity issues
- **File Not Found**: Missing data or resources

When errors occur, the actor will:

1. Log detailed error information
2. Return an error response with `has_data: false`
3. Include error details in the `error` field

### Performance Considerations

- The actor processes data efficiently and returns results quickly
- Large datasets are handled with appropriate memory management
- Network requests are optimized for reliability
- Data is cached appropriately to improve performance

### Integration Tips

1. **Check `has_data` field**: Always verify this boolean before processing the data
2. **Handle different intervals**: Be aware that Weekly/Monthly data will have fewer data points
3. **Currency awareness**: Check the `currency` field for proper price interpretation
4. **Date formatting**: Dates are returned in DD/MM/YYYY format
5. **Volume data**: Volume numbers are provided as integers (actual share count)

### Supported Countries

The actor supports stock data from these countries:

**Major Markets**: United States, United Kingdom, Germany, France, Italy, Spain, Japan, China, South Korea, India, Australia, Canada

**European Markets**: Netherlands, Belgium, Portugal, Austria, Switzerland, Norway, Sweden, Denmark, Finland, Poland, Czech Republic, Hungary, Greece, Turkey, Russia

**Asian Markets**: Malaysia, Singapore, Thailand, Indonesia, Philippines, Vietnam, Taiwan, Hong Kong

**Americas**: Brazil, Mexico, Argentina, Chile, Colombia, Peru

**Other Markets**: South Africa, Israel, Saudi Arabia, United Arab Emirates, New Zealand

### Data Freshness

The actor fetches the most recent available data from Investing.com. The freshness of data depends on:

- Market hours and trading sessions
- Weekend and holiday schedules
- Exchange-specific data availability
- Real-time vs. delayed data policies

### Limitations

- Data availability depends on Investing.com's coverage
- Some stocks may not be available in all countries
- Historical data depth varies by stock and market
- Real-time data may have delays depending on exchange policies

### 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

## `stockSymbol` (type: `string`):

Stock symbol to retrieve historical data from (e.g., 'AAPL', 'BBVA', 'MSFT')

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

The country where the stock is listed

## `order` (type: `string`):

The order of the retrieved historical data by date

## `interval` (type: `string`):

The time interval for the historical data

## Actor input object example

```json
{
  "stockSymbol": "AAPL",
  "country": "united states",
  "order": "ascending",
  "interval": "Daily"
}
```

# 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 = {
    "stockSymbol": "AAPL",
    "order": "ascending",
    "interval": "Daily"
};

// Run the Actor and wait for it to finish
const run = await client.actor("pintostudio/stock-recent-data").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 = {
    "stockSymbol": "AAPL",
    "order": "ascending",
    "interval": "Daily",
}

# Run the Actor and wait for it to finish
run = client.actor("pintostudio/stock-recent-data").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 '{
  "stockSymbol": "AAPL",
  "order": "ascending",
  "interval": "Daily"
}' |
apify call pintostudio/stock-recent-data --silent --output-dataset

```

## MCP server setup

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

```

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/IEkjl9cuARyMKahSk/builds/WGJTYKtFra1uQmpFk/openapi.json
