# Romania Finance Data (`pulse_hub/romania-finance-data`) Actor

## Curs BNR,  fonduri mutuale și cele mai bune oferte Fidelis de pe piata secundara.

BNR exchange rates, Romanian fund prices and best Fidelis bonds offers from secondary market.

- **URL**: https://apify.com/pulse_hub/romania-finance-data.md
- **Developed by:** [Vicxyz1](https://apify.com/pulse_hub) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 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/actors/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

## Romania Finance Data — Apify Actor

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue?logo=apify)](https://apify.com)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue?logo=typescript)](https://www.typescriptlang.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

> **Official BNR reference exchange rates, Romanian mutual fund NAVs, and indicative Fidelis bond offers with history.**\
> *Cursuri de referință BNR, prețuri ale fondurilor românești de investiții și oferte indicative Fidelis cu istoric.*

This Apify Actor provides Romanian financial data for developers, accounting systems, treasuries, ERPs, Excel / Power Query, fintech apps, and AI agents. It provides **100% endpoint and schema parity** with the [Romania Finance Data RapidAPI](https://rapidapi.com) listing.

***

### 🌟 Key Features

- **BNR Reference Exchange Rates:** Latest official National Bank of Romania (BNR) daily fixings and full historical quotations for all published currencies, with the official multiplier and normalized `ron_per_unit`.
- **Romanian Investment Funds (Mutual Funds):** Discover supported mutual funds from multiple Romanian asset managers (including BT Asset Management and Raiffeisen Asset Management), and retrieve their latest published NAVs and percentage changes.
- **Indicative Fidelis Secondary Market Offers:** Indicative screening of standout RON and EUR government bonds on the Bucharest Stock Exchange (BVB) rated **GOOD**, **BARGAIN**, or **EXCELLENT** by yield to maturity (YTM), maturity, and available volume against donor hurdles. Explore timestamped offer history for up to 7 calendar days per query.
- **Dual Operating Modes:**
  1. **Batch Mode (Default Apify Run):** Select an endpoint and query parameters via the Apify Console or API; data rows are pushed directly into the Apify **Dataset** (ready for CSV/Excel/JSON export), and the raw API JSON response is preserved in the **Key-Value Store** under `OUTPUT`.
  2. **Standby HTTP Mode:** Run as a persistent low-latency HTTP REST server exposing the exact same REST paths (`/funds`, `/prices`, `/fx-rates`, `/fidelis-bonds/offers`, etc.) and OpenAPI 3.0 specification.

***

### 📡 Endpoints Catalog (RapidAPI Parity)

All paths can be called with or without the `/api` prefix (e.g. `/funds` or `/api/funds`).

| Endpoint Path | Operation | Parameters | Description |
|---|---|---|---|
| `GET /funds` | `listFunds` | — | Supported mutual funds, asset managers, and currencies |
| `GET /prices` | `listLatestFundPrices` | — | Latest published price/NAV and change for all configured funds |
| `GET /prices/latest` | `getLatestFundPrice` | `fund_name` (default `BT Maxim`) | Latest NAV and change for a specific fund |
| `GET /fx-rates` | `listLatestFxRates` | — | Latest BNR reference exchange rates for all currencies |
| `GET /fx-rates/latest` | `listLatestFxRatesAlias` | — | Canonical alias of `GET /fx-rates` |
| `GET /fx-rates/{currency}/history` | `getFxRateHistory` | `currency` (path, e.g. `EUR`), `from`, `to`, `limit` (1..1000) | Historical BNR fixings in descending date order |
| `GET /fx-rates/{currency}` | `getFxRateHistoryAlias` | `currency`, `from`, `to`, `limit` | Short alias for currency history |
| `GET /fidelis-bonds/offers` | `listFidelisOffers` | `currency` (`RON` or `EUR`) | Indicative rated Fidelis secondary market offers |
| `GET /fidelis-bonds/offers/history` | `listFidelisOfferHistory` | `from`, `to` (max 7 days), `currency`, `rating` (`GOOD`, `BARGAIN`, `EXCELLENT`, `all`) | Timestamped rated quote history |
| `GET /openapi.json` | `getOpenApiSpec` | — | Complete OpenAPI 3.0.3 specification |
| `GET /up` | `healthCheck` | — | Health and readiness probe (`200 OK`) |

***

### 🚀 How to Use

#### Mode 1: Batch Run (Apify Console or API)

Configure the Actor input via the Apify UI or pass a JSON payload:

```json
{
  "endpoint": "prices/latest",
  "fund_name": "BT Maxim"
}
```

##### Example: Historical BNR Exchange Rates

```json
{
  "endpoint": "fx-rates/history",
  "currency": "EUR",
  "from": "2025-01-01",
  "to": "2025-03-01",
  "limit": 50
}
```

##### Example: Rated Fidelis Offers History

```json
{
  "endpoint": "fidelis-bonds/offers/history",
  "currency": "RON",
  "from": "2025-02-01",
  "to": "2025-02-07",
  "rating": "BARGAIN"
}
```

**Results:**

- **Dataset:** Formatted tabular records with columns (`fund_name`, `price`, `currency`, `rate`, `ron_per_unit`, `ask_ytm_percent`, `rating`, etc.), downloadable as **CSV**, **Excel**, or **JSON**.
- **Key-Value Store:** Key `OUTPUT` contains the complete response envelope:
  ```json
  {
    "success": true,
    "data": [...],
    "count": 42,
    "message": "Latest BNR exchange rates retrieved successfully"
  }
  ```

***

#### Mode 2: Standby HTTP REST API

When deployed on Apify in **Standby Mode** (`APIFY_META_ORIGIN=STANDBY`), the Actor acts as a persistent HTTP microservice.

##### cURL

```bash
## Get latest BNR rates
curl -s "https://romania-finance-data.apify.actor/fx-rates"

## Get specific mutual fund NAV
curl -s "https://romania-finance-data.apify.actor/prices/latest?fund_name=BT%20Agro"

## Get rated EUR Fidelis bond offers
curl -s "https://romania-finance-data.apify.actor/fidelis-bonds/offers?currency=EUR"
```

##### Python (`requests`)

```python
import requests

url = "https://romania-finance-data.apify.actor/fx-rates/EUR/history"
params = {
    "from": "2025-01-01",
    "to": "2025-02-01",
    "limit": 30
}

response = requests.get(url, params=params)
data = response.json()

if data.get("success"):
    for item in data["data"]:
        print(f"Date: {item['rate_date']} | 1 EUR = {item['ron_per_unit']} RON")
```

##### JavaScript / Node.js

```javascript
const res = await fetch("https://romania-finance-data.apify.actor/prices");
const json = await res.json();

if (json.success) {
  for (const fund of json.data) {
    console.log(`${fund.fund_name}: ${fund.price} ${fund.currency} (${fund.price_change_percent}%)`);
  }
}
```

***

### ⚙️ Configuration & Secrets

Configure these environment variables in your Apify Actor settings (mark tokens and secrets as secret values):

| Variable | Description | Default |
|---|---|---|
| `FINPULSE_UPSTREAM_BASE_URL` | FinPulse RapidAPI upstream base URL | `https://ro-finance.mediashare.ro/api/rapidapi` |
| `FINPULSE_API_TOKEN` | Dedicated API client Bearer token | `""` (Secret) |
| `FINPULSE_PROXY_SECRET` | Upstream proxy secret (`X-RapidAPI-Proxy-Secret`) | `""` (Secret) |
| `FINPULSE_TIMEOUT_MS` | Upstream HTTP timeout in milliseconds | `15000` |
| `ACTOR_WEB_SERVER_PORT` | Port for the Standby HTTP server | `8080` |
| `ACTOR_STANDBY_MODE` | Force Standby HTTP mode locally or in container | `false` |

***

### 📊 Important Financial Semantics & Disclaimers

1. **BNR Reference Rates:** The published BNR `rate` represents the amount of RON for the currency's `multiplier` units (for example, 100 HUF or 1 EUR). Use `ron_per_unit` for the normalized value of a single unit. BNR rates are reference fixings, not real-time tradable FX quotes.
2. **Mutual Fund Prices:** Fund NAVs are published periodically on business days by respective asset managers (BT Asset Management, Raiffeisen Asset Management). Coverage and update times vary by fund.
3. **Indicative Fidelis Bond Offers:** Quotes are delayed by at least 15 minutes. Current offers exclude quotes older than 30 minutes. If no fresh quotes are available, date-only fallback may be returned. Offer ratings (**GOOD**, **BARGAIN**, **EXCELLENT**) are computed from gross calculated yield to maturity against primary donor benchmarks.
4. **Investment Disclaimer:** This API and Actor provide screening and informational data only; nothing herein constitutes investment advice, trading recommendations, or executable securities offers.

***

### 🛠️ Local Development & Testing

```bash
## Clone the repository
git clone https://github.com/your-org/ro-finance-apify-actor.git
cd ro-finance-apify-actor

## Install dependencies
npm install

## Run unit and integration tests
npm test

## Build TypeScript
npm run build

## Run Actor locally in Batch mode
npm start

## Run Actor locally in Standby HTTP mode
ACTOR_STANDBY_MODE=true npm start
## Test readiness probe: curl http://localhost:8080/up
## Test OpenAPI spec:   curl http://localhost:8080/openapi.json
```

***

### 📄 License

MIT License. See [LICENSE](LICENSE) for details.

# Actor input Schema

## `endpoint` (type: `string`):

Select which Romanian finance endpoint to query. Corresponds directly to the RapidAPI endpoint catalog.

## `fund_name` (type: `string`):

Exact configured fund name (e.g. 'BT Maxim', 'BT Agro', 'BT Clasic', 'BT Technology', 'Raiffeisen RON Plus', etc.). Used only when endpoint is 'prices/latest'.

## `currency` (type: `string`):

3-letter currency code (e.g. 'EUR', 'USD', 'RON'). For Fidelis offers, choose 'RON' or 'EUR'.

## `from` (type: `string`):

Inclusive start date for FX history or Fidelis offer history. Dates use Europe/Bucharest time. For Fidelis, maximum history range is 7 days.

## `to` (type: `string`):

Inclusive end date for FX history or Fidelis offer history. Cannot be in the future.

## `limit` (type: `integer`):

Maximum number of historical records to return (1 to 1000). Default is 100.

## `rating` (type: `string`):

Filter historical Fidelis offer snapshots by calculated rating. Used only for fidelis-bonds/offers/history.

## Actor input object example

```json
{
  "endpoint": "prices",
  "fund_name": "BT Maxim",
  "currency": "EUR",
  "limit": 100,
  "rating": "all"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Financial records retrieved by the Actor (funds, prices, FX rates, or Fidelis offers), exportable to JSON, CSV, or Excel.

## `rawResponse` (type: `string`):

Complete JSON response envelope ({ success, data, count, message }) identical to RapidAPI.

# 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("pulse_hub/romania-finance-data").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("pulse_hub/romania-finance-data").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 pulse_hub/romania-finance-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pulse_hub/romania-finance-data"
        }
    }
}
```

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/9HW2Z967JcRxphggW/builds/pc3iRx0rvnNSmttMC/openapi.json
