Skip to content

Add JSON output for market data commands#5

Open
xyjk0511 wants to merge 1 commit into
AdvancingTitans:mainfrom
xyjk0511:codex/json-output-2
Open

Add JSON output for market data commands#5
xyjk0511 wants to merge 1 commit into
AdvancingTitans:mainfrom
xyjk0511:codex/json-output-2

Conversation

@xyjk0511

Copy link
Copy Markdown

Summary

  • add --json output for market data commands so script users can pipe raw data
  • support the issue example young a --zt --json without changing the existing table output
  • document JSON pipeline examples and add parseability tests

Closes #2

Validation

  • uv run --python 3.12 --with pytest --with click --with rich --with requests python -m pytest -q -> 18 passed
  • uv run --python 3.12 --with ruff ruff check src tests -> passed
  • python -m compileall src tests -> passed
  • git diff --check -> passed

Notes

The JSON path stays in the CLI layer and reuses the existing structured core data so the current rich table output remains unchanged.

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.
@AdvancingTitans

Copy link
Copy Markdown
Owner

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.

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.

[Feature] Add JSON output format for pipeline integration

2 participants