Skip to content

feat: add category filter for market alerts (fixes #2)#10

Open
mac-agent wants to merge 1 commit into
al1enjesus:mainfrom
mac-agent:feat/category-filter
Open

feat: add category filter for market alerts (fixes #2)#10
mac-agent wants to merge 1 commit into
al1enjesus:mainfrom
mac-agent:feat/category-filter

Conversation

@mac-agent
Copy link
Copy Markdown

Add support for filtering whale alerts by market category (politics, crypto, sports, etc.) via config.yaml.

Changes

  • New config section: filters.categories β€” list of category strings to filter by (e.g. crypto, politics, sports)
  • extract_categories() β€” extracts tags/group/category fields from Polymarket Gamma API metadata. Handles tags as list of dicts (slug/label/name keys), strings, group as dict or string, and single category string
  • get_market_categories() β€” cached version to avoid repeated API calls per condition_id
  • matches_filters() β€” case-insensitive matching. Empty filter = no filtering (backward compatible)
  • Updated alert formatting β€” terminal, Telegram, and Discord messages now show category labels
  • 14 unit tests covering extract_categories and matches_filters
  • config.yaml updated with commented example

Usage

filters:
  categories:
    - politics
    - crypto

Backward compatibility

Omitting the filters section preserves existing behavior β€” all whale alerts fire regardless of category.

Fixes #2

Add support for filtering whale alerts by market category (politics,
crypto, sports, etc.) via config.yaml.

Changes:
- New config section: filters.categories (list of category strings)
- extract_categories() β€” extracts tags/group/category from Gamma API
- get_market_categories() β€” cached version to avoid repeated API calls
- matches_filters() β€” case-insensitive matching against config
- Updated format_terminal/telegram/discord to show category labels
- 14 unit tests for extract_categories and matches_filters
- Default filter is empty β€” no behavioral change for existing users

Co-authored-by: OpenClaw Agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter alerts by market category (politics, crypto, sports)

1 participant