# Indonesia Stock Market Scraper (`jokosakti/indonesia-stock-market-scraper`) Actor

Fast, lightweight, and reliable scraper to extract real-time prices and key fundamental metrics (P/E Ratio, Market Cap) for the top 45 blue-chip companies (LQ45) on the Indonesia Stock Exchange.

- **URL**: https://apify.com/jokosakti/indonesia-stock-market-scraper.md
- **Developed by:** [Enrico Tunggul Dewangga](https://apify.com/jokosakti) (community)
- **Categories:** Developer tools, Other
- **Stats:** 3 total users, 0 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Indonesia Stock Market Scraper

### English

Apify actor for scraping IDX/LQ45 stock quote data from Yahoo Finance.

#### Features

- Supports IDX tickers such as `BBCA` or `BBCA.JK`.
- Automatically normalizes tickers to the `.JK` suffix.
- Uses the full default LQ45 list defined in the code when no symbols are provided.
- Can limit the number of processed symbols through `maxItems`.
- Can filter saved dataset fields through `outputFields`.
- Uses Playwright as the primary path and falls back to price data recovery when the main Yahoo Finance DOM is incomplete.
- Generates an HTML output report in Apify so users can review results in a cleaner UI than raw JSON alone.

#### Output

Available fields:

- `symbol`
- `name`
- `price`
- `marketCap`
- `peRatio`
- `forwardPe`
- `priceToBook`
- `previousClose`
- `open`
- `volume`
- `avgVolume`
- `dayRange`
- `fiftyTwoWeekRange`
- `timestamp`

Full 5-symbol sample dataset:

- Input example: `examples/full-output-5-symbols-input.json`
- Output example: `examples/full-output-5-symbols.json`

#### Actor Input

Example input:

```json
{
  "maxItems": 45,
  "outputFields": ["symbol", "name", "price", "marketCap", "volume", "timestamp"],
  "useFallbackOnly": false
}
````

Details:

- `symbols`: list of IDX tickers. You can provide `BBCA` or `BBCA.JK`. If omitted, the actor uses the default LQ45 list.
- `maxItems`: limits how many symbols are processed after normalization and deduplication.
- `outputFields`: if provided, only the selected fields are stored in the dataset.
- `useFallbackOnly`: uses only the Yahoo chart API without DOM scraping.

#### Sample Output

```json
[
  {
    "symbol": "BBCA.JK",
    "name": "PT Bank Central Asia Tbk (BBCA.JK)",
    "price": "6,725.00",
    "marketCap": "808.81T",
    "peRatio": "14.08",
    "forwardPe": "13.21",
    "priceToBook": "2.87",
    "previousClose": "6,575.00",
    "open": "6,675.00",
    "volume": "64,289,000",
    "avgVolume": "213,106,377",
    "dayRange": "6,675.00 - 6,800.00",
    "fiftyTwoWeekRange": "6,350.00 - 9,800.00",
    "timestamp": "2026-04-14T05:02:10.938Z"
  }
]
```

#### Important Notes

- The recommended default mode is `useFallbackOnly: false`.
- `useFallbackOnly: true` is available, but Yahoo may return `429 Too Many Requests` for HTTP-only requests. Use it only when needed.
- The actor is more stable with low concurrency. The current configuration uses `maxConcurrency: 1`.
- The currently validated working versions are `apify 3.7.0`, `crawlee 3.16.0`, and `playwright 1.59.1`.

#### Run Locally

Install dependencies:

```bash
npm install
```

Run the actor:

```bash
npm start
```

The local sample input is stored in `storage/key_value_stores/default/INPUT.json`.

#### Push To Apify

Make sure the Apify CLI is logged in:

```bash
apify login
```

Then push the actor:

```bash
apify push
```

The actor input schema is defined in `.actor/input_schema.json`, so the input form renders properly in Apify Console.

#### Output Tab

The actor also generates an HTML report and a JSON summary in the default key-value store. In Apify Console, these are exposed in the Output tab for a cleaner post-run experience.

#### Actor Schemas

- `.actor/input_schema.json`: controls the run input form in Apify Console.
- `.actor/output_schema.json`: defines what appears in the Output tab after a run.
- `.actor/dataset_schema.json`: documents dataset item fields and configures `Overview`, `Compact Quotes`, `Valuation Focus`, `Liquidity Watch`, and `Full Metrics` views.
- `.actor/key_value_store_schema.json`: groups HTML report, summary JSON, error JSON, and SDK diagnostics in the Storage tab.

### Bahasa Indonesia

Actor Apify untuk mengambil data quote emiten IDX/LQ45 dari Yahoo Finance.

#### Fitur

- Mendukung input ticker IDX seperti `BBCA` atau `BBCA.JK`.
- Otomatis menormalkan ticker ke suffix `.JK`.
- Default list memakai seluruh daftar LQ45 yang ada di kode.
- Bisa membatasi jumlah simbol lewat `maxItems`.
- Bisa memfilter field output lewat `outputFields`.
- Menggunakan Playwright untuk jalur utama dan fallback data harga jika DOM utama tidak lengkap.
- Menghasilkan laporan HTML di Apify Output tab agar hasil run lebih mudah dibaca dibanding JSON mentah saja.

#### Output

Field yang tersedia:

- `symbol`
- `name`
- `price`
- `marketCap`
- `peRatio`
- `forwardPe`
- `priceToBook`
- `previousClose`
- `open`
- `volume`
- `avgVolume`
- `dayRange`
- `fiftyTwoWeekRange`
- `timestamp`

Contoh dataset penuh untuk 5 emiten:

- Input contoh: `examples/full-output-5-symbols-input.json`
- Output contoh: `examples/full-output-5-symbols.json`

#### Input Actor

Contoh input:

```json
{
  "maxItems": 45,
  "outputFields": ["symbol", "name", "price", "marketCap", "volume", "timestamp"],
  "useFallbackOnly": false
}
```

Keterangan:

- `symbols`: daftar ticker IDX. Boleh `BBCA` atau `BBCA.JK`. Jika dikosongkan, actor memakai daftar default LQ45.
- `maxItems`: membatasi jumlah simbol yang diproses setelah normalisasi dan deduplikasi.
- `outputFields`: jika diisi, dataset hanya menyimpan field yang dipilih.
- `useFallbackOnly`: hanya memakai chart API Yahoo tanpa scraping DOM.

#### Contoh Output

```json
[
  {
    "symbol": "BBCA.JK",
    "name": "PT Bank Central Asia Tbk (BBCA.JK)",
    "price": "6,725.00",
    "marketCap": "808.81T",
    "peRatio": "14.08",
    "forwardPe": "13.21",
    "priceToBook": "2.87",
    "previousClose": "6,575.00",
    "open": "6,675.00",
    "volume": "64,289,000",
    "avgVolume": "213,106,377",
    "dayRange": "6,675.00 - 6,800.00",
    "fiftyTwoWeekRange": "6,350.00 - 9,800.00",
    "timestamp": "2026-04-14T05:02:10.938Z"
  }
]
```

#### Catatan Penting

- Mode default yang direkomendasikan adalah `useFallbackOnly: false`.
- `useFallbackOnly: true` sudah tersedia, tetapi Yahoo kadang memberi `429 Too Many Requests` untuk jalur HTTP-only. Gunakan hanya jika memang perlu.
- Actor ini lebih stabil bila dijalankan dengan concurrency rendah. Konfigurasi saat ini memakai `maxConcurrency: 1`.
- Versi yang tervalidasi berjalan normal: `apify 3.7.0`, `crawlee 3.16.0`, dan `playwright 1.59.1`.

#### Jalankan Lokal

Install dependency:

```bash
npm install
```

Jalankan actor:

```bash
npm start
```

Contoh input lokal ada di `storage/key_value_stores/default/INPUT.json`.

#### Push Ke Apify

Pastikan Apify CLI sudah login:

```bash
apify login
```

Lalu push actor:

```bash
apify push
```

Schema input actor ada di `.actor/input_schema.json`, sehingga field input akan muncul rapi di Apify Console.

#### Output Tab

Actor ini juga membuat laporan HTML dan ringkasan JSON di key-value store default. Di Apify Console, hasil tersebut bisa ditampilkan di Output tab agar pengalaman pengguna lebih nyaman.

#### Schema Actor

- `.actor/input_schema.json`: mengatur form input di Apify Console.
- `.actor/output_schema.json`: menentukan apa yang muncul di Output tab setelah run selesai.
- `.actor/dataset_schema.json`: mendeskripsikan field dataset dan mengatur view `Overview`, `Compact Quotes`, `Valuation Focus`, `Liquidity Watch`, dan `Full Metrics`.
- `.actor/key_value_store_schema.json`: mengelompokkan laporan HTML, summary JSON, error JSON, dan file diagnostik SDK di Storage tab.

# Actor input Schema

## `symbols` (type: `array`):

List of IDX stock tickers. You can use BBCA or BBCA.JK. Leave empty to use the default full LQ45 list.

## `maxItems` (type: `integer`):

Maximum number of symbols to process after normalization and deduplication.

## `outputFields` (type: `array`):

Choose which fields should be stored in the dataset. Leave empty to store all available fields.

## `useFallbackOnly` (type: `boolean`):

If enabled, the actor skips browser-based scraping and uses only the Yahoo chart API. This is cheaper and faster, but fundamental fields may be unavailable.

## Actor input object example

```json
{
  "maxItems": 45,
  "outputFields": [
    "symbol",
    "name",
    "price",
    "marketCap",
    "peRatio"
  ],
  "useFallbackOnly": false
}
```

# Actor output Schema

## `results` (type: `string`):

Main scraped quote and valuation dataset. Apify Console will allow switching between the dataset views defined in dataset\_schema.json.

## `interactiveReport` (type: `string`):

Visual HTML summary of the run with KPI cards, top-5 snapshot cards, full result table, and errors section.

## `runSummaryFiles` (type: `string`):

Summary-related artifacts from the default key-value store. Currently includes OUTPUT\_SUMMARY.

## `runErrorFiles` (type: `string`):

Error artifacts written during the run. Currently includes RUN\_ERRORS when any request fails or retries are recorded.

## `sdkDiagnostics` (type: `string`):

Crawler statistics and SDK state artifacts useful for debugging rate limits, timeouts, and cloud run behavior.

# 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 = {
    "outputFields": [
        "symbol",
        "name",
        "price",
        "marketCap",
        "peRatio"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("jokosakti/indonesia-stock-market-scraper").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 = { "outputFields": [
        "symbol",
        "name",
        "price",
        "marketCap",
        "peRatio",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("jokosakti/indonesia-stock-market-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "outputFields": [
    "symbol",
    "name",
    "price",
    "marketCap",
    "peRatio"
  ]
}' |
apify call jokosakti/indonesia-stock-market-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=jokosakti/indonesia-stock-market-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Indonesia Stock Market Scraper",
        "description": "Fast, lightweight, and reliable scraper to extract real-time prices and key fundamental metrics (P/E Ratio, Market Cap) for the top 45 blue-chip companies (LQ45) on the Indonesia Stock Exchange.",
        "version": "1.1",
        "x-build-id": "5DzRZGBEbE7y5uFqC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/jokosakti~indonesia-stock-market-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-jokosakti-indonesia-stock-market-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/jokosakti~indonesia-stock-market-scraper/runs": {
            "post": {
                "operationId": "runs-sync-jokosakti-indonesia-stock-market-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/jokosakti~indonesia-stock-market-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-jokosakti-indonesia-stock-market-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "symbols": {
                        "title": "Stock Tickers",
                        "type": "array",
                        "description": "List of IDX stock tickers. You can use BBCA or BBCA.JK. Leave empty to use the default full LQ45 list.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Maximum items",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of symbols to process after normalization and deduplication.",
                        "default": 45
                    },
                    "outputFields": {
                        "title": "Selected Output Fields",
                        "type": "array",
                        "description": "Choose which fields should be stored in the dataset. Leave empty to store all available fields.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "useFallbackOnly": {
                        "title": "Use Fallback Only",
                        "type": "boolean",
                        "description": "If enabled, the actor skips browser-based scraping and uses only the Yahoo chart API. This is cheaper and faster, but fundamental fields may be unavailable.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
