Skip to content

Research

AMFI Research & Information data. Currently covers Categorisation of Stocks (average market capitalisation data published bi-annually).

RSC pages

This module fetches data from Next.js React Server Component (RSC) pages rather than standalone JSON APIs, so behaviour may differ slightly from other modules.

Data dictionary: Research field reference →


amfipy.research.ResearchClient

Sync client for AMFI Research & Information pages.

Data is embedded in the page via Next.js RSC (React Server Components) and is extracted from the RSC payload on each request.

categorisation_of_stocks(as_df=False)

Fetch Avg. Market Capitalisation data (Categorisation of Stocks).

Data is published bi-annually (Jan–Jun, Jul–Dec) from 2017 onwards. Each entry contains PDF and Excel download links.

Returns:

Type Description
Any

Dict keyed by year string (e.g. "2024"), each value a list of::

{"period": "Jul - Dec", "pdfUrl": "https://...", "excelUrl": "https://..."}

Any

With as_df=True, returns a flat polars DataFrame with columns

Any

year, period, pdfUrl, excelUrl.

Example::

data = client.research.categorisation_of_stocks()
# data["2024"] → [{"period": "Jul - Dec", "pdfUrl": "...", "excelUrl": "..."}]

# Flat list
flat = client.research.categorisation_of_stocks_flat()

categorisation_of_stocks_flat()

Return categorisation data as a flat list ordered by year/period.

Each item: {"year": "2024", "period": "Jul - Dec", "pdfUrl": "...", "excelUrl": "..."}.

download_categorisation_file(url)

Download a categorisation PDF or Excel file.

Parameters:

Name Type Description Default
url str

Full URL from pdfUrl or excelUrl field.

required

Returns:

Type Description
bytes

Raw file bytes.

Example::

flat = client.research.categorisation_of_stocks_flat()
pdf = client.research.download_categorisation_file(flat[-1]["pdfUrl"])
open("categ_latest.pdf", "wb").write(pdf)