Files
bpi-stock-price-scraper/README.md
T
Lino Silva fe4c54ebcb
Build and publish / build (push) Failing after 2m37s
feat: Initial move to docker image
2026-04-10 17:24:44 +01:00

1.5 KiB

bpi-stock-price-scraper

Web server API to fetch latest BPI PPR stock prices on demand.

Features

  • REST API endpoints to get latest prices for BPI Destino PPR funds
  • Returns price data as JSON
  • Dockerized for easy deployment
  • Health check endpoint included

Available Symbols

  • BPIDEST2040 - BPI Destino PPR 2040
  • BPIDEST2050 - BPI Destino PPR 2050

API Endpoints

  • GET / - API information and usage examples
  • GET /health - Health check with available symbols
  • GET /price/:symbol - Get latest price for a specific symbol

Example Response

{
  "symbol": "BPIDEST2040",
  "name": "BPI Destino PPR 2040",
  "price": 7.73313,
  "date": "2026-04-09",
  "timestamp": "2026-04-10T16:11:25.850Z"
}

Usage

Build and run with docker-compose:

docker compose up -d

Or build and run manually:

docker build -t bpi-stock-price-scraper .
docker run -p 3000:3000 bpi-stock-price-scraper

Node.js

Install dependencies and run:

npm install
npm start

For development with auto-reload:

npm run dev

Configuration

The server runs on port 3000 by default. You can change it via the PORT environment variable:

PORT=8080 npm start

Or in docker-compose.yml:

environment:
  - PORT=8080
ports:
  - "8080:8080"

Testing

Test the API:

# Get API info
curl http://localhost:3000/

# Check health
curl http://localhost:3000/health

# Get latest price
curl http://localhost:3000/price/BPIDEST2040