Skip to main content

Exchange Radar

Version License Build Status

Real-time cryptocurrency trades, trade history and price alerts from Binance, Coinbase, Kraken, KuCoin, OKX, Bybit, Bitstamp, MEXC and HTX.

Local setup

Requires Docker with Compose; Python 3.12 is used inside the application images.

  1. Check the service settings in .envs/.local/.

  2. Copy compose/rabbitmq/rabbitmq-definitions.example.json to compose/rabbitmq/rabbitmq-definitions.json. Replace both password-hash placeholders using rabbitmqctl hash_password; the trades password must match the stack's .rabbitmq settings. Keep the populated file private.

  3. Start the stack:

    docker compose -f local.yml up --build -d
    

For one exchange, use docker compose -f local.yml up --build consumer producer-okx. Open BTC trades; append /whales, /dolphins or /octopuses for filtered feeds. Replace BTC with another configured coin. The API schema is at /api/schema.yaml.

Production deployment

Before deploying:

  • Configure the private .envs/.production/ service files and RabbitMQ definitions. Rotate any previously exposed broker credentials; see SECURITY.md.
  • Put a strong INTERNAL_API_TOKEN in the root .env. Web and consumer must share it and be updated together. Generate it privately with python3 -c "import secrets; print(secrets.token_urlsafe(32))".
  • Set ALLOWED_HOSTS to your public hostname plus web and exchange-radar-web. Set FORWARDED_ALLOW_IPS to the actual proxy source address seen by the web container. Correct forwarding is required for HTTPS push origin checks.
  • Serve through an HTTPS reverse proxy. Published ports bind to 127.0.0.1. For a proxy on another host, set WEB_BIND_ADDRESS to a private interface and restrict access to that proxy. Keep Redis and RabbitMQ private.

Keep these settings in root .env, preserve existing push keys, and restrict secret-file permissions (chmod 600 .env). Never commit the populated files.

On an existing server, deploy with:

make deploy

This pulls with fast-forward only, validates configuration, builds images, waits for a Redis snapshot, stops consumers and updates the stack with two replicas. Failures stop later steps. It preserves volumes and performs no Docker pruning. The Redis snapshot is not an off-host backup or a RabbitMQ backup.

For a first install, use docker compose -f production.yml up -d --build --scale consumer=2. After deployment, check live trades, saved history, alerts and notification Send test.

Recovery and data

Services use restart: unless-stopped. To restart an existing stopped stack while keeping its containers and replica count:

docker compose -f production.yml start

Preserve the Compose project name, Redis/RabbitMQ volumes and RabbitMQ hostname exchange-radar-rabbitmq. down -v deletes persistent data. Back up both services before maintenance. Recreating producers loses their in-memory backlog; prefer updating only affected services during routine maintenance.

RabbitMQ is still pinned to unsupported 3.12.13. Its staged upgrade is separate from application deployment; see SECURITY.md.

Alerts and browser notifications

The scheduler checks for price changes of at least 1% over one minute or 2% over ten minutes. The alert log shows the actual comparison interval. Restarting the scheduler or missing coin statistics resets that coin's baseline.

Use Notifications in the top bar to choose BTC, ETH, LINK or PEPE, alert rules, and a 0/5/15-minute minimum gap per coin and direction. Settings belong to the current browser; Turn off removes its subscription. HTTPS is required (localhost also works). On iPhone/iPad, first add the site to the Home Screen. If permission is blocked, change browser site settings and reload.

Push is disabled by default. To enable it:

  1. After building the production images, generate keys once in a private terminal:

    docker compose -f production.yml run --rm --no-deps web poetry run python -m exchange_radar.push_keys
    
  2. Add the output to root .env, along with:

    PUSH_ENABLED=true
    PUSH_VAPID_SUBJECT=mailto:your-contact@example.com
    

    The generated values are PUSH_VAPID_PUBLIC_KEY and PUSH_VAPID_PRIVATE_KEY. Keep the private key secret and preserve both keys across deployments; replacing them requires browsers to subscribe again.

  3. Recreate web and scheduler: docker compose -f production.yml up -d --build web scheduler.

  4. Enable notifications and use Send test. Check receipt with the page closed and confirm that clicking opens the coin's alert log.

Delivery uses existing Redis and the scheduler, with no extra container. It is best effort: transient failures retry, jobs expire after five minutes, and browser or OS settings can prevent display. The alert log remains the record of events. Subscriptions expire after 180 days without a settings refresh. Disable push with PUSH_ENABLED=false and recreate web/scheduler; alert history continues normally.

Operations and development

  • Producers → RabbitMQ → consumers → web → browser; Redis stores statistics and history. Delivery is at least once, so duplicates are possible. Producer buffers are finite and in memory; restarts, overload and exchange outages can lose trades. HTX reconnect recovery covers only its recent-history window within a running process.
  • Consumer batches contain up to 50 trades and flush after at most 20 ms of collection. Growing producer backlog and growing broker queues are different bottlenecks; adding consumers helps the latter.
  • Filtered feeds retain 256 rows per coin/category by default (FEED_RETENTION_ROWS) and respect REDIS_EXPIRATION. The all-trades feed is live-only.
  • Exchange/coin lists in private .producer, .web and .scheduler files need manual updates. Remove retired EQTY, FTM and S entries; remove SUSDT, SBTC and S-USDT subscriptions where present before clearing their old data.
Task Command
Tests make tests
Coverage make coverage
Lint make pre-commit-verify
Benchmarks make benchmark (sample output)

Optional integration tests use TEST_REDIS_URL and TEST_AMQP_URL. Point them at test services only; tests create unique keys/queues and clean up their own data.

Metadata

Release files for exchange-radar 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for exchange-radar 1.9.0
File Size Uploaded Provenance Actions
exchange_radar-1.9.0.tar.gz 115.3 kB Without provenance Details for exchange_radar-1.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for exchange-radar 1.9.0
File Interpreter ABI Platform Actions
exchange_radar-1.9.0-py3-none-any.whl Python 3 none any Details for exchange_radar-1.9.0-py3-none-any.whl

Total release size: 282.8 kB

Release files / exchange_radar-1.9.0.tar.gz

Download URL exchange_radar-1.9.0.tar.gz
Size 115.3 kB
Tags Source
SHA-256 checksum
How to use checksums
548e02e6807f323232aa2506236b86a33c55264aa3139e3617dffb8548520ac4
BLAKE2b-256 checksum
How to use checksums
602a5cb08d6a753778ce2f3d388a9651e507dbd5c336bfb229fcf1ad6bb585ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.15.0 Darwin/27.2.0

Release files / exchange_radar-1.9.0-py3-none-any.whl

Download URL exchange_radar-1.9.0-py3-none-any.whl
Size 167.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31006af76f2e54d0ed3a9195427f6d7efb03065fea8458ca1d1b3ef538c4cfd4
BLAKE2b-256 checksum
How to use checksums
f84c88223c70a312fd8d11a1ed28f6da0f93e2c412bbce52572a692727dfdd56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.15.0 Darwin/27.2.0

Security for exchange-radar 1.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page