PSE Data Scraper pulls company lists and historical price data from PSE EDGE, then exports them to CSV for analysis. It includes a CLI, retry logic, optional caching, and a small Python API.
Install dependencies:
pip install -r requirements.txtRun the full pipeline:
python -m pse_data_scraper syncYou can also run the direct entry point (same defaults as pse sync):
python main.pyInstall locally for the pse command:
pip install -e .Examples:
pse sync
pse companies --refresh
pse prices --symbols BDO,ALI --from 2020-01-01 --to 2024-01-01
pse export --format csv
pse statusCommon options:
--rate-limitsets the delay between requests.--symbolslimits downloads to specific tickers.--max-companiesis useful for quick test runs.--refreshforces re-downloads even if files exist.--no-cachedisables cached API responses.- Dates accept
MM-DD-YYYYorYYYY-MM-DD.
Legacy commands (still supported): scrape, download, combine, all.
Generate a starter config:
pse initBy default, the CLI reads pse.toml from the current directory. You can
override it with --config path/to/pse.toml.
Example pse.toml:
[paths]
data_dir = "data"
cache_dir = ".cache"
[network]
rate_limit = 0.8
[download]
start_date = "2020-01-01"
symbols = ["BDO", "ALI"]from pse_data_scraper.client import PSEClient
from pse_data_scraper.scraper import scrape_companies, save_companies_to_csv
from pse_data_scraper.downloader import download_historical_data
from pse_data_scraper.combiner import combine_csvs
client = PSEClient(rate_limit_seconds=0.6)
companies = scrape_companies(client)
save_companies_to_csv(companies, "data/companies.csv")
download_historical_data(client, input_csv="data/companies.csv", output_dir="data/history")
combine_csvs("data/history", "data/combined.csv")data/companies.csv- company list with IDs and symbolsdata/history/- one CSV per companydata/combined.csv- consolidated price dataset.cache/- optional cached API responses
The scraper uses endpoints observed from PSE EDGE. See docs/API.md for
payload and response details.
pse-data-scraper/
├── main.py
├── pyproject.toml
├── requirements.txt
├── requirements-dev.txt
├── pse_data_scraper/
│ ├── cli.py
│ ├── client.py
│ ├── config.py
│ ├── downloader.py
│ ├── models.py
│ ├── pipeline.py
│ ├── scraper.py
│ ├── status.py
│ └── utils.py
├── utils/ # compatibility wrappers
└── docs/
└── API.md
pip install -e .
pip install -r requirements-dev.txt
pytestMIT. See LICENSE.