# TradingView Economic Calendar – Today (AU/US/GB) (`persimmon_yapok/tradingview-economic-calendar-today-au-us-gb`) Actor

Scrapes TradingView's economic calendar filtered to US/AU/GB and extracts events falling on 'today' in a given IANA timezone (default Australia/Sydney).

- **URL**: https://apify.com/persimmon_yapok/tradingview-economic-calendar-today-au-us-gb.md
- **Developed by:** [CloudStar](https://apify.com/persimmon_yapok) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 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

## TradingView Economic Calendar — Today (AU/US/GB)

Apify actor that scrapes TradingView's economic calendar
(`https://www.tradingview.com/economic-calendar/`), filtered to a set of
countries (default `US,AU,GB`), and reports which events fall on **today**
in a given IANA timezone (default `Australia/Sydney`, i.e. AEDT/AEST — the
zone resolves daylight saving automatically, so no manual offset math is
needed across the switch).

### How it works

- No stable JSON API exists for this page (the data is backed by a
  WebSocket, not a plain XHR), so the actor drives a real headless Chromium
  via Playwright/Crawlee and reads the rendered DOM.
- The browser context's `timezoneId` is set to the target timezone, which
  makes TradingView itself render every row's timestamp in that zone —
  confirmed by reading each row's `<time datetime="...">` attribute (a real
  ISO-8601 UTC instant embedded in the DOM) and converting it with Luxon.
- "Today" is computed by comparing each event's timestamp to `now`, both in
  the target zone — not by trusting the page's own day-section headers.

### Run locally

```bash
npm install
npx playwright install chromium   # one-time
npm test                          # pure timezone logic, no network
npm run discover                  # dumps rendered HTML/screenshot to scripts/.out, for selector upkeep
npm run start:dev                 # runs the actor against the live site
```

Output lands in `storage/key_value_stores/default/OUTPUT.json` (summary) and
`storage/datasets/default/` (one JSON file per matching event). Set
`headless: false` via a local `storage/key_value_stores/default/INPUT.json`
while iterating, to watch the browser.

### If TradingView changes their markup

Row extraction in `src/scraper.ts` relies on the stable `data-name`/
`data-country`/`data-symbol` attributes and a `<time datetime>` element,
plus a couple of `[class*="..."]` substring matches against CSS-module class
names that **will** rotate on TradingView's next frontend deploy. If the
actor starts returning zero rows: run `npm run discover`, open
`scripts/.out/calendar.html`, find the new class names for title/importance/
value cells, and update the selectors in `scraper.ts` (dated comment at the
top of that file).

### If TradingView starts blocking the actor

1. Set `proxyGroups: ["RESIDENTIAL"]` in the input — cheap, highest success
   rate.
2. If still blocked, add `playwright-extra` + a stealth plugin to patch
   headless-detection fingerprints Crawlee's built-in fingerprinting doesn't
   cover.

### Deploy to Apify

```bash
npx apify-cli@latest login
npx apify-cli@latest push
```

(No global Apify CLI install required — `npx` fetches it transiently.)

# Actor input Schema

## `countries` (type: `array`):

Country codes to filter the calendar by (TradingView query param values).

## `timezone` (type: `string`):

IANA timezone used both for the Playwright browser context and for computing 'today'. Must be an IANA zone (e.g. Australia/Sydney), not a fixed offset, so DST is handled automatically.

## `minImportance` (type: `string`):

Only include events at or above this importance. Leave as 'low' to include everything.

## `useApifyProxy` (type: `boolean`):

Route requests through Apify Proxy. Turn off only for local testing without proxy credentials.

## `proxyGroups` (type: `array`):

Apify Proxy groups to use, e.g. RESIDENTIAL. Leave empty for the default datacenter proxy.

## `headless` (type: `boolean`):

Set to false only for local debugging.

## `maxRequestRetries` (type: `integer`):

How many times to retry the page load/extraction if it fails (e.g. a transient network error or bot-detection block).

## Actor input object example

```json
{
  "countries": [
    "US",
    "AU",
    "GB"
  ],
  "timezone": "Australia/Sydney",
  "minImportance": "low",
  "useApifyProxy": true,
  "proxyGroups": [],
  "headless": true,
  "maxRequestRetries": 3
}
```

# Actor output Schema

## `summary` (type: `string`):

No description

## `todaysEvents` (type: `string`):

No description

# 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("persimmon_yapok/tradingview-economic-calendar-today-au-us-gb").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("persimmon_yapok/tradingview-economic-calendar-today-au-us-gb").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 persimmon_yapok/tradingview-economic-calendar-today-au-us-gb --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,persimmon_yapok/tradingview-economic-calendar-today-au-us-gb"
        }
    }
}
```

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/GWkQwN2RCm2HiymFp/builds/ANYmUZHXF5NgtsbcA/openapi.json
