# Vietnam Gold Price & Bank Exchange Rates (PNJ, BTMC, VCB) (`hoanglongteam/vietnam-gold-fx-rates`) Actor

Daily snapshot of Vietnamese gold prices (PNJ, Bao Tin Minh Chau) and Vietcombank FX rates. Normalised to VND per tael, one clean row per product or currency. Built for scheduled runs.

- **URL**: https://apify.com/hoanglongteam/vietnam-gold-fx-rates.md
- **Developed by:** [LONG HOÀNG](https://apify.com/hoanglongteam) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 source snapshots

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?

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

## Vietnam Gold Price & Bank Exchange Rates (PNJ, BTMC, Vietcombank)

Get a **daily snapshot of Vietnamese gold prices and bank exchange rates** in one run, as clean rows in **VND**:

- **Vietcombank exchange rates** — about 20 currencies (USD, EUR, JPY, CNY, KRW, SGD, THB, AUD, GBP…) with **cash buy, transfer buy and sell** rates, plus the time Vietcombank last updated them.
- **PNJ gold prices** — SJC and PNJ gold bars/rings for 6 regions (Ho Chi Minh City, Hanoi, Da Nang, Mekong Delta, Central Highlands, Southeast), plus jewellery gold by karat (24K, 22K, 18K, 14K, 10K…).
- **Bao Tin Minh Chau (BTMC) gold prices** — Rong Thang Long bars and rings, SJC bars, jewellery and raw gold.

All gold prices are **normalised to VND per tael** (1 *lượng* = 10 *chỉ* = 37.5 g), and the original published number and unit are kept next to them so you can always check the conversion.

### Who it's for

- **Finance dashboards and newsletters** that show today's SJC / ring gold price and the USD/VND rate.
- **E-commerce and jewellery shops** that reprice products from the gold price or convert foreign-currency costs to VND.
- **Remittance, travel and accounting apps** that need Vietcombank's reference buy/sell rates every day.
- **Analysts** building a history of the gold premium (domestic vs. world) or the VND exchange rate.

### Use case: scheduled daily run → Google Sheets or webhook

1. Create a **Schedule** in Apify Console (e.g. every day at 09:00 and 15:00 Asia/Ho_Chi_Minh).
2. Add an integration:
   - **Google Sheets**: append the dataset (or just the *FX rates* / *Gold prices* view) to a sheet — you get a growing price history with one row per currency or product per run.
   - **Webhook** (`ACTOR.RUN.SUCCEEDED`): POST to your backend, then fetch
     `https://api.apify.com/v2/datasets/{defaultDatasetId}/items?view=fxRates` or `?view=goldPrices`.
3. Filter in your sheet by `type` = `fx`, `gold` or `error`.

Tip: gold shops update prices a few times a day and Vietcombank updates rates during business hours; 1–3 runs per day is plenty.

### Input

```json
{
  "sources": ["vietcombank", "pnj", "btmc"],
  "currencies": ["USD", "EUR", "JPY"],
  "includeHistoryDate": ""
}
```

| Field | Description |
|---|---|
| `sources` | Which sources to fetch. Default: all three. |
| `currencies` | Optional filter for Vietcombank rows (ISO codes). Empty = all currencies. |
| `includeHistoryDate` | Optional `YYYY-MM-DD`. Returns Vietcombank rates for that day and PNJ's last gold price of that day. BTMC has no public history, so it returns a free error row in this mode. |

### Output

Every row has a `type`: **`fx`**, **`gold`** or **`error`**. The dataset has two ready views: **FX rates** and **Gold prices**.

FX row (Vietcombank):

```json
{
  "type": "fx",
  "source": "vietcombank",
  "code": "USD",
  "name": "US DOLLAR",
  "buyCash": 25670,
  "buyTransfer": 25700,
  "sell": 26080,
  "quoteCurrency": "VND",
  "rateDate": "2026-10-18",
  "sourceUpdatedAt": "2026-10-18T12:00:10+07:00",
  "sourceUrl": "https://portal.vietcombank.com.vn/Usercontrols/TVPortal.TyGia/pXML.aspx",
  "fetchedAt": "2026-10-18T05:11:12.000Z"
}
```

Gold row (PNJ, SJC bar in Hanoi):

```json
{
  "type": "gold",
  "source": "pnj",
  "brand": "PNJ",
  "product": "SJC",
  "region": "Hà Nội",
  "category": "Gold bars & rings (regional board)",
  "purity": "999.9",
  "buy": 140600000,
  "sell": 143600000,
  "unit": "VND per tael (lượng = 10 chỉ = 37.5 g)",
  "rawBuy": "140.600",
  "rawSell": "143.600",
  "rawUnit": "thousand VND per tael (ngàn đồng/lượng)",
  "sourceUpdatedAt": "2026-10-17T07:49:40+07:00",
  "sourceUrl": "https://giavang.pnj.com.vn/",
  "fetchedAt": "2026-10-18T05:11:12.000Z"
}
```

Gold row (BTMC, published per *chỉ* and converted to per tael):

```json
{
  "type": "gold",
  "source": "btmc",
  "brand": "Bao Tin Minh Chau",
  "product": "VÀNG MIẾNG SJC",
  "category": "SJC gold bar",
  "purity": "999.9 (24k)",
  "buy": 138400000,
  "sell": 143600000,
  "unit": "VND per tael (lượng = 10 chỉ = 37.5 g)",
  "rawBuy": "13840",
  "rawSell": "14360",
  "rawUnit": "thousand VND per chỉ (1/10 tael)",
  "sourceUpdatedAt": "2026-10-17T10:18:00+07:00",
  "sourceUrl": "https://btmc.vn/"
}
```

Error row (a source was down — the other sources are still returned):

```json
{ "type": "error", "source": "pnj", "message": "HTTP 503 from edge-cf-api.pnj.io", "fetchedAt": "..." }
```

Notes: `null` means the source shows no number (e.g. "Liên hệ" / contact us, or no cash rate for that currency). Prices are what each seller publishes; they are for reference, not an offer to trade.

### Pricing

**Pay per source snapshot**: you pay once for each source that returned data in a run (up to 3 per run), no matter how many rows it contains. Sources that fail produce a free `error` row and are **not charged**.

### How it works

One plain HTTP request per source per run — no browser, no proxies, no login, a few seconds per run:

- Vietcombank's public XML rate feed (the feed asks for at most one request every 5 minutes; this Actor makes one per run) and its public JSON rate endpoint for historical dates.
- PNJ's public JSON price endpoint used by giavang.pnj.com.vn.
- The price board on BTMC's homepage (robots.txt allows it).

It reads only public price tables — no personal data.

### Limitations

- **SJC, DOJI and Phú Quý are not included**: their price pages sit behind bot protection or block automated requests, and this Actor does not bypass protections. SJC bar prices are still covered through PNJ and BTMC, which both list SJC bars.
- Gold prices are not updated on Sundays/holidays by some sellers — `sourceUpdatedAt` tells you when the price was last changed.
- If a seller changes its page or API format, that source returns an `error` row until the Actor is updated.
- Don't schedule runs more often than every 5 minutes (Vietcombank's feed rule).

# Actor input Schema

## `sources` (type: `array`):

Which sources to fetch. vietcombank = Vietcombank exchange rates (cash buy, transfer buy, sell). pnj = PNJ gold prices (SJC and PNJ bars, rings, jewellery by karat, per region). btmc = Bao Tin Minh Chau gold prices (Rong Thang Long bars, rings, SJC bars). Each source is billed once per run when it returns data.

## `currencies` (type: `array`):

ISO currency codes to keep from Vietcombank, e.g. USD, EUR, JPY. Leave empty to get all currencies Vietcombank publishes (about 20).

## `includeHistoryDate` (type: `string`):

Leave empty for today's rates. Set a past date (e.g. 2026-10-01) to get Vietcombank's rates and PNJ's last gold price of that day. BTMC has no public history, so it returns an error row (not charged) in this mode.

## Actor input object example

```json
{
  "sources": [
    "vietcombank",
    "pnj",
    "btmc"
  ],
  "currencies": []
}
```

# Actor output Schema

## `fxRates` (type: `string`):

No description

## `goldPrices` (type: `string`):

No description

## `allRows` (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 = {
    "sources": [
        "vietcombank",
        "pnj",
        "btmc"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hoanglongteam/vietnam-gold-fx-rates").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 = { "sources": [
        "vietcombank",
        "pnj",
        "btmc",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("hoanglongteam/vietnam-gold-fx-rates").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 '{
  "sources": [
    "vietcombank",
    "pnj",
    "btmc"
  ]
}' |
apify call hoanglongteam/vietnam-gold-fx-rates --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hoanglongteam/vietnam-gold-fx-rates"
        }
    }
}
```

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/SW8iEN8zrEiCzfNwR/builds/GkOKv1PFMkrWkUl7t/openapi.json
