Skip to main content

finwatch

Financial market screening with pluggable rules and alerts.

Screen stocks, crypto, commodities, or any Yahoo Finance-supported asset against technical rules. Get notified via Telegram (or your own alert channel) when conditions are met.

Installation

pip install finwatch
# or with uv
uv add finwatch

Quick start

from finwatch import Watcher
from finwatch.retrievers.yahoo import YahooPriceRetriever
from finwatch.rules.rsi import RSIRule, RSIDirection

watcher = Watcher(
    retriever=YahooPriceRetriever(),
    rules=[RSIRule(threshold=30, direction=RSIDirection.BELOW)],
    alerts=[],
    period="3mo",
)

results = watcher.run(["AAPL", "TSLA", "BTC-USD", "ETH-USD", "GC=F"])

for r in results:
    status = "TRIGGERED" if r.triggered else "ok"
    print(f"[{status}] {r.symbol}")
    for rr in r.rule_results:
        print(f"  {rr.message}")

Multi-rule screening with Telegram alerts

import os
from finwatch import Watcher
from finwatch.retrievers.yahoo import YahooPriceRetriever
from finwatch.rules.rsi import RSIRule, RSIDirection
from finwatch.alerts.telegram import TelegramAlert

watcher = Watcher(
    retriever=YahooPriceRetriever(),
    rules=[
        RSIRule(threshold=30, direction=RSIDirection.BELOW),  # oversold
        RSIRule(threshold=70, direction=RSIDirection.ABOVE),  # overbought
    ],
    alerts=[
        TelegramAlert(
            token=os.environ["TELEGRAM_TOKEN"],
            chat_id=os.environ["TELEGRAM_CHAT_ID"],
        )
    ],
    period="3mo",
)

results = watcher.run(["AAPL", "TSLA", "MSFT", "BTC-USD", "ETH-USD"])
triggered = [r for r in results if r.triggered]
print(f"Screened {len(results)} assets — {len(triggered)} triggered.")

Each symbol is evaluated against all rules. ScreenResult.triggered is True if any rule fires. Inspect result.rule_results for per-rule detail.

Architecture

symbols
  └─▶ PriceRetriever.fetch()  ─▶  list[PriceBar]
                                        │
                              Rule.evaluate()  (×N rules)
                                        │
                              list[RuleResult]
                                        │
                              Watcher assembles  ─▶  list[ScreenResult]
                                        │
                           triggered results ─▶ Alert.send()

Extending finwatch

Custom PriceRetriever

from finwatch.retrievers.base import PriceRetriever
from finwatch.models import PriceBar

class MyRetriever(PriceRetriever):
    def fetch(self, symbol: str, period: str = "3mo") -> list[PriceBar]:
        # fetch from your data source
        ...

Custom Rule

from finwatch.rules.base import Rule
from finwatch.models import PriceBar, RuleResult

class MyRule(Rule):
    @property
    def name(self) -> str:
        return "MyRule"

    def evaluate(self, symbol: str, bars: list[PriceBar]) -> RuleResult:
        # compute indicator, return RuleResult
        ...

For indicator math, add a pure function to finwatch/indicators/ and import it in your rule.

Custom Alert

from finwatch.alerts.base import Alert
from finwatch.models import ScreenResult

class MyAlert(Alert):
    async def send(self, results: list[ScreenResult]) -> None:
        for r in results:
            if r.triggered:
                # send email, Slack, webhook, etc.
                ...

Environment variables

Variable Description
TELEGRAM_TOKEN Bot API token from @BotFather
TELEGRAM_CHAT_ID Target chat ID or channel username

Development

uv sync --all-extras

# Lint + format
ruff check . --fix && ruff format .

# Type check
mypy src/

# Tests
pytest --tb=short

Metadata

Release files for finwatch 0.2.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 finwatch 0.2.0
File Size Uploaded Provenance Actions
finwatch-0.2.0.tar.gz 9.1 kB With provenance Details for finwatch-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for finwatch 0.2.0
File Interpreter ABI Platform Actions
finwatch-0.2.0-py3-none-any.whl Python 3 none any Details for finwatch-0.2.0-py3-none-any.whl

Total release size: 25.6 kB

Release files / finwatch-0.2.0.tar.gz

Download URL finwatch-0.2.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9654101cf71499037d8496bd482df0f0d766efadbf318109cfd81a3e34cfe9f2
BLAKE2b-256 checksum
How to use checksums
71bba733f868136279998abaa8d6007d1291f015b72428e3bbbcd9ec2d9d441e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / finwatch-0.2.0-py3-none-any.whl

Download URL finwatch-0.2.0-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81a71c1079dbd0b5021d83b34985f51f9d0b1b2860e874723e982ed14326cf76
BLAKE2b-256 checksum
How to use checksums
10818d469ffacca8e0e07a53454691b3813ebc12145d249f1c186f5b98ef5b40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Security for finwatch 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for finwatch-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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