# CEF Discount & NAV Monitor (closed-end funds) (`szopers/cef-discount-monitor`) Actor

Daily premium/discount snapshot for US closed-end funds: price vs NAV, trailing z-score and percentile, plus flags for unusually wide/narrow discounts. The only CEF data source on Apify.

- **URL**: https://apify.com/szopers/cef-discount-monitor.md
- **Developed by:** [Michał Szopa](https://apify.com/szopers) (community)
- **Categories:** AI, Agents, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 fund analyzeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## CEF Discount & NAV Monitor

Daily **premium/discount snapshot for US closed-end funds (CEFs)** — the only CEF data source on Apify. For each fund: market price, NAV, current discount, trailing z-score and percentile, plus flags for **unusually wide or narrow** discounts.

### Why discounts matter

A closed-end fund trades at a market price that can differ substantially from the value of its holdings (NAV). Discounts mean-revert: an unusually wide discount (z-score ≤ −2 vs its own trailing year) has historically tended to narrow back. This actor computes exactly that signal — the classic input for CEF mean-reversion strategies, discount screens, and activist-target watchlists.

Pairs naturally with the [SEC Activist 13D/13G Monitor](https://apify.com/szopers/sec-activist-13d-monitor): activists target CEFs with persistent wide discounts.

### Input

| Field | Default | Description |
|---|---|---|
| `tickers` | built-in universe | Any US CEF tickers. Empty = ~50 liquid equity/hybrid CEFs (Adams, Gabelli, Eaton Vance, BlackRock, Cohen & Steers...). |
| `zScoreWindowSessions` | `252` | Trailing window for z-score/percentile (252 = 1 year). |
| `historyRange` | `2y` | Daily history downloaded per fund. |
| `onlySignals` | `false` | Output only funds with z ≤ −2 or z ≥ +2 (alerting mode). |
| `proxyConfiguration` | Apify proxy | Proxy for data requests. |

### Output

One item per fund, sorted from the widest discount:

```json
{
  "ticker": "RVT",
  "date": "2026-07-06",
  "price": 18.37,
  "nav": 21.0,
  "discount_pct": -12.52,
  "discount_avg_pct": -9.59,
  "z_score": -1.74,
  "percentile": 5.2,
  "window_sessions": 252,
  "window_min_pct": -13.1,
  "window_max_pct": -5.8,
  "is_unusually_wide": false,
  "is_unusually_narrow": false
}
````

Funds without a NAV series on the data source (or with under 60 overlapping sessions) are skipped and listed in the log — no silent gaps.

### Typical setup

Schedule a daily run after US market close (e.g. 22:30 UTC), with `onlySignals: true` and an email/Slack/webhook [integration](https://docs.apify.com/platform/integrations) — you get pinged only when a discount leaves its normal range.

### Data source & disclaimer

Price and NAV series come from publicly available Yahoo Finance endpoints (NAV under the `X{TICKER}X` symbol convention). Data is end-of-day and provided as-is; verify before trading. This actor is **not investment advice** — historical mean-reversion of discounts is a research finding, not a guarantee.

# Actor input Schema

## `tickers` (type: `array`):

Closed-end fund tickers to analyze. Leave empty to use the built-in universe of ~50 liquid US equity/hybrid CEFs. NAV must be available on Yahoo Finance under X{TICKER}X (true for most US CEFs).

## `zScoreWindowSessions` (type: `integer`):

Trailing window for the discount z-score and percentile. 252 sessions = 1 year.

## `historyRange` (type: `string`):

How much daily history to download per fund.

## `onlySignals` (type: `boolean`):

Output only funds with an unusually wide (z ≤ −2) or narrow (z ≥ +2) discount — ideal for alerting.

## `proxyConfiguration` (type: `object`):

Proxy for Yahoo Finance requests. Recommended: Apify automatic proxy.

## Actor input object example

```json
{
  "tickers": [],
  "zScoreWindowSessions": 252,
  "historyRange": "2y",
  "onlySignals": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `snapshot` (type: `string`):

All analyzed funds, sorted by z-score (widest discounts first).

# 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("szopers/cef-discount-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("szopers/cef-discount-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 szopers/cef-discount-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=szopers/cef-discount-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "CEF Discount & NAV Monitor (closed-end funds)",
        "description": "Daily premium/discount snapshot for US closed-end funds: price vs NAV, trailing z-score and percentile, plus flags for unusually wide/narrow discounts. The only CEF data source on Apify.",
        "version": "0.1",
        "x-build-id": "NKrwnsXj7G7hxr0IC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/szopers~cef-discount-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-szopers-cef-discount-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/szopers~cef-discount-monitor/runs": {
            "post": {
                "operationId": "runs-sync-szopers-cef-discount-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/szopers~cef-discount-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-szopers-cef-discount-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "tickers": {
                        "title": "CEF tickers",
                        "type": "array",
                        "description": "Closed-end fund tickers to analyze. Leave empty to use the built-in universe of ~50 liquid US equity/hybrid CEFs. NAV must be available on Yahoo Finance under X{TICKER}X (true for most US CEFs).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "zScoreWindowSessions": {
                        "title": "Z-score window (trading sessions)",
                        "minimum": 60,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Trailing window for the discount z-score and percentile. 252 sessions = 1 year.",
                        "default": 252
                    },
                    "historyRange": {
                        "title": "History range",
                        "enum": [
                            "1y",
                            "2y",
                            "5y"
                        ],
                        "type": "string",
                        "description": "How much daily history to download per fund.",
                        "default": "2y"
                    },
                    "onlySignals": {
                        "title": "Only signals",
                        "type": "boolean",
                        "description": "Output only funds with an unusually wide (z ≤ −2) or narrow (z ≥ +2) discount — ideal for alerting.",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "Proxy for Yahoo Finance requests. Recommended: Apify automatic proxy.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
