Skip to main content

Typed async client for the HighLowTicker algo feed (ws://127.0.0.1:7412).

Project description

highlowticker-algo-feed

Typed async Python client for the HighLowTicker algo feed, the local WebSocket at ws://127.0.0.1:7412 that streams live new-high / new-low tape events from HighLowTicker to your own program.

This is the ergonomic alternative to hand-writing the connect-and-parse boilerplate. The frame models are generated from the published wire-protocol JSON Schema, so they always match what the app emits.

Install

pip install highlowticker-algo-feed

Requirements

  • HighLowTicker running with the algo feed enabled (Settings, Algo feed :7412).
  • Python 3.9 or newer.

Usage

Three levels of control — pick your altitude.

Quickstart (no async)

from hlt_algo_feed import notify_when

# "notify WHEN a symbol makes its 5th new high, THEN send an alert"
notify_when(
    when=lambda ev: ev.event == "new_high" and (ev.high_count or 0) >= 5,
    then=lambda ev: print(f"🔼 {ev.symbol} · {ev.high_count} new highs"),
    once=lambda ev: (ev.symbol, "high"),
    watch=["AAPL", "MSFT"],
)

then is any function you supply — post to Discord, Slack, Telegram, a webhook, email, or anything else. The package ships no messaging SDK and is channel-neutral. For a long-running strategy, use run(handler, watch=[...]) with a callable that keeps its own state.

Async driver (already inside an event loop)

import asyncio
from hlt_algo_feed import AlgoFeed

async def main():
    await AlgoFeed().run(
        lambda ev: print(ev.symbol, ev.event),
        watch=["SPY"],
    )   # owns connect + loop + reconnect

asyncio.run(main())

Raw / filtered iteration (full control)

import asyncio
from hlt_algo_feed import AlgoFeed

async def main():
    async with AlgoFeed() as feed:
        await feed.watch(["AAPL"])
        async for ev in feed.new_highs():   # or: async for ev in feed
            print(ev.symbol, ev.high_count)

asyncio.run(main())

Every ev is a typed TapeEvent (a pydantic model). Unknown fields from a newer app build are ignored, so an older client keeps working against a newer binary. See examples/ for complete notify + strategy scripts, each shown bare-bones (no dependencies) and using this package.

Note on the schema

schema/algo-feed.schema.json is a vendored copy of the wire-protocol schema generated from the app's Rust types. The pydantic models in src/hlt_algo_feed/models.py are generated from that file. When the protocol changes, refresh both: copy the new schema in, then regenerate the models with datamodel-code-generator (see tests/test_models_drift.py for the exact command). The drift test fails if the committed models do not match the schema.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

highlowticker_algo_feed-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

highlowticker_algo_feed-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file highlowticker_algo_feed-0.1.0.tar.gz.

File metadata

  • Download URL: highlowticker_algo_feed-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for highlowticker_algo_feed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71fe6ecef47b92145bba85da8b38ee6480228bd6472e49d008133297728b8cae
MD5 43a3e0895e80a7ac6545ae31bbb0ac13
BLAKE2b-256 2a1b01cd9410e8945209ef0db8aa0e9b83e2b8da2ebb9395b4893b5f35a4cb51

See more details on using hashes here.

File details

Details for the file highlowticker_algo_feed-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for highlowticker_algo_feed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80778ed227773680154a96b0ab690dae749656f2f4f7336d66850c24d2e93646
MD5 1c704821d7fd44ae0fbda3757aa00228
BLAKE2b-256 f3139b543fb1781c53bfcd3b1778e2a04fd267d5c96f88110c618ce61d60fd4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page