Skip to content

dnldd/cryexc-snap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cryexc-snap

HTTP service that captures screenshots of the cryexc footprint chart using a headless Chromium browser. A single GET /api/screenshot request returns a PNG of the configured chart, ready for use in dashboards, bots, or alerting pipelines.

Footprint chart screenshot

How it works

  • Launches a headless Chromium instance via go-rod
  • Navigates to the cryexc footprint widget with chart settings embedded in URL params
  • Waits for the public/footprint network response (confirming data has loaded) before capturing
  • Returns the screenshot as image/png

Endpoints

Method Path Description
GET /api/screenshot Capture and return a PNG screenshot
GET /status Health check — returns {"ok": true}

The screenshot endpoint accepts an optional ?delay=N query param (seconds) to override the default 2s post-load render wait.

Flags

Flag Default Description
--port 19847 Port to listen on
--cryexc-url (built-in) Full cryexc URL; configurable params below override it
--tick-size 25 Footprint tick size in USD
--history 3h History window as a duration (1h, 90m, 2h30m)
--viewport 2560x1440 Browser viewport as WxH
--prefetch-browser Download the headless browser binary and exit

Running locally

go run . --tick-size 25 --history 3h

Then capture a screenshot:

curl -o screenshot.png http://localhost:19847/api/screenshot

Running tests

./run_test.sh          # unit tests
./run_test.sh live     # end-to-end tests against the real cryexc site
./run_test.sh all      # both

Live tests save the captured screenshot to testdata/screenshot.png.

Docker

docker build -t cryexc-snap .
docker run -p 19847:19847 cryexc-snap

The image prefetches the headless browser at build time so the container starts cleanly with no network dependency at runtime.

Deployment

A Kubernetes Deployment and Service manifest is provided in k8s/. The --cryexc-url flag can be overridden via the CRYEXC_URL environment variable defined in the manifest.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors