kuhl_haus.mdp.enum package

Enumerations and constants for market data processing pipeline.

Defines scanner types, queue identifiers, cache keys with TTLs, and pub/sub channel names used throughout the real-time market data ingestion and analysis system. All Redis key patterns and time constants are centralized here.

Submodules

kuhl_haus.mdp.enum.constants module

Time duration constants in seconds for cache TTL and rate limiting.

Provides standardized duration values used throughout the market data pipeline for Redis cache expiration and throttle intervals. All values are in seconds to match Redis TTL expectations.

kuhl_haus.mdp.enum.finlight_data_cache module

Redis list size limits for Finlight news cache keys.

Defines the maximum number of articles retained per cache key type. Larger feed cache supports deep history for initial client loads; per-ticker cache is intentionally smaller to bound per-key memory use.

class kuhl_haus.mdp.enum.finlight_data_cache.FinlightDataCache(*values)[source]

Bases: Enum

NEWS_FEED_LIST_MAX = 10000
NEWS_TICKER_LIST_MAX = 100

kuhl_haus.mdp.enum.finlight_data_queue module

Queue identifier for routing Finlight news article messages.

class kuhl_haus.mdp.enum.finlight_data_queue.FinlightDataQueue(*values)[source]

Bases: Enum

Message type identifier for Finlight WebSocket article streams.

NEWS = 'news'

kuhl_haus.mdp.enum.market_data_cache_keys module

Redis cache key patterns for internal market data storage.

Defines all cache key templates used within MDP for storing raw WebSocket data, computed analytics, and rate-limiting state. Keys support pattern matching for bulk operations (e.g., TOP_TRADES_RECENT_SCAN for multi-symbol cleanup). These are internal MDC keys. For WDC-facing pub/sub and cache keys, use WidgetDataCacheKeys.

The following members are deprecated as of v0.4.0 and will be removed in the next minor release (no active usages found):

  • TOP_TRADES_WIDGET_CACHE_KEY

  • TOP_TRADES_ALL_SYMBOLS_CACHE_KEY

  • DAILY_AGGREGATES

  • TOP_TRADES_SCANNER

  • TOP_GAINERS_SCANNER

  • TOP_GAPPERS_SCANNER

  • TOP_STOCKS_SCANNER

  • TOP_VOLUME_SCANNER

class kuhl_haus.mdp.enum.market_data_cache_keys.MarketDataCacheKeys(*values)[source]

Bases: Enum

Redis key patterns for caching raw data, analytics, and rate-limit state.

Internal cache keys for MDP components. Includes both concrete keys and string templates with placeholders (e.g., {symbol}, {date}) for dynamic instantiation. Pattern-based keys ending in ‘*’ enable SCAN operations for bulk cleanup and inspection.

For WDC-facing pub/sub and cache keys (scanner channels, quote feed, news feeds), use WidgetDataCacheKeys instead.

Deprecated since version The: following members are deprecated as of v0.4.0 and will be removed in the next minor release (no active usages found):

  • TOP_TRADES_WIDGET_CACHE_KEY

  • TOP_TRADES_ALL_SYMBOLS_CACHE_KEY

  • DAILY_AGGREGATES

  • TOP_TRADES_SCANNER

  • TOP_GAINERS_SCANNER

  • TOP_GAPPERS_SCANNER

  • TOP_STOCKS_SCANNER

  • TOP_VOLUME_SCANNER

AGGREGATE = 'stocks:agg'
TRADES = 'stocks:trades'
QUOTES = 'stocks:quotes'
HALTS = 'stocks:luld'
UNKNOWN = 'unknown'
LEADERBOARD_TOP_VOLUME = 'leaderboard:top_volume'
LEADERBOARD_TOP_GAPPERS = 'leaderboard:top_gappers'
LEADERBOARD_TOP_GAINERS = 'leaderboard:top_gainers'
LEADERBOARD_PUBLISH_THROTTLE_KEY = 'leaderboard:last_publish'
LEADERBOARD_MARKET_DAY_KEY = 'leaderboard:market:current_day_start'
LEADERBOARD_MARKET_OPEN_RESET_KEY = 'leaderboard:market:open_reset:{date}'
TOP_TRADES_RECENT_PREFIX = 'tta:{symbol}:recent'
TOP_TRADES_RECENT_SCAN = 'tta:*:recent'
TOP_TRADES_STATS_PREFIX = 'tta:{symbol}:stats'
TOP_TRADES_LAST_PUBLISH_KEY = 'tta:last_publish'
TOP_TRADES_WIDGET_CACHE_KEY = 'tta:{symbol}:widget'
TOP_TRADES_ALL_SYMBOLS_CACHE_KEY = 'tta:all_symbols:widget'
TICKER_SNAPSHOTS = 'mdc:snapshots'
TICKER_AVG_VOLUME = 'mdc:avg_volume'
TICKER_FREE_FLOAT = 'mdc:free_float'
TICKER_SNAPSHOT_LOCK = 'mdc:lock:snapshots'
TICKER_AVG_VOLUME_LOCK = 'mdc:lock:avg_volume'
TICKER_FREE_FLOAT_LOCK = 'mdc:lock:free_float'
DAILY_AGGREGATES = 'mdc:aggregate:daily'
TOP_TRADES_SCANNER = 'cache:top_trades'
TOP_GAINERS_SCANNER = 'cache:top_gainers'
TOP_GAPPERS_SCANNER = 'cache:top_gappers'
TOP_STOCKS_SCANNER = 'cache:top_stocks'
TOP_VOLUME_SCANNER = 'cache:top_volume'

kuhl_haus.mdp.enum.market_data_cache_ttl module

Redis cache TTL values in seconds for internal market data artifacts (MDC).

Defines expiration times for all MDC-resident cached data types in the real-time pipeline. TTLs are tuned based on data volatility, API rate limits, and frontend refresh requirements. Shorter TTLs for high-frequency data, longer for reference data.

For WDC-facing TTLs (scanner results, quote feed, news feeds), use WidgetDataCacheTTL instead.

The following members are deprecated as of v0.4.0 and will be removed in the next minor release (no active usages found in src/, tests/, or mdp-servers):

class kuhl_haus.mdp.enum.market_data_cache_ttl.MarketDataCacheTTL(*values)[source]

Bases: Enum

Time-to-live durations for Redis cache entries across all data types.

TTL selection balances freshness requirements against API quotas and memory pressure. High-velocity trade data expires quickly; reference data like float shares persists for hours. Negative cache prevents retry storms on API failures.

Deprecated since version The: following members are deprecated as of v0.4.0 and will be removed in the next minor release (no active usages found):

  • NEGATIVE_CACHE_THROTTLE

  • LEADERBOARD_TOP_VOLUME

  • LEADERBOARD_TOP_GAPPERS

  • LEADERBOARD_TOP_GAINERS

  • TOP_STOCKS_SCANNER → use WidgetDataCacheTTL.TOP_STOCKS_SCANNER

  • TOP_VOLUME_SCANNER → use WidgetDataCacheTTL.TOP_VOLUME_SCANNER

  • TOP_GAINERS_SCANNER → use WidgetDataCacheTTL.TOP_GAINERS_SCANNER

  • TOP_GAPPERS_SCANNER → use WidgetDataCacheTTL.TOP_GAPPERS_SCANNER

NEGATIVE_CACHE_THROTTLE = 60
NEGATIVE_CACHE_SESSION = 21600
AGGREGATE = 300
HALTS = 86400
QUOTES = 3600
TRADES = 3600
UNKNOWN = 86400
TICKER_AVG_VOLUME = 43200
TICKER_FREE_FLOAT = 43200
TICKER_SNAPSHOTS = 28800
TICKER_SNAPSHOT_LOCK = 30
TICKER_AVG_VOLUME_LOCK = 30
TICKER_FREE_FLOAT_LOCK = 30
LEADERBOARD_ANALYZER = 3600
LEADERBOARD_TOP_VOLUME = 259200
LEADERBOARD_TOP_GAPPERS = 259200
LEADERBOARD_TOP_GAINERS = 259200
TOP_TRADES_TRADE_TTL = 300
TOP_TRADES_WIDGET_CACHE_TTL = 60
TOP_TRADES_ALL_SYMBOLS_CACHE_TTL = 60
QUOTE = 345600
TOP_STOCKS_SCANNER = 28800
TOP_VOLUME_SCANNER = 345600
TOP_GAINERS_SCANNER = 345600
TOP_GAPPERS_SCANNER = 345600
NEWS_FEED_LATEST = 172800
NEWS_TICKER = 604800
kuhl_haus.mdp.enum.market_data_cache_ttl.__getattr__(name: str)[source]

Module-level __getattr__ to warn on access of deprecated enum members via module.

kuhl_haus.mdp.enum.market_data_pubsub_keys module

Redis pub/sub channel names for external Widget Data Service consumption.

Deprecated since version ``MarketDataPubSubKeys``: is deprecated as of v0.4.0 and will be removed in the next minor release. Use WidgetDataCacheKeys instead, which consolidates all WDC-facing pub/sub and cache keys.

Exception: NEWS_FEED_LATEST and NEWS_TICKER are still referenced in tests and will be migrated in the same release.

Channel keys published by the market data processor for downstream consumers. Widget Data Service subscribes to these channels to receive scanner results and push them to frontend clients via WebSocket.

class kuhl_haus.mdp.enum.market_data_pubsub_keys.MarketDataPubSubKeys(*values)[source]

Bases: Enum

Redis channel identifiers for scanner result distribution.

Deprecated since version ``MarketDataPubSubKeys``: is deprecated as of v0.4.0 and will be removed in the next minor release. Use WidgetDataCacheKeys instead.

Exception: NEWS_FEED_LATEST and NEWS_TICKER are still referenced in tests and will be migrated in the same release.

Published by MDP analyzers after processing real-time market data. Widget Data Service subscribes to forward results to frontend clients. Multiple time windows available for Top Trades to support different UI refresh rates.

TOP_10_LISTS_SCANNER = 'scanners:top_10_lists'
TOP_TRADES_SCANNER_ONE_HOUR = 'scanners:top_trades:1h'
TOP_TRADES_SCANNER_FIVE_MINUTES = 'scanners:top_trades:5m'
TOP_TRADES_SCANNER_ONE_MINUTE = 'scanners:top_trades:1m'
QUOTE = 'quote'
TOP_GAINERS_SCANNER = 'scanners:top_gainers'
TOP_GAPPERS_SCANNER = 'scanners:top_gappers'
TOP_VOLUME_SCANNER = 'scanners:top_volume'
NEWS_FEED_LATEST = 'news:feed:latest'
NEWS_TICKER = 'news:ticker:{ticker}'

kuhl_haus.mdp.enum.market_data_scanner_names module

Scanner type identifiers for market data analysis pipelines.

Each scanner processes real-time WebSocket data from Massive.com to identify stocks matching specific criteria. Scanner names are used as routing keys for Redis pub/sub channels and cache key prefixes.

class kuhl_haus.mdp.enum.market_data_scanner_names.MarketDataScannerNames(*values)[source]

Bases: Enum

Scanner identifiers for real-time market data analysis.

Each value maps to a distinct analysis pipeline that filters and ranks securities based on trading activity. Scanners run concurrently and publish results to Redis channels consumed by the Widget Data Service.

TOP_TRADES = 'top_trades'
TOP_STOCKS = 'top_stocks'
TOP_GAINERS = 'top_gainers'
TOP_GAPPERS = 'top_gappers'
TOP_VOLUME = 'top_volume'
SMALL_CAP_HOD_MOMO = 'small_cap_hod_momo'

kuhl_haus.mdp.enum.market_status_value module

Market session state identifiers for trading hours control.

Values returned from Massive.com market status API and used to gate data processing behavior. OPEN triggers full pipeline activation; CLOSED may pause WebSocket subscriptions or reduce processing intensity; EXTENDED_HOURS enables pre-market and after-hours handling.

class kuhl_haus.mdp.enum.market_status_value.MarketStatusValue(*values)[source]

Bases: Enum

Current market session state from Massive.com API.

Controls pipeline behavior based on trading hours. Checked at startup and periodically to adjust WebSocket subscriptions and scanner activity. EXTENDED_HOURS includes pre-market (4-9:30 AM ET) and after-hours (4-8 PM ET).

OPEN = 'open'
CLOSED = 'closed'
EXTENDED_HOURS = 'extended-hours'

kuhl_haus.mdp.enum.massive_data_queue module

Queue identifiers for routing incoming market data from Massive.com WebSocket.

Each enum value corresponds to a message type in the real-time data stream. Messages are dispatched to separate processing queues based on these identifiers to enable concurrent, type-specific handling in the data pipeline.

class kuhl_haus.mdp.enum.massive_data_queue.MassiveDataQueue(*values)[source]

Bases: Enum

Message type identifiers for Massive.com WebSocket data streams.

Incoming messages are classified and routed to dedicated async queues for parallel processing. Expect 1,000+ messages/sec at peak market hours.

AGGREGATE = 'aggregate'
TRADES = 'trades'
QUOTES = 'quotes'
HALTS = 'halts'
UNKNOWN = 'unknown'

kuhl_haus.mdp.enum.widget_data_cache_keys module

Redis key and channel names for the Widget Data Cache (WDC).

All keys written by Analyzers/Processors and read by the Widget Data Service for real-time widget delivery. Replaces MarketDataPubSubKeys and consolidates WDC-facing keys from MarketDataCacheKeys.

The following members are deprecated as of v0.4.0 and will be removed in the next minor release (no active usages found):

  • TOP_10_LISTS_SCANNER

  • TOP_TRADES_SCANNER_ONE_HOUR

  • TOP_TRADES_SCANNER_FIVE_MINUTES

  • TOP_TRADES_SCANNER_ONE_MINUTE

  • TOP_TRADES_SCANNER

class kuhl_haus.mdp.enum.widget_data_cache_keys.WidgetDataCacheKeys(*values)[source]

Bases: Enum

Redis key identifiers for Widget Data Cache entries.

Published by MDP analyzers after processing real-time market data. Widget Data Service subscribes to forward results to frontend clients. Multiple time windows available for Top Trades to support different UI refresh rates.

Deprecated since version The: following members are deprecated as of v0.4.0 and will be removed in the next minor release (no active usages found):

  • TOP_10_LISTS_SCANNER

  • TOP_TRADES_SCANNER_ONE_HOUR

  • TOP_TRADES_SCANNER_FIVE_MINUTES

  • TOP_TRADES_SCANNER_ONE_MINUTE

  • TOP_TRADES_SCANNER

TOP_10_LISTS_SCANNER = 'scanners:top_10_lists'
TOP_TRADES_SCANNER_ONE_HOUR = 'scanners:top_trades:1h'
TOP_TRADES_SCANNER_FIVE_MINUTES = 'scanners:top_trades:5m'
TOP_TRADES_SCANNER_ONE_MINUTE = 'scanners:top_trades:1m'
TOP_TRADES_WIDGET_CACHE_KEY = 'tta:{symbol}:widget'
TOP_TRADES_ALL_SYMBOLS_CACHE_KEY = 'tta:all_symbols:widget'
QUOTE = 'quote'
TOP_GAINERS_SCANNER = 'scanners:top_gainers'
TOP_GAPPERS_SCANNER = 'scanners:top_gappers'
TOP_VOLUME_SCANNER = 'scanners:top_volume'
TOP_TRADES_SCANNER = 'cache:top_trades'
TOP_STOCKS_SCANNER = 'cache:top_stocks'
NEWS_FEED_LATEST = 'news:feed:latest'
NEWS_TICKER = 'news:ticker:{ticker}'
DAILY_RANGE = 'daily_range'
DAILY_RANGE_HOD_ALERT = 'daily_range_hod_alert'
DAILY_RANGE_LOD_ALERT = 'daily_range_lod_alert'

kuhl_haus.mdp.enum.widget_data_cache_limits module

class kuhl_haus.mdp.enum.widget_data_cache_limits.WidgetDataCacheLimits(*values)[source]

Bases: Enum

DRA_CACHE_LIST_MAX = 1000

kuhl_haus.mdp.enum.widget_data_cache_ttl module

Redis TTL values for Widget Data Cache (WDC) entries.

Defines expiration times for all widget-facing cached data. These TTLs govern how long Processor/Analyzer results remain available in the WDC for widget consumption. Separated from MarketDataCacheTTL which governs internal MDC data.

class kuhl_haus.mdp.enum.widget_data_cache_ttl.WidgetDataCacheTTL(*values)[source]

Bases: Enum

Time-to-live durations for Widget Data Cache entries.

Covers scanner results, quote feeds, and news feeds — all data written by Analyzers and consumed by the Widget Data Service.

QUOTE = 345600
TOP_STOCKS_SCANNER = 345600
TOP_VOLUME_SCANNER = 345600
TOP_GAINERS_SCANNER = 345600
TOP_GAPPERS_SCANNER = 345600
TOP_TRADES_WIDGET_CACHE_TTL = 60
TOP_TRADES_ALL_SYMBOLS_CACHE_TTL = 60
NEWS_FEED_LATEST = 172800
NEWS_TICKER = 604800
DAILY_RANGE = 345600
DAILY_RANGE_ALERT = 28800