Skip to content

Commit 3bc6614

Browse files
author
AdvancingTitans
committed
Initial commit: young-stock-cli v0.1.0
A no-login CLI for A-share/HK/US market post-market replays. - 'young a|hk|us|global' subcommands - Three-tier fetch: cache -> Eastmoney JSON API -> browser fallback - Data-quality scoring per record - Zero runtime dependencies, Python 3.8+ - MIT license
0 parents  commit 3bc6614

19 files changed

Lines changed: 1882 additions & 0 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Bug report
3+
about: Something is broken or returning wrong data
4+
labels: bug
5+
---
6+
7+
## What happened
8+
9+
<!-- exact command, exact output, exact trading day -->
10+
11+
```
12+
$ young a 20260526
13+
...
14+
```
15+
16+
## What you expected
17+
18+
## Environment
19+
20+
- young-stock-cli version: `young --version`
21+
- Python: `python3 --version`
22+
- OS:
23+
- Network (mainland China / overseas / proxy):
24+
25+
## Extra context
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new market, data source, or CLI feature
4+
labels: enhancement
5+
---
6+
7+
## What problem does this solve
8+
9+
## Proposed solution
10+
11+
## Data source(s) involved
12+
13+
<!-- e.g. Eastmoney clist, Sina finance, Tushare, Futu, ... -->
14+
15+
## Alternatives considered

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Summary
2+
3+
<!-- One sentence: what does this PR change and why? -->
4+
5+
## Type of change
6+
7+
- [ ] Bug fix (non-breaking)
8+
- [ ] New feature (non-breaking)
9+
- [ ] Breaking change
10+
- [ ] Documentation / refactor only
11+
12+
## Checklist
13+
14+
- [ ] `uv run pytest -q` passes
15+
- [ ] `uv run ruff check src tests` is clean
16+
- [ ] `CHANGELOG.md` updated
17+
- [ ] Tested on at least one real trading day (paste the date)

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
16+
python-version: ["3.9", "3.10", "3.11", "3.12"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e ".[dev]"
30+
31+
- name: Lint
32+
run: ruff check src tests
33+
34+
- name: Test
35+
run: pytest -q --cov=young_stock_cli --cov-report=xml
36+
37+
- name: Upload coverage
38+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
39+
uses: codecov/codecov-action@v4
40+
with:
41+
files: ./coverage.xml
42+
fail_ci_if_error: false

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # trusted publishing
13+
contents: read
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.11"
21+
22+
- name: Build distribution
23+
run: |
24+
python -m pip install --upgrade pip build
25+
python -m build
26+
27+
- name: Publish to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.venv/
2+
__pycache__/
3+
*.pyc
4+
*.egg-info/
5+
.pytest_cache/
6+
.ruff_cache/
7+
.coverage
8+
coverage.xml
9+
dist/
10+
build/
11+
.DS_Store
12+
.python-version
13+
uv.lock

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project are documented here. The format follows
4+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [0.1.0] - 2026-05-31
8+
9+
### Added
10+
- Initial public release.
11+
- `young a` / `hk` / `us` / `global` subcommands.
12+
- A-share post-market replay: indices, 涨停/跌停/炸板 pool, fund flow,
13+
industry & concept sector rankings (via browser fallback).
14+
- HK & US replays via Eastmoney `clist` batch endpoint (no-login, no rate limit).
15+
- Three-tier fetch strategy: cache → stable JSON API → browser fallback
16+
(camofox / Playwright / Hermes built-in browser).
17+
- Data-quality scoring + diagnostic reporting for every run.
18+
- Cross-market sentiment summary for `young global`.

CODE_OF_CONDUCT.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to a positive environment:
15+
16+
- Demonstrating empathy and kindness toward other people
17+
- Being respectful of differing opinions, viewpoints, and experiences
18+
- Giving and gracefully accepting constructive feedback
19+
- Accepting responsibility and apologising to those affected by our mistakes
20+
21+
## Enforcement
22+
23+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
24+
reported by opening a confidential issue or by contacting the project
25+
maintainer.
26+
27+
This Code of Conduct is adapted from the
28+
[Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).

CONTRIBUTING.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Contributing
2+
3+
Thanks for your interest in improving `young-stock-cli`. This is a small,
4+
focused project; contributions of all sizes are welcome.
5+
6+
## Development setup
7+
8+
```bash
9+
git clone https://github.com/AdvancingTitans/young-stock-cli.git
10+
cd young-stock-cli
11+
uv venv --python 3.11
12+
uv pip install -e ".[dev]"
13+
uv run pytest -q
14+
```
15+
16+
## How to contribute
17+
18+
- **Bug reports**: open an issue with the exact command you ran, the full
19+
stack trace, and the trading day you queried (Eastmoney's payload format
20+
changes over time — knowing the date matters).
21+
- **New data source / endpoint**: open an issue first to discuss API
22+
stability and rate-limit behaviour before sending a PR.
23+
- **Documentation / translation**: PRs welcome. The README is bilingual
24+
(English on top, Chinese below).
25+
26+
## Pull request checklist
27+
28+
- [ ] `uv run pytest -q` passes locally.
29+
- [ ] `uv run ruff check src tests` is clean.
30+
- [ ] New behaviour has a test (mock the network, do not hit live APIs).
31+
- [ ] `CHANGELOG.md` updated under `## [Unreleased]`.
32+
33+
## Code style
34+
35+
- Python 3.8+ syntax (we still support 3.8 because some quant users are
36+
stuck on legacy interpreters).
37+
- 100-column line limit (enforced by ruff).
38+
- Prefer the standard library; runtime dependencies should stay at zero
39+
unless there's a clear reason.
40+
41+
## Release process
42+
43+
Maintainers only:
44+
45+
1. Bump `__version__` in `src/young_stock_cli/__version__.py`.
46+
2. Move `## [Unreleased]` content to a new dated section in `CHANGELOG.md`.
47+
3. Tag: `git tag v0.x.y && git push --tags`.
48+
4. GitHub Actions builds the wheel and publishes to PyPI on tag push.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 AdvancingTitans
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)