# Indian Stocks: NSE/BSE Data & Financials (`fascinating_lentil/nse-bse-scraper`) Actor

Extract live NSE/BSE market data plus detailed Indian company financials: 12 annual years, 13 quarters, ratios, cash flow, shareholding, and peers.

- **URL**: https://apify.com/fascinating\_lentil/nse-bse-scraper.md
- **Developed by:** [Md Jakaria Mirza](https://apify.com/fascinating_lentil) (community)
- **Categories:** Business, Developer tools
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 result scrapeds

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?

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

## Indian Stocks Scraper — NSE/BSE Live Data, Financial Statements & Shareholding

Collect **live Indian stock-market data** and **deep company financials** in one Actor. Use the fast modes for NSE/BSE indices, equity quotes, gainers, losers, and most-active securities. Use `company-financials` for a research-ready company profile with up to **12 annual years**, **13 recent quarters**, balance sheet, cash flow, ratios, shareholding history, and peer comparison.

No brokerage account, API key, or source-site login is required. Export results as JSON, CSV, Excel, or HTML, schedule recurring runs, or connect through the Apify API.

### What You Can Extract

#### Company financials — one result per company

- Company name, NSE symbol, BSE code, website, overview, sectors, and index memberships
- Current price, market cap, 52-week high/low, P/E, book value, dividend yield, ROCE, ROE, and face value
- 13 recent quarterly result periods
- 12 annual profit-and-loss periods, plus TTM when published
- 12 annual balance-sheet and cash-flow periods
- Historical operating and efficiency ratios
- Quarterly and yearly shareholding patterns
- Peer companies with valuation, growth, profitability, and market-cap metrics
- Consolidated or standalone statement view
- Public source URL and scrape timestamp

Every company and all of its nested history are saved as **one billed result**. The Actor does not split a company into dozens of separately charged rows.

#### Live NSE/BSE modes

- Exchange and record type
- Symbol and company/index name
- Last price, change, and change percent
- Volume, traded value, and turnover
- Open, high, low, and previous close
- 52-week high and low
- Market cap, P/E, P/B, EPS, sector, industry, and ISIN when available
- Exchange timestamp and source URL
- Top gainers, top losers, and most-active securities

### Common Use Cases

1. **Fundamental stock research** — compare years of revenue, profit, margins, debt, cash flow, and capital efficiency.
2. **Screening and peer analysis** — evaluate a company against listed peers without manually copying tables.
3. **Shareholding monitoring** — track promoter, FII, DII, government, and public ownership over time.
4. **Portfolio dashboards** — combine live NSE/BSE prices with long-term company fundamentals.
5. **Financial models and AI workflows** — feed clean, structured statements into spreadsheets, databases, or analysis agents.
6. **Market newsletters** — schedule indices, movers, and company snapshots for repeatable reporting.

### Pricing

This Actor uses Apify Pay Per Event. Apart from Apify's small Actor-start event, result charges apply only to usable records successfully saved to the dataset.

| Event | Price | 100 results | 1,000 results |
| --- | ---: | ---: | ---: |
| `result-scraped` | $0.002 | $0.20 | $2.00 |
| `apify-actor-start` | $0.00005 at the default 512 MB memory | — | — |

For `company-financials`, one result contains the complete available company profile and nested history. Empty, unresolved, or unavailable companies are not saved or billed.

### Input

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `dataType` | string | yes | `index` | `index`, `equity`, `market-stats`, or `company-financials`. |
| `source` | string | yes | `both` | `nse`, `bse`, or `both` for live modes. Detailed financials resolve each symbol/code automatically. |
| `symbols` | array<string> | for company/equity lookups | `["RELIANCE"]` | NSE symbols such as `RELIANCE`, `INFY`, `TCS`, or BSE codes such as `500325`. |
| `statementMode` | string | no | `consolidated` | `consolidated` or `standalone`; used by `company-financials`. |
| `maxResults` | integer | no | `10` | Maximum records per exchange/category. Detailed mode processes at most 25 symbols per run. |

### Quick Start

1. Open the Actor and click **Try for free**.
2. Choose `company-financials` for deep research or one of the live market modes.
3. Enter NSE symbols or BSE scrip codes.
4. Choose consolidated or standalone statements when using detailed mode.
5. Run the Actor, then export the dataset or read it through the Apify API.

### Example Inputs

#### Detailed company financials

```json
{
  "dataType": "company-financials",
  "source": "both",
  "symbols": ["RELIANCE", "INFY", "TCS"],
  "statementMode": "consolidated",
  "maxResults": 3
}
```

#### Live equity quotes

```json
{
  "dataType": "equity",
  "source": "both",
  "symbols": ["RELIANCE", "INFY", "500325"],
  "maxResults": 10
}
```

#### Indices from both exchanges

```json
{
  "dataType": "index",
  "source": "both",
  "maxResults": 10
}
```

#### Gainers, losers, and most active

```json
{
  "dataType": "market-stats",
  "source": "nse",
  "maxResults": 20
}
```

### Example Company-Financials Output

The example is shortened for readability. A real result contains all available periods and metrics.

```json
{
  "source": "screener",
  "recordType": "company_financials",
  "symbol": "RELIANCE",
  "name": "Reliance Industries Ltd",
  "nseSymbol": "RELIANCE",
  "bseCode": "500325",
  "statementMode": "consolidated",
  "price": 1316,
  "marketCap": 1780882,
  "peRatio": 23.8,
  "returnOnCapitalEmployed": 10.3,
  "returnOnEquity": 8.91,
  "quarterlyResults": {
    "unit": "INR crore",
    "metricLabels": {
      "sales": "Sales",
      "operatingProfit": "Operating Profit",
      "netProfit": "Net Profit"
    },
    "periods": [
      {
        "period": "Jun 2026",
        "date": "2026-06-30",
        "values": {
          "sales": 309468,
          "operatingProfit": 47517,
          "netProfit": 23196
        }
      }
    ]
  },
  "shareholdingPattern": {
    "quarterly": {
      "unit": "percent",
      "periods": [
        {
          "period": "Jun 2026",
          "date": "2026-06-30",
          "values": {
            "promoters": 50.48,
            "fiis": 17.19
          }
        }
      ]
    }
  },
  "peerComparison": [],
  "url": "https://www.screener.in/company/RELIANCE/consolidated/",
  "scrapedAt": "2026-08-23T12:00:00.000Z"
}
```

### API Example

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs?token=YOUR_API_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"dataType":"company-financials","source":"both","symbols":["RELIANCE","INFY"],"statementMode":"consolidated","maxResults":2}'
```

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('YOUR_ACTOR_ID').call({
    dataType: 'company-financials',
    source: 'both',
    symbols: ['RELIANCE', 'INFY'],
    statementMode: 'consolidated',
    maxResults: 2,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Data Sources and How It Works

- Live index, mover, and quote modes use public NSE India and BSE India endpoints.
- Detailed financials use public company pages on Screener.in and the public peer-table fragment loaded by those pages.
- Requests are sequential and lightly paced in detailed mode.
- Tables are normalized into period objects with stable camel-case metric keys. `metricLabels` preserves the source label for every key.
- Pay-per-event-aware dataset writes stop cleanly when the run spending limit is reached.

### Reliability and Honest Limits

- NSE's direct single-equity quote endpoint blocks server requests, so NSE live equity lookup remains limited to symbols present in public mover/most-active feeds. BSE lookup covers individually resolved listed scrips.
- `company-financials` is the reliable option when you need a specific listed company and historical fundamentals rather than only a live quote.
- Detailed mode is capped at 25 companies per run to keep public-page collection responsible and predictable.
- Public pages can change. Missing sections remain `null` or empty; the Actor never invents values.
- Figures can be consolidated or standalone and may be revised by the source. Always check the returned `statementMode`, period, unit, and source URL.
- This Actor does not access login-only exports, private screens, watchlists, or other restricted account data.
- Data is for research and informational use only, not financial advice.

### Responsible Use

Use this Actor only for lawful collection of publicly available information. You are responsible for complying with source-site terms, robots.txt, rate limits, applicable laws, and any licensing requirements for your intended use.

### License

Apache-2.0. See `LICENSE`.

# Actor input Schema

## `dataType` (type: `string`):

Choose a fast live-market mode or the detailed company-financials mode.

## `source` (type: `string`):

Choose NSE, BSE, or both exchanges for live modes. Company financials resolves the supplied NSE symbol or BSE code automatically.

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

NSE symbols such as RELIANCE, INFY, HDFCBANK, or BSE scrip codes such as 500325. Used for equity and company-financials modes.

## `maxResults` (type: `integer`):

Maximum records per exchange/category. Detailed company financials are limited to the first 25 supplied symbols per run.

## `statementMode` (type: `string`):

Use consolidated or standalone statements in company-financials mode.

## Actor input object example

```json
{
  "dataType": "index",
  "source": "both",
  "symbols": [
    "RELIANCE"
  ],
  "maxResults": 10,
  "statementMode": "consolidated"
}
```

# Actor output Schema

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

Default dataset containing live market rows or one nested financial-history result per company.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("fascinating_lentil/nse-bse-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("fascinating_lentil/nse-bse-scraper").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 '{}' |
apify call fascinating_lentil/nse-bse-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fascinating_lentil/nse-bse-scraper"
        }
    }
}

```

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/NbOZwxqGyGbKGE8pU/builds/7bnn6GW7Dr6p7LUBJ/openapi.json
