- Python 99.6%
- Dockerfile 0.4%
|
All checks were successful
Deploy / deploy (push) Successful in 2m18s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| .gitlab/issue_templates | ||
| .vscode | ||
| docs | ||
| src/bodega_discord_bot | ||
| tests/unit | ||
| .env.example | ||
| .gitignore | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
Bodega Discord Bot
Standalone Discord bot for querying non-authenticated Bodega market data endpoints.
Authenticated Bodega flows, direct database access, and monorepo runtime coupling are out of scope.
Commands
Run /help in Discord to see the live list. The bot provides the following slash commands, grouped by category. Symbol arguments offer live autocomplete (powered by /search), and long result lists (/search, /scores, /top) are navigable with Prev/Next buttons.
Price & Market Data
/latest <symbol>— latest daily bar (OHLCV)/price <symbol> [n]— recent daily bars (1–30, default 5)/chart <symbol> [n] [interval]— candlestick chart image (2–90 bars, default 30; interval daily/weekly/monthly, default daily)/compare <symbol_a> <symbol_b>— compare the latest bars of two symbols
Asset Information
/asset <symbol>— detailed asset metadata/search <query>— search by name or ticker fragment
Fundamentals & Financials
/financials <symbol>— annual financial statement/earnings <symbol>— historical earnings events/estimates <symbol>— analyst EPS & revenue estimates
Earnings & Surprises
/surprises <symbol> [n]— EPS surprises (1–10, default 5)
Ratings & Targets
/rating <symbol>— analyst rating & price target/targets <symbol> [n]— price target history (1–10, default 5)
Analytics & Performance
/score <symbol>— asset analytics score breakdown/scores [sector] [exchange] [limit]— top scores leaderboard (1–25, default 10)/rolling <symbol> [window]— rolling volatility & returns (5–252 days, default 20)/correlation <symbols>— correlation matrix (2–5 comma-separated symbols)/range <symbol>— support/resistance levels & status/top [asset_type] [sector] [limit]— top performers (1–25, default 10)
News & Macro
/news <symbol> [days]— recent news (1–30 days, default 7)/macro <series_id> [n]— macro indicator history (e.g. CPI, GDP; 1–12 points, default 6)/macro-list— list available macro series
Utility
/help— show the full command list/ping— check the bot's gateway latency
Requirements
- Python 3.12+
- A Discord bot token with application command permissions
- Network access to the Bodega API base URL
The bot depends on discord.py, httpx, pydantic/pydantic-settings, structlog, and mplfinance + pandas (used to render /chart candlestick images). Dependencies are managed with uv (see pyproject.toml).
Configuration
Required environment variables:
DISCORD_BOT_TOKENBODEGA_API_BASE_URL
Optional environment variables:
BODEGA_API_TIMEOUT_SECONDSdefault8BODEGA_API_RETRIESdefault2DISCORD_GUILD_IDScomma-separated guild IDs for fast development syncLOG_LEVELdefaultINFO
See .env.example.
Local Development
uv sync --extra dev
cp .env.example .env
uv run python -m bodega_discord_bot
Useful commands:
uv run ruff check .
uv run mypy src
uv run pytest tests/unit
uv run python -m bodega_discord_bot
Docker
docker compose up --build
The container runs as an unprivileged user (appuser).
The repository uses uv for dependency resolution, locking, and local execution.
Deployment
Deployment is handled by Forgejo Actions (.forgejo/workflows/deploy.yml). On pushes to main it rsyncs the code to the server, builds the Docker image, and restarts the drocsid container.
Required CI secrets:
SSH_PRIVATE_KEY— deploy SSH keySSH_KNOWN_HOSTS— server host key(s); populate viassh-keyscan <DEPLOY_HOST>(host-key verification is enforced)ENV_FILE— contents written to.envon the serverDEPLOY_USER,DEPLOY_HOST,DEPLOY_PATH— deploy target
Docs
docs/bodega-api-contract.mddocs/runbook.mddocs/issue-checklist.md