# PSX Top Brokers Rankings (`bakos_bence/psx-top-brokers`) Actor

Pakistan Stock Exchange published Top 10 broker rankings: most active accounts, new UINs, traded volume and value, and top cities. Broker name and rank only — not live market quotes. Unofficial; not affiliated with PSX.

- **URL**: https://apify.com/bakos\_bence/psx-top-brokers.md
- **Developed by:** [Bakos Bence](https://apify.com/bakos_bence) (community)
- **Categories:** Business, News, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.75 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

### What is PSX Top Brokers Rankings?

Pakistan Stock Exchange **Top 10 broker rankings** — most active accounts, new UINs, traded volume/value, and top cities. Broker name and rank only (not live quotes).

[Documentation](https://bakosbence.com/web-data-collection/psx-top-brokers/)

### What PSX Top Brokers Rankings returns

| Field | What it is | Example |
| --- | --- | --- |
| `rankingCategory` | Which Top 10 table | Top 10 Brokers - Most Active Accounts |
| `rank` | Rank in that table | 1 |
| `brokerName` | Brokerage name | AKD Securities Limited |
| `sourceUrl` | Source page | https://www.psx.com.pk/psx/resources-and-tools/investors/top-10-brokers |
| `scrapedAt` | Scrape time | 2026-09-30T08:00:00+00:00 |

### How do I get PSX top broker rankings?

1. Click **Try for free**.
2. Review the filled example on the Input tab.
3. Click **Start**.
4. Open the dataset and download it, or send it on with one of the integrations below.

A search can match more than one row. The run keeps the first matches, up to **Max records to save**.

Saved runs on the **Tasks** tab:

- [PSX all Top 10 rankings sample](https://console.apify.com/actors/tasks/bakos_bence/psx-brokers-all-rankings-sample)
- [Most active accounts brokers](https://console.apify.com/actors/tasks/bakos_bence/psx-brokers-most-active-accounts)
- [Top brokers by traded value](https://console.apify.com/actors/tasks/bakos_bence/psx-brokers-traded-value)

### Input

The **Input** tab lists every field. The sample input is:

```json
{
    "rankingCategory": "",
    "maxItems": 5
}
```

### Output

One row looks like this. `scrapedAt`, when present, is the time that run finished.

```json
{
  "rankingCategory": "Top 10 Brokers - Most Active Accounts",
  "rank": 1,
  "brokerName": "AKD Securities Limited",
  "sourceUrl": "https://www.psx.com.pk/psx/resources-and-tools/investors/top-10-brokers",
  "scrapedAt": "2026-09-30T08:00:00+00:00"
}
```

### How much does PSX Top Brokers Rankings cost?

You pay for each row saved. Platform usage is included. Current rates are on the [Pricing](https://apify.com/bakos_bence/psx-top-brokers/pricing) tab.

How pay-per-event billing works: [Actors in Store](https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event).

### Related Actors

| Actor | When to use it |
| --- | --- |
| [PSX Company Disclosures](https://apify.com/bakos_bence/psx-company-disclosures) | Issuer disclosures for listed names |
| [Pakistan Mutual Fund NAVs (MUFAP)](https://apify.com/bakos_bence/mufap-mutual-fund-navs) | AMC fund shelf NAVs |
| [SBP KIBOR Rates](https://apify.com/bakos_bence/sbp-kibor-rates) | Interbank rates |

### Integrations

#### Excel

1. Click **Try for free**, run this Actor, and wait until the run finishes.
2. Open that run and go to its dataset.
3. Choose **Export**, then **Excel**.

To download the newest successful run later without opening the dataset:

1. In Apify Console, open **Settings → API & Integrations** and copy an API token.
2. On this Actor, open the **Tasks** tab, open the task you want, and copy the task ID from the URL.
3. Run that task once.
4. Paste this into a browser. Replace `TASK_ID` and `YOUR_TOKEN`.

```text
https://api.apify.com/v2/actor-tasks/TASK_ID/runs/last/dataset/items?format=xlsx&clean=true&status=SUCCEEDED&token=YOUR_TOKEN
```

Anyone with that URL can read the rows. Treat the token like a password.

Dataset export formats: [Dataset items](https://docs.apify.com/api/v2/dataset-items-get).

#### Google Sheets

1. In Apify Console, open **Settings → API & Integrations** and copy an API token.
2. On this Actor, open the **Tasks** tab, open the task you want, and copy the task ID from the URL.
3. Run that task once so there is a successful dataset.
4. In a Google Sheet, click cell **A1** and paste this formula. Replace `TASK_ID` and `YOUR_TOKEN`.

```text
=IMPORTDATA("https://api.apify.com/v2/actor-tasks/TASK_ID/runs/last/dataset/items?format=csv&clean=true&status=SUCCEEDED&token=YOUR_TOKEN")
```

#### API

1. In Apify Console, open **Settings → API & Integrations** and copy an API token.
2. Start a run:

```bash
curl -X POST "https://api.apify.com/v2/acts/bakos_bence~psx-top-brokers/runs?token=YOUR_TOKEN&waitForFinish=120" \
  -H "Content-Type: application/json" \
  -d '{"rankingCategory": "", "maxItems": 5}'
```

3. Read dataset items from the run's `defaultDatasetId`.

#### Zapier

1. Create a Zapier Zap.
2. Trigger: **Schedule** or a webhook from your app.
3. Action: **Webhooks by Zapier → POST** to the Apify run URL above with your JSON input and token.
4. Optional: add a delay, then GET dataset items and map fields into Sheets/Slack.

#### Make

1. Create a Make scenario.
2. Add **HTTP → Make a request** (POST) to start the Actor run with your input JSON.
3. Add another HTTP module to fetch dataset items after the run finishes.
4. Route rows to Google Sheets, Slack, or a data store.

#### n8n

1. Add an **HTTP Request** node: POST `https://api.apify.com/v2/acts/bakos_bence~psx-top-brokers/runs?token=YOUR_TOKEN`.
2. Body: the sample JSON from Input.
3. Add a second HTTP Request for dataset items (`/datasets/{{$json.data.defaultDatasetId}}/items`).
4. Connect Slack, Sheets, or your database nodes.

#### Webhooks

1. In the Actor run options, set a webhook URL for `ACTOR.RUN.SUCCEEDED`.
2. Your endpoint receives the run payload including `defaultDatasetId`.
3. Fetch items from the dataset API and process them.

#### AI tools

1. Give your agent the Apify token as a secret.
2. Instruct it to start `bakos_bence/psx-top-brokers` with the sample input.
3. Have it read the dataset JSON and summarize or store the rows.

#### Export to Power BI, Tableau, Looker Studio & Qlik

After a run, rows live in an Apify **dataset**. You can download JSON/CSV/Excel from the Dataset tab, or point BI tools at a **CSV URL** that refreshes when you scrape again.

**Prefer the token in the URL** (`token=`) — most tools only need “open this link as CSV”, with no custom headers.

##### Build a refreshable CSV URL

1. In Apify Console, open **Settings → Integrations** and copy an API token.
2. Save this Actor as a **Task** (optional but best for dashboards), run or **schedule** it once so there is a successful run.
3. Use the **latest successful task run** URL (replace `TASK_ID` and `YOUR_TOKEN`):

```text
https://api.apify.com/v2/actor-tasks/TASK_ID/runs/last/dataset/items?format=csv&clean=true&status=SUCCEEDED&token=YOUR_TOKEN
```

Or, from any finished run, open the **Dataset** tab, copy the dataset ID, and use:

```text
https://api.apify.com/v2/datasets/DATASET_ID/items?format=csv&clean=true&token=YOUR_TOKEN
```

Anyone with that URL can read the data — treat it like a password. For recurring dashboards, prefer the `actor-tasks/…/runs/last/…` form so refresh always hits the newest successful scrape.

##### Power BI

1. Open Power BI Desktop → **Home** → **Get data** → **Web**.
2. Paste the CSV URL (including `token=`).
3. When asked how to sign in, choose **Anonymous** → **Connect**.
4. Confirm the preview is a table (CSV). **Load** or **Transform data** as needed.
5. Publish / schedule refresh in the Power BI service using the same URL (task `runs/last` keeps it current after each scrape).

`401`: token missing/wrong, or you did not pick **Anonymous**.

##### Tableau

1. Install Tableau’s **REST API** connector from Tableau Exchange (Desktop **2023.3+**).
2. **Connect** → **To a Server** → **REST API**.
3. Paste the CSV URL (including `token=`). Set response format to **CSV**.
4. If the connector asks for auth and the token is already in the URL, leave credentials empty / anonymous; otherwise paste the same token as a Bearer access token.
5. Create an **extract**. Refresh the extract after scheduled Task runs (or point at `runs/last` so each refresh loads the latest success).

Plain **Text file** connect still works if you download CSV from the Dataset tab once — use REST when you want repeatable refresh.

##### Looker Studio

Looker Studio has no strong built-in “private CSV API” connector. Use Google Sheets as the bridge:

1. Create a Google Sheet. In **A1** enter:

```text
=IMPORTDATA("https://api.apify.com/v2/actor-tasks/TASK_ID/runs/last/dataset/items?format=csv&clean=true&status=SUCCEEDED&token=YOUR_TOKEN")
```

2. Wait until columns fill (Sheets refreshes IMPORTDATA periodically).
3. In Looker Studio → **Create** → **Report** → **Google Sheets** → select that spreadsheet / tab.
4. Build the report. After each Actor/Task run, refresh the Sheet (or wait for IMPORTDATA) then refresh the Looker data source.

One-off alternative: Dataset tab → download CSV → Looker Studio **File upload**.

##### Qlik

**REST connector** (refreshable):

1. In Qlik Cloud / Qlik Sense → **Add data** → **REST** (or create a REST connection in the Data load editor).
2. URL = the CSV URL including `token=`. Method **GET**.
3. Set the expected response type to **CSV** (or use `format=json` and JSON mode).
4. **Test connection**, pick the table, **Add** / **Load**.
5. **Reload** the app after scheduled scrapes; with `runs/last`, each reload pulls the latest successful dataset.

**Files:** Dataset tab → download CSV → **Add data** → upload the file (fine for a single snapshot).

Unofficial tool. Not affiliated with Pakistan Stock Exchange Limited. Rankings are as published by PSX and do not include live market data feeds.

# Actor input Schema

## `rankingCategory` (type: `string`):

Optional filter substring, e.g. <b>Most Active Accounts</b> or <b>Traded Value</b>. Leave empty for all published Top 10 tables.

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

Cap dataset rows. Keep <b>5</b> for a cheap smoke; raise to capture every Top 10 table.

## Actor input object example

```json
{
  "rankingCategory": "",
  "maxItems": 5
}
```

# Actor output Schema

## `overview` (type: `string`):

Default dataset items.

# 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 = {
    "rankingCategory": "",
    "maxItems": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("bakos_bence/psx-top-brokers").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 = {
    "rankingCategory": "",
    "maxItems": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("bakos_bence/psx-top-brokers").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 '{
  "rankingCategory": "",
  "maxItems": 5
}' |
apify call bakos_bence/psx-top-brokers --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bakos_bence/psx-top-brokers"
        }
    }
}
```

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/jhHOeJI4XV3zeDddc/builds/X1QbSNeTdtUtiZOXV/openapi.json
