Skip to content

About

Extract data from BdC

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

BdC Data Extraction

Downloads daily French market bulletin PDFs (BCFR_YYYYMMDD.pdf) from BdC website over a date range via CLI or Python.

Setup with uv

Activate the virtual environment

source .venv/bin/activate

Install dependencies

uv sync

Run commands directly inside the virtual environment with uv run:

uv run main.py --help

CLI Usage

Download bulletins for a date range (weekends are skipped by default):

uv run python main.py \
  --start-date 2026-11-16 \
  --end-date 2026-11-27 \
  --output-dir ./bulletins \
  --sleep 0.5

CLI Options

Flag Default Description
--start-date required Start date (YYYY-MM-DD, inclusive)
--end-date required End date (YYYY-MM-DD, inclusive)
--output-dir . Target folder for downloaded PDFs
--sleep 0.0 Seconds to pause between dates
--include-weekends false Check Saturday and Sunday dates too
--verify-ssl false Enable TLS certificate verification
--overwrite false Re-download files that already exist
--timeout 30 Per-request timeout in seconds
-v, --verbose false Show skipped weekends and missing dates (DEBUG logs)

Python Usage

Import download_bulletins from main.py:

from datetime import date
from main import download_bulletins

files = download_bulletins(
    start_date=date(2026, 11, 16),
    end_date="2026-11-27",
    output_dir="./bulletins",
    sleep_seconds=0.5,
    skip_weekends=True,
)

URL & Date Rules

Target pattern:

https://www.casablanca-bourse.com/sites/default/files/bulletins/{ingestion_year_month}/fr/BCFR_{YYYYMMDD}.pdf

  • Before 2026-07-03: Uses 2026-06.
  • On 2026-07-03: Uses 09-2026.
  • After 2026-07-03: Tries YYYY-MM of the bulletin date first, then falls back to the previous month (YYYY-MM) on 404.
  • Weekends: Saturday and Sunday are skipped by default (skip_weekends=True).
  • TLS verification: Disabled by default (verify_ssl=False) with InsecureRequestWarning suppressed to work around the host's incomplete certificate chain.

About

Extract data from BdC

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages