# Vacation Rental Sold Nights Scraper (Spain, Price Estimate) (`steadfetch/rental-calendar-monitor`) Actor

Estimates which vacation rental nights were sold and at what price in a Spanish municipality by comparing two calendar snapshot datasets of your own Apify account. Reads no website. One row per changed night and one per listing and month.

- **URL**: https://apify.com/steadfetch/rental-calendar-monitor.md
- **Developed by:** [Steadfetch](https://apify.com/steadfetch) (community)
- **Categories:** Travel
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 comparison row delivereds

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

Estimates which vacation rental nights were sold, and at what price, in one Spanish municipality. It reads no website: it compares two calendar snapshot datasets of your own Apify account, taken on different dates from the same platform and municipality, and returns one row per changed night plus a monthly summary per listing. Development steps and the publishing checklist live in [PUBLISHING.md](PUBLISHING.md).

### What it does

No platform publishes its bookings. This Actor deduces them from the calendars: a night that was free in the older snapshot and is no longer free in the newer one is counted as sold, at the last price it was advertised at.

- Opens the two datasets you name (`previousDatasetId`, `currentDatasetId`). Each one is a snapshot: one item per listing with its calendar of the next days, as delivered by a Steadfetch platform Actor. The item format is the calendar snapshot contract in [docs/snapshot-contract.md](docs/snapshot-contract.md).
- Validates both snapshots against that contract and stops with a clear error, delivering nothing, when they do not match: different platforms (`source`) or municipalities (`municipalityCode`), a snapshot that mixes several of them, or a "previous" snapshot that is not older than the "current" one.
- Matches listings by platform and listing ID. A listing found in only one snapshot is ignored and counted in the run log.
- Compares only the nights present in both calendars and not before the day of the current snapshot.
- Emits a `night-change` row for every night that was **sold** (free before, not free now; estimated sold price = previous price), **released** (not free before, free now) or **price-changed** (free in both, different price; skipped when the listing changed currency).
- Marks as `doubtful` every run of consecutive sold nights at least `longBlockNights` long (default 14): a long block that appears all at once is often the owner closing the calendar, not a booking. Doubtful nights are kept out of the sold nights and revenue estimates.
- Emits a `listing-month` row per listing and month with estimated sold nights, estimated revenue, estimated average sold price, doubtful nights and nights still free.
- Keeps nothing between runs: the snapshots and the history stay in your Apify account.

### Limits

Read these before using the numbers:

- It is an estimate. A night that stops being free can be a booking or an owner block; this first version does not tell them apart and marks as doubtful the long blocks that appear all at once. Separating them with a statistical model, as AirDNA does, is out of scope.
- The sale price is the last one advertised before the change. The more spaced out the snapshots, the worse: with daily snapshots the error is small; with monthly snapshots, large.
- There is history only from the first snapshot you take. The data becomes useful after several weeks of snapshots.
- It is meant for holiday homes, which are one unit per listing. In a hotel, a date that stops being available means a room type sold out, not a booking; for hotels the Actor gives the evolution of the advertised price, not the sale price.

### How to use

1. Run a Steadfetch platform Actor for one municipality and keep the run's dataset ID: that is a snapshot. Run it again some days later: that is the second snapshot.

2. Run this Actor with the older dataset ID as `previousDatasetId` and the newer one as `currentDatasetId`:

   ```bash
   apify call steadfetch/rental-calendar-monitor --input='{"previousDatasetId":"<older dataset ID>","currentDatasetId":"<newer dataset ID>"}'
   ```

3. Read the rows from the run's default dataset; the `changes` and `months` views show each row type with its own columns.

#### Minimum input

The smallest input that runs compares the two sample snapshots bundled with the Actor in its `demo/` folder (three test listings in Calp, Spain, on 1 and 8 December 2026) and returns 31 rows. It is the declared `exampleRunInput`; an empty input `{}` does the same:

```json
{
  "demo": true
}
```

#### Input fields

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `demo` | boolean | No | - | Compare the bundled sample snapshots. Used only when you give no dataset ID: with both IDs the run compares your datasets and the log says the demo was ignored. `false` with no dataset ID is an error. |
| `previousDatasetId` | string | To compare your datasets (with `currentDatasetId`) | - | ID of the dataset with the OLDER snapshot. |
| `currentDatasetId` | string | To compare your datasets (with `previousDatasetId`) | - | ID of the dataset with the NEWER snapshot of the same platform and municipality. |
| `longBlockNights` | integer | No | 14 | Runs of consecutive sold nights at least this long are marked doubtful. Minimum 2. |

Giving only one of the two dataset IDs is an error that names the missing one. A dataset ID that does not exist, or a dataset that is empty, stops the run with an error that names it.

### Output

#### Example output

Two rows of the demo run (one night change and one listing month):

```json
[
  {
    "url": "https://www.example.com/rooms/A",
    "title": "Test listing A",
    "scrapedAt": "2026-12-08T06:00:00.000Z",
    "municipalityName": "Calp",
    "recordType": "night-change",
    "source": "test",
    "municipalityCode": "03047",
    "listingId": "A",
    "date": "2026-12-10",
    "change": "sold",
    "previousPrice": 120,
    "currentPrice": null,
    "soldPriceEstimate": 120,
    "currency": "EUR",
    "doubtful": false,
    "previousSnapshotAt": "2026-12-01T06:00:00.000Z",
    "currentSnapshotAt": "2026-12-08T06:00:00.000Z"
  },
  {
    "url": "https://www.example.com/rooms/A",
    "title": "Test listing A",
    "scrapedAt": "2026-12-08T06:00:00.000Z",
    "municipalityName": "Calp",
    "recordType": "listing-month",
    "source": "test",
    "municipalityCode": "03047",
    "listingId": "A",
    "month": "2026-12",
    "soldNightsEstimate": 2,
    "soldRevenueEstimate": 250,
    "averageSoldPriceEstimate": 125,
    "doubtfulNights": 0,
    "availableNights": 22,
    "currency": "EUR"
  }
]
```

#### Output fields

Every row:

| Field | Type | Description |
| --- | --- | --- |
| `url` | string | Listing URL from the current snapshot. |
| `title` | string or null | Listing title from the current snapshot. |
| `scrapedAt` | date-time | When the listing's current snapshot was taken (UTC). |
| `source` | string | Platform of both snapshots. |
| `municipalityCode` | string | Five-digit INE municipality code. |
| `municipalityName` | string | Municipality name. |
| `recordType` | string | `night-change` or `listing-month`. |
| `listingId` | string | Listing ID on the platform. |
| `currency` | string or null | Currency of the prices (the previous snapshot's for sold nights and monthly rows). |

`night-change` rows add `date`, `change` (`sold`, `released`, `price-changed`), `previousPrice`, `currentPrice`, `soldPriceEstimate`, `doubtful`, `previousSnapshotAt` and `currentSnapshotAt`.

`listing-month` rows add `month`, `soldNightsEstimate`, `soldRevenueEstimate` (null when a counted sold night had no price), `averageSoldPriceEstimate` (null when the revenue is unknown or nothing was sold), `doubtfulNights` and `availableNights` (nights of the month free in the current snapshot).

### Pricing

Pay-per-event with the two synthetic platform events: `apify-actor-start` at 0.00005 USD per run (Apify-recommended default, includes the first 5 seconds of compute) and `apify-default-dataset-item` at 1.00 USD per 1,000 results, one result per delivered row (changed night or listing month). Nothing is charged per listing compared: this Actor does not use the `monitor-check` event, and there is no `Actor.charge()` call, so users are never billed twice. Steadfetch keeps result prices between 1 and 10 USD per 1,000 results.

The number of rows grows with the number of listings and with the time between snapshots (more nights change). A comparison with no changed nights still delivers one `listing-month` row per listing and compared month.

**Works on the Apify free plan** - about 4,999 results for the $5 monthly credit (5.00 USD minus the 0.00005 USD run-start event, at 0.001 USD per result).

### FAQ

**Does it scrape any website?** No. It only reads two datasets of the account that runs it. The platform terms apply to whoever took those snapshots, not to this comparison.

**Where do the snapshots come from?** From the Steadfetch platform Actors, or from any dataset whose items follow the calendar snapshot contract in [docs/snapshot-contract.md](docs/snapshot-contract.md).

**Does it store my data?** No. It keeps nothing between runs; the snapshots and the results stay in your Apify account.

**Is there personal data in the output?** No. Rows carry the listing ID, URL, title, prices and dates from your snapshots; no host names or addresses.

**What if I swap the two datasets?** The run fails with an error saying the previous snapshot must be older than the current one, and delivers nothing.

**How much memory does a run need?** Both snapshots are held in memory while they are compared. For municipalities with thousands of listings, raise the run memory (the Actor allows up to 4 GB).

**When am I charged?** Once per run start (`apify-actor-start`) and once per row saved (`apify-default-dataset-item`). Failed runs deliver no rows and only incur the start event.

### Support

Report bugs or request features through the Apify Store page (Issues tab) of this Actor, or through the Steadfetch actors repository issues. Include the run ID and the input used.

### Maintenance

This Actor is **tested daily**: the monorepo CI runs `npm test` (the comparison rules on the bundled snapshots, offline) and the shared publish gate on every push, and the daily catalog QA runs the `{"demo": true}` input once it is published. Schema changes are announced through repository releases.

# Actor input Schema

## `demo` (type: `boolean`):

Compare the two sample snapshots bundled with the Actor (three test listings in Calp, 1 and 8 December 2026). Used only when you give no dataset ID: with both dataset IDs the run compares your datasets and ignores this box (the log says so). Unchecked with no dataset ID, the run fails asking for the IDs.

## `previousDatasetId` (type: `string`):

ID of the dataset holding the OLDER calendar snapshot (one item per listing, as delivered by a Steadfetch platform Actor). Give it together with currentDatasetId to compare your own datasets. Example: "Zr7GxfHqY2bW4kQpL".

## `currentDatasetId` (type: `string`):

ID of the dataset holding the NEWER calendar snapshot of the same platform and municipality. Give it together with previousDatasetId to compare your own datasets. Example: "Hq3TmV9cK1sN8dPxR".

## `longBlockNights` (type: `integer`):

A run of consecutive sold nights of a listing at least this long is marked doubtful (it may be an owner block, not a booking) and is left out of the estimated sold nights and revenue. Integer, minimum 2. Default: 14.

## Actor input object example

```json
{
  "demo": true,
  "previousDatasetId": "Zr7GxfHqY2bW4kQpL",
  "currentDatasetId": "Hq3TmV9cK1sN8dPxR",
  "longBlockNights": 14
}
```

# Actor output Schema

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

Dataset items validated against the item schema in dataset_schema.json (fields).

# 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 = {
    "demo": true,
    "previousDatasetId": "",
    "currentDatasetId": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadfetch/rental-calendar-monitor").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 = {
    "demo": True,
    "previousDatasetId": "",
    "currentDatasetId": "",
}

# Run the Actor and wait for it to finish
run = client.actor("steadfetch/rental-calendar-monitor").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 '{
  "demo": true,
  "previousDatasetId": "",
  "currentDatasetId": ""
}' |
apify call steadfetch/rental-calendar-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadfetch/rental-calendar-monitor"
        }
    }
}
```

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/XqJgit22sPwgc6n2s/builds/x1Na4FzBMcgYFxK2P/openapi.json
