reportify-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: reportify-cli
3
+ Version: 0.1.0
4
+ Summary: CLI wrapper for Reportify SDK - Access Reportify API through command line
5
+ Project-URL: Homepage, https://reportify.ai
6
+ Project-URL: Documentation, https://docs.reportify.ai
7
+ Project-URL: Repository, https://github.com/reportify/reportify-cli
8
+ Project-URL: Issues, https://github.com/reportify/reportify-cli/issues
9
+ Author-email: Reportify Team <support@reportify.ai>
10
+ License: MIT
11
+ Keywords: api,cli,finance,reportify,research,stock
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Office/Business :: Financial
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.12
24
+ Requires-Dist: pandas>=2.0.0
25
+ Requires-Dist: python-dotenv>=1.2.1
26
+ Requires-Dist: reportify-sdk>=0.3.9
27
+ Requires-Dist: tabulate>=0.9.0
28
+ Requires-Dist: typer>=0.21.1
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Reportify API CLI
32
+
33
+ 通过命令行访问 [Reportify SDK](https://github.com/reportify-ai/reportify-doc/tree/main/sdks) 的所有功能。
34
+
35
+ ## 特性
36
+
37
+ - 🚀 **完整功能** - 支持 Reportify SDK 的所有 8 个模块、44+ 个方法
38
+ - 📊 **多种输出格式** - JSON、Table、CSV、Markdown
39
+ - 🎯 **简单易用** - 统一的 JSON 输入格式,清晰的帮助文档
40
+ - 🤖 **AI 友好** - 专为 AI Agent 设计,提供详细的参数说明
41
+
42
+ ## 安装
43
+
44
+ ```bash
45
+ # 安装依赖并安装 CLI
46
+ make install
47
+
48
+ # 或使用 uv 直接安装
49
+ uv pip install -e .
50
+ ```
51
+
52
+ ## 配置
53
+
54
+ 设置 API Key(必需):
55
+
56
+ ```bash
57
+ # 方式 1: 环境变量
58
+ export REPORTIFY_API_KEY='your-api-key'
59
+
60
+ # 方式 2: .env 文件
61
+ echo "REPORTIFY_API_KEY=your-api-key" > .env
62
+ ```
63
+
64
+ ## 快速开始
65
+
66
+ ```bash
67
+ # 查看帮助
68
+ reportify-cli --help
69
+ reportify-cli -h
70
+
71
+ # 查看模块帮助
72
+ reportify-cli docs --help
73
+
74
+ # 查看命令帮助
75
+ reportify-cli docs get --help
76
+
77
+ # 获取文档详情(JSON 格式)
78
+ reportify-cli docs get --input '{"doc_id": "1214713494948155392"}'
79
+
80
+ # 获取股票行情(Table 格式)
81
+ reportify-cli stock quote --input '{"symbol": "600519"}' --format table
82
+
83
+ # 获取财务数据(Markdown 格式)
84
+ reportify-cli stock income_statement \
85
+ --input '{"symbol": "600519", "period": "annual"}' \
86
+ --format markdown
87
+ ```
88
+
89
+ ## 可用模块
90
+
91
+ | 模块 | 说明 | 命令数 |
92
+ |------|------|--------|
93
+ | `search` | 文档搜索功能 | 9 |
94
+ | `docs` | 文档内容功能 | 4 |
95
+ | `stock` | 股票数据功能 | 14 |
96
+ | `timeline` | 时间线功能 | 5 |
97
+ | `kb` | 知识库功能 | 1 |
98
+ | `user` | 用户数据功能 | 1 |
99
+ | `quant` | 量化分析功能 | 8 |
100
+ | `concepts` | 概念动态功能 | 2 |
101
+
102
+ ## 输出格式
103
+
104
+ 支持 4 种输出格式:
105
+
106
+ - `--format json` - JSON 格式(默认)
107
+ - `--format table` - 表格格式
108
+ - `--format csv` - CSV 格式
109
+ - `--format markdown` 或 `--format md` - Markdown 表格
110
+
111
+ ## 开发
112
+
113
+ ```bash
114
+ # 查看所有可用命令
115
+ make help
116
+
117
+ # 运行测试
118
+ make test
119
+
120
+ # 运行单元测试
121
+ make test-unit
122
+
123
+ # 运行集成测试(需要 API Key)
124
+ make test-integration
125
+
126
+ # 代码格式化
127
+ make format
128
+
129
+ # 代码检查
130
+ make lint
131
+
132
+ # 清理缓存
133
+ make clean
134
+
135
+ # 重新安装
136
+ make reinstall
137
+ ```
138
+
139
+ ## 项目结构
140
+
141
+ ```
142
+ reportify-cli/
143
+ ├── src/ # 源代码
144
+ │ ├── main.py # CLI 入口
145
+ │ ├── commands/ # 命令模块
146
+ │ ├── client.py # SDK 客户端
147
+ │ ├── output.py # 输出格式化
148
+ │ ├── params.py # 参数定义
149
+ │ ├── settings.py # 配置管理
150
+ │ └── utils.py # 工具函数
151
+ ├── tests/ # 测试
152
+ │ ├── test_commands/ # 单元测试
153
+ │ └── integration/ # 集成测试
154
+ ├── Makefile # 开发命令
155
+ ├── pyproject.toml # 项目配置
156
+ └── README.md # 项目文档
157
+ ```
158
+
159
+ ## 示例
160
+
161
+ ### 搜索文档
162
+
163
+ ```bash
164
+ reportify-cli search query \
165
+ --input '{"query": "茅台", "limit": 10}'
166
+ ```
167
+
168
+ ### 获取股票数据
169
+
170
+ ```bash
171
+ # 公司概览
172
+ reportify-cli stock overview --input '{"symbol": "600519"}'
173
+
174
+ # 财务报表
175
+ reportify-cli stock income_statement \
176
+ --input '{"symbol": "600519", "period": "annual"}'
177
+
178
+ # 股价数据
179
+ reportify-cli stock prices \
180
+ --input '{"symbol": "600519", "start_date": "2024-01-01", "end_date": "2024-12-31"}'
181
+ ```
182
+
183
+ ### 量化分析
184
+
185
+ ```bash
186
+ # 计算技术指标
187
+ reportify-cli quant indicators_compute \
188
+ --input '{"symbols": ["600519"], "formula": "RSI(14)"}' \
189
+ --format table
190
+ ```
191
+
@@ -0,0 +1,21 @@
1
+ src/__init__.py,sha256=pCgfSCOZC0IS1fpgeWNlXmeOx7g1s4DJpFO0042VpKg,91
2
+ src/client.py,sha256=wVWC9-YCXIPai8oYVbJ54DSDgIq0X72z_DG155fIqW4,412
3
+ src/main.py,sha256=kxnYa0xAKZ_5jY8QhkrSkvmZvKP1xP4moNDNgRcoCl8,1378
4
+ src/output.py,sha256=kk2cQiwZqga7zaIY71fphCDfebrbpwfOM90j9N8qZeo,2536
5
+ src/params.py,sha256=NI13XETknGPqZPN6RXq_ZFZhXp8AG-RMqDMW4F3vbII,18786
6
+ src/settings.py,sha256=TsUQnLBF_ipAN-N5xOssVtFB7OVBUe3ehL5tKEgio9Q,743
7
+ src/utils.py,sha256=Z2ZumPlyd7pPZd7shY-TbcInSWRyO6M9adYgtKngCfU,1743
8
+ src/commands/__init__.py,sha256=PhcPqytvX5igY92nG1DKwkrTV057Sfa44pHObuzojNU,45
9
+ src/commands/channels.py,sha256=ePw2uGzmV3UioVNXAaRlIyfhspDppZPMBI7aXBa9QUc,4284
10
+ src/commands/concepts.py,sha256=xIEOVvjAqg8lgvSW6FebG6JCftMzt1owOg3B6Ac3uYw,1643
11
+ src/commands/docs.py,sha256=FqnB_SiITYXWPhVTsNcnf9tjusWmvefxoh8NMDZ0_Xc,11716
12
+ src/commands/kb.py,sha256=ik4qCiafMwauOjwnztQvK0f8_WKjZXkkx0ZeHKrioCg,1143
13
+ src/commands/quant.py,sha256=ghDmg6fON1pRuPJesxmZrzQ-jNAslaokoU4aioDtNsQ,6247
14
+ src/commands/search.py,sha256=ono_eMX60qj5JjjSZezRPUgm8Ff4uP4rapbqaNiWV48,7471
15
+ src/commands/stock.py,sha256=vsQgqNkzQLTp0pBj6i049Cjme16Nq2ro8GNRGHigyZc,10257
16
+ src/commands/timeline.py,sha256=wL3eRUyPietO91b6f5Mtxxh8rxAqyMdkeNTROXSuvQQ,3824
17
+ src/commands/user.py,sha256=N68wEwHija6W9bpQAnk9Sun828Ymo22iye8lTmFEe00,1002
18
+ reportify_cli-0.1.0.dist-info/METADATA,sha256=SVwHmKqh0tZ3VW8pOkJRId2W3scmxKzJTDA6ryrdi9E,4838
19
+ reportify_cli-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
+ reportify_cli-0.1.0.dist-info/entry_points.txt,sha256=rw43LXWM0I2Zm2VgSUfBhK3awAeque97wNw-Mw0BvDQ,47
21
+ reportify_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ reportify-cli = src.main:app
src/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """Reportify API CLI - Command line interface for Reportify SDK."""
2
+
3
+ __version__ = "0.1.0"
src/client.py ADDED
@@ -0,0 +1,20 @@
1
+ """Reportify SDK client wrapper."""
2
+
3
+ from reportify_sdk import Reportify
4
+
5
+ from src.settings import get_api_key
6
+
7
+ _client = None
8
+
9
+
10
+ def get_client() -> Reportify:
11
+ """Get or create Reportify SDK client instance.
12
+
13
+ Returns:
14
+ Reportify: SDK client instance
15
+ """
16
+ global _client
17
+ if _client is None:
18
+ api_key = get_api_key()
19
+ _client = Reportify(api_key=api_key)
20
+ return _client
@@ -0,0 +1 @@
1
+ """Command modules for Reportify API CLI."""
@@ -0,0 +1,137 @@
1
+ """Channels module commands."""
2
+
3
+ from typing import Annotated
4
+
5
+ import typer
6
+
7
+ from src import params
8
+ from src.client import get_client
9
+ from src.output import format_output
10
+ from src.utils import generate_epilog, parse_json_input
11
+
12
+ app = typer.Typer(help="频道管理功能", rich_markup_mode="rich")
13
+
14
+
15
+ @app.command(
16
+ epilog=generate_epilog(
17
+ params.CHANNELS_SEARCH_PARAMS,
18
+ [
19
+ 'reportify-cli channels search --input \'{"query": "Goldman Sachs"}\'',
20
+ 'reportify-cli channels search --input \'{"query": "财经", "page_size": 20}\'',
21
+ ],
22
+ )
23
+ )
24
+ def search(
25
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
26
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
27
+ ):
28
+ """搜索频道"""
29
+ try:
30
+ params_dict = parse_json_input(input)
31
+ client = get_client()
32
+ result = client.channels.search(**params_dict)
33
+ format_output(result, format)
34
+ except Exception as e:
35
+ typer.echo(f"Error: {e}", err=True)
36
+ raise typer.Exit(1)
37
+
38
+
39
+ @app.command(
40
+ epilog=generate_epilog(
41
+ params.CHANNELS_FOLLOWINGS_PARAMS,
42
+ [
43
+ "reportify-cli channels followings",
44
+ 'reportify-cli channels followings --input \'{"page_size": 20}\'',
45
+ ],
46
+ )
47
+ )
48
+ def followings(
49
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
50
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
51
+ ):
52
+ """获取关注的频道列表"""
53
+ try:
54
+ params_dict = parse_json_input(input)
55
+ client = get_client()
56
+ result = client.channels.followings(**params_dict)
57
+ format_output(result, format)
58
+ except Exception as e:
59
+ typer.echo(f"Error: {e}", err=True)
60
+ raise typer.Exit(1)
61
+
62
+
63
+ @app.command(
64
+ epilog=generate_epilog(
65
+ params.CHANNELS_FOLLOW_PARAMS,
66
+ [
67
+ 'reportify-cli channels follow --input \'{"channel_id": "channel_123"}\'',
68
+ ],
69
+ )
70
+ )
71
+ def follow(
72
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
73
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
74
+ ):
75
+ """关注频道"""
76
+ try:
77
+ params_dict = parse_json_input(input)
78
+ client = get_client()
79
+ channel_id = params_dict.get("channel_id")
80
+ if not channel_id:
81
+ raise ValueError("channel_id is required")
82
+ result = client.channels.follow(channel_id)
83
+ format_output(result, format)
84
+ except Exception as e:
85
+ typer.echo(f"Error: {e}", err=True)
86
+ raise typer.Exit(1)
87
+
88
+
89
+ @app.command(
90
+ epilog=generate_epilog(
91
+ params.CHANNELS_UNFOLLOW_PARAMS,
92
+ [
93
+ 'reportify-cli channels unfollow --input \'{"channel_id": "channel_123"}\'',
94
+ ],
95
+ )
96
+ )
97
+ def unfollow(
98
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
99
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
100
+ ):
101
+ """取消关注频道"""
102
+ try:
103
+ params_dict = parse_json_input(input)
104
+ client = get_client()
105
+ channel_id = params_dict.get("channel_id")
106
+ if not channel_id:
107
+ raise ValueError("channel_id is required")
108
+ result = client.channels.unfollow(channel_id)
109
+ format_output(result, format)
110
+ except Exception as e:
111
+ typer.echo(f"Error: {e}", err=True)
112
+ raise typer.Exit(1)
113
+
114
+
115
+ @app.command(
116
+ name="get_docs",
117
+ epilog=generate_epilog(
118
+ params.CHANNELS_GET_DOCS_PARAMS,
119
+ [
120
+ "reportify-cli channels get_docs",
121
+ 'reportify-cli channels get_docs --input \'{"channel_ids": "channel_1,channel_2", "page_size": 20}\'',
122
+ ],
123
+ ),
124
+ )
125
+ def get_docs(
126
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
127
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
128
+ ):
129
+ """获取关注频道的文档"""
130
+ try:
131
+ params_dict = parse_json_input(input)
132
+ client = get_client()
133
+ result = client.channels.get_docs(**params_dict)
134
+ format_output(result, format)
135
+ except Exception as e:
136
+ typer.echo(f"Error: {e}", err=True)
137
+ raise typer.Exit(1)
@@ -0,0 +1,54 @@
1
+ """Concepts module commands."""
2
+
3
+ from typing import Annotated
4
+
5
+ import typer
6
+
7
+ from src import params
8
+ from src.client import get_client
9
+ from src.output import format_output
10
+ from src.utils import generate_epilog, parse_json_input
11
+
12
+ app = typer.Typer(help="概念动态功能", rich_markup_mode="rich")
13
+
14
+
15
+ @app.command(
16
+ epilog=generate_epilog(
17
+ params.CONCEPTS_LATEST_PARAMS,
18
+ [
19
+ "reportify-cli concepts latest",
20
+ "reportify-cli concepts latest --input '{\"include_docs\": false}'",
21
+ ],
22
+ )
23
+ )
24
+ def latest(
25
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
26
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
27
+ ):
28
+ """获取最新概念列表"""
29
+ try:
30
+ params_dict = parse_json_input(input)
31
+ client = get_client()
32
+ result = client.concepts.latest(**params_dict)
33
+ format_output(result, format)
34
+ except Exception as e:
35
+ typer.echo(f"Error: {e}", err=True)
36
+ raise typer.Exit(1)
37
+
38
+
39
+ @app.command(
40
+ epilog=generate_epilog(params.CONCEPTS_TODAY_PARAMS, ["reportify-cli concepts today"])
41
+ )
42
+ def today(
43
+ input: Annotated[str, typer.Option(help="JSON 格式的输入参数")] = "{}",
44
+ format: Annotated[str, typer.Option(help="输出格式: json, table, csv")] = "json",
45
+ ):
46
+ """获取今日概念动态"""
47
+ try:
48
+ params_dict = parse_json_input(input)
49
+ client = get_client()
50
+ result = client.concepts.today(**params_dict)
51
+ format_output(result, format)
52
+ except Exception as e:
53
+ typer.echo(f"Error: {e}", err=True)
54
+ raise typer.Exit(1)