Add JSON output for market data commands#5
Conversation
Constraint: Issue AdvancingTitans#2 asks for parseable JSON output for pipeline users while keeping existing rich table output. Rejected: Rewrite core rendering functions | a CLI-layer JSON fork is narrower and avoids disrupting existing table output. Confidence: medium Scope-risk: narrow Directive: Keep JSON output raw-data focused and avoid changing market data source semantics in this feature. Tested: uv run --python 3.12 --with pytest --with click --with rich --with requests python -m pytest -q Tested: uv run --python 3.12 --with ruff ruff check src tests Tested: python -m compileall src tests Tested: git diff --check Not-tested: Live market endpoint responses; tests use monkeypatched structured data to avoid network flakiness.
|
Thanks for the JSON-output PR. I am not merging it as-is because GitHub marks it dirty/conflicting against current main, and the CLI output layer has changed in the 0.1.5 work: hk/us/stock now support --no-news, commands print session-stage labels, fund-flow has multi-source fallback semantics, and single-stock lookup needs to be included in any JSON story. Please rebase on the latest main and keep the JSON path as a render-layer option without weakening quote/news/fund-flow source selection. Acceptance I would like to see before merge: young indices --json, young flow --json, young stock 0700.HK --json, young hk --no-news --json, and young us --no-news --json all produce valid JSON and preserve the same fallback behavior as text mode. Once rebased, this is a useful feature and worth revisiting. |
Summary
--jsonoutput for market data commands so script users can pipe raw datayoung a --zt --jsonwithout changing the existing table outputCloses #2
Validation
uv run --python 3.12 --with pytest --with click --with rich --with requests python -m pytest -q-> 18 passeduv run --python 3.12 --with ruff ruff check src tests-> passedpython -m compileall src tests-> passedgit diff --check-> passedNotes
The JSON path stays in the CLI layer and reuses the existing structured core data so the current rich table output remains unchanged.