Sign inSign up

schwitzd/ark-scraper-collector

By schwitzd

•Updated 10 months ago

Automated scraper for ARK Invest trades, publishing data to a message queue for downstream processin

Image
0

817

schwitzd/ark-scraper-collector repository overview

⁠ARK Scraper Collector

Scrapes the daily ARK Invest trades file, parses each row, and publishes trades to RabbitMQ, with optional exception emails on failures. ARK Invest publishes trades once per day, but this project does not include an internal scheduler. The suggested and tested approach is running it as a Kubernetes CronJob.

⁠Requirements

  • RabbitMQ reachable from this service

⁠Environment variables

VariableRequiredDefaultDescription
ARK_TRADE_FILE_URLyes-URL to the ARK trades XLS file.
RABBITMQ_URLyes-RabbitMQ connection URL.
RABBITMQ_VHOSTno-RabbitMQ virtual host (appended to RABBITMQ_URL if URL has no vhost).
RABBITMQ_USERNAMEno-RabbitMQ username (applied to RABBITMQ_URL if URL has no credentials).
RABBITMQ_PASSWORDno-RabbitMQ password (applied to RABBITMQ_URL if URL has no credentials).
RABBITMQ_EXCHANGEyes-Exchange to publish trades to.
RABBITMQ_QUEUEyes-Queue to bind and publish into.
RABBITMQ_ROUTING_KEYyes-Routing key for published messages.
TO_EMAILSno-Comma-separated list of emails for exception alerts (emailing is disabled unless this and MAILER_API_URL are set).
MAILER_API_URLno-REST endpoint that sends the exception email (emailing is disabled unless this and TO_EMAILS are set).
MAILER_API_KEYno-Optional API key for the mailer service (sent as Authorization: Bearer ...).
MAILER_INCLUDE_TRACEBACKnofalseWhen true, include full tracebacks in exception emails.

⁠Run with Docker

This image will be published on Docker Hub.

docker pull <your-dockerhub-username>/ark-scraper-collector:latest
docker run --rm \
  -e ARK_TRADE_FILE_URL="https://example.com/path/to/ark_trades.xlsx" \
  -e RABBITMQ_URL="amqp://guest:guest@rabbitmq/" \
  -e RABBITMQ_EXCHANGE="ark.trades" \
  -e RABBITMQ_QUEUE="ark.trades" \
  -e RABBITMQ_ROUTING_KEY="ark.trades" \
  <your-dockerhub-username>/ark-scraper-collector:latest

⁠Development

If you use any IDE that supports devcontainers⁠, open the repo in the provided devcontainer. It includes the right Python version and dependencies so you can start coding without extra setup.

For local work outside the container:

uv sync --group dev

Run the test suite with:

uv run pytest

Tag summary

Content type

Image

Digest

sha256:d9f6d1a73…

Size

88.4 MB

Last updated

10 months ago

docker pull schwitzd/ark-scraper-collector