Imported from yencarnacion/exit-indicator-aggr (
AGENTS.md). Install upstream withnpx skills add yencarnacion/exit-indicator-aggr. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
server_py/holds the FastAPI business logic:app.pywires routes,state.pytracks order book state,depth.pyandib_client.pywrap Interactive Brokers data. Config defaults live inconfig.pyandconfig.tws.yaml.tests/mirrors server modules with pytest suites; add new fixtures inconftest.py.web/serves the lightweight client (app.js,styles.css,sounds/) that consumes the websocket feed.config-data/and root YAML files store environment-specific settings; avoid committing credentials.
Build, Test, and Development Commands
python -m venv .venv && . .venv/bin/activate— create/enter the local virtualenv.pip install -r server_py/requirements-dev.txt— sync runtime plus dev tooling (pytest, typer, etc.)../go.sh— boot the auto-reloading uvicorn server usingserver_py/run.shand the selected YAML config.PYTHONPATH=. uvicorn server_py.app:app --reload— manual launch when you need custom flags.pytest— execute the full asynchronous test suite defined inpytest.ini.
Coding Style & Naming Conventions
- Follow PEP 8: 4-space indentation, descriptive snake_case for Python, PascalCase for classes, SCREAMING_SNAKE_CASE for constants.
- Prefer type hints on new Python functions; keep public API signatures annotated.
- Keep module-level configuration isolated in
config.py; pass dependencies explicitly rather than using globals. - For web assets, stick to ES modules and camelCase for functions; keep sounds/CSS filenames lowercase with hyphens.
Testing Guidelines
- Write pytest unit tests under
tests/mirroring the module path, e.g.,server_py/depth.py→tests/test_depth.py. - Use descriptive test names like
test_depth_handles_empty_bookand favor fixtures inconftest.py. - Ensure new websocket or state mutations include regression tests covering edge cases (empty books, reconnects).
- Aim to maintain or raise current coverage; add async tests when touching coroutine logic.
Commit & Pull Request Guidelines
- Use short, imperative commit messages (
Add DOM snapshot endpoint) and group related changes. - Reference relevant issue IDs in the body when applicable; summarize config changes explicitly.
- For PRs: include a concise problem/solution description, test evidence (
pytestoutput, screenshots for UI tweaks), and call out config or deployment impacts. - Request review before merging; keep diffs focused and rebased for a linear history.
