zerone-cli 0.1.4__tar.gz → 0.1.7__tar.gz
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.
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/PKG-INFO +4 -4
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/README.md +3 -3
- zerone_cli-0.1.7/cli/__init__.py +1 -0
- zerone_cli-0.1.7/cli/client.py +422 -0
- zerone_cli-0.1.7/cli/commands/__init__.py +19 -0
- zerone_cli-0.1.7/cli/commands/basic_info.py +77 -0
- zerone_cli-0.1.7/cli/commands/config_cmd.py +47 -0
- zerone_cli-0.1.7/cli/commands/entity_exit_list.py +47 -0
- zerone_cli-0.1.7/cli/commands/entity_financial_list.py +42 -0
- zerone_cli-0.1.7/cli/commands/entity_invest_list.py +47 -0
- zerone_cli-0.1.7/cli/commands/entity_managed_funds_list.py +42 -0
- zerone_cli-0.1.7/cli/commands/entity_profile.py +40 -0
- zerone_cli-0.1.7/cli/commands/entity_search.py +31 -0
- zerone_cli-0.1.7/cli/commands/evt_company_financing.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_company_ipo.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_company_repurchase.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_company_secondary.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_listing_company_reduction.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_listing_company_unlock.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_lp_investment.py +46 -0
- zerone_cli-0.1.7/cli/commands/evt_ma_company_deal.py +48 -0
- zerone_cli-0.1.7/cli/commands/evt_s_fund_deal.py +46 -0
- zerone_cli-0.1.7/cli/commands/financing.py +84 -0
- zerone_cli-0.1.7/cli/commands/model_company_match_gp.py +36 -0
- zerone_cli-0.1.7/cli/commands/model_financing_probability.py +39 -0
- zerone_cli-0.1.7/cli/commands/shareholders.py +88 -0
- zerone_cli-0.1.7/cli/config.py +69 -0
- zerone_cli-0.1.7/cli/main.py +49 -0
- zerone_cli-0.1.7/cli/utils/__init__.py +3 -0
- zerone_cli-0.1.7/cli/utils/errors.py +0 -0
- zerone_cli-0.1.7/cli/utils/output.py +97 -0
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/pyproject.toml +2 -2
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/zerone_cli.egg-info/PKG-INFO +4 -4
- zerone_cli-0.1.7/zerone_cli.egg-info/SOURCES.txt +37 -0
- zerone_cli-0.1.7/zerone_cli.egg-info/top_level.txt +1 -0
- zerone_cli-0.1.4/zerone_cli.egg-info/SOURCES.txt +0 -8
- zerone_cli-0.1.4/zerone_cli.egg-info/top_level.txt +0 -1
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/setup.cfg +0 -0
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/zerone_cli.egg-info/dependency_links.txt +0 -0
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/zerone_cli.egg-info/entry_points.txt +0 -0
- {zerone_cli-0.1.4 → zerone_cli-0.1.7}/zerone_cli.egg-info/requires.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zerone-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Zerone 私募股权数据 CLI 工具
|
|
5
5
|
Author-email: Zerone <tech@zerone.com.cn>
|
|
6
6
|
License: MIT
|
|
@@ -79,7 +79,7 @@ zerone model-financing-probability "字节跳动" --type COMPANY
|
|
|
79
79
|
zerone model-company-match-gp "字节跳动" --page 1 --page-size 5
|
|
80
80
|
|
|
81
81
|
# 查询市场投融资事件
|
|
82
|
-
zerone evt-company-financing --start-date 2024-01-01 --end-date 2024-12-31 --province 北京
|
|
82
|
+
zerone evt-company-financing --start-date 2024-01-01 --end-date 2024-12-31 --province 北京 --tag 人工智能 --page 1 --page-size 20
|
|
83
83
|
|
|
84
84
|
# 查询LP出资事件
|
|
85
85
|
zerone evt-lp-investment --start-date 2024-01-01 --end-date 2024-12-31 --province 广东 --city 深圳 --page 1 --page-size 20
|
|
@@ -94,10 +94,10 @@ zerone evt-company-repurchase --start-date 2024-01-01 --end-date 2024-12-31 --pr
|
|
|
94
94
|
zerone evt-ma-company-deal --start-date 2024-01-01 --end-date 2024-12-31 --province 北京 --tag 新能源 --page 1 --page-size 20
|
|
95
95
|
|
|
96
96
|
# 查询IPO事件
|
|
97
|
-
zerone evt-company-ipo --start-date 2024-01-01 --end-date 2024-12-31 --
|
|
97
|
+
zerone evt-company-ipo --start-date 2024-01-01 --end-date 2024-12-31 --city 合肥 --tag 新材料 --page 1 --page-size 20
|
|
98
98
|
|
|
99
99
|
# 查询解禁事件
|
|
100
|
-
zerone evt-listing-company-unlock --start-date 2024-01-01 --end-date 2024-12-31 --province
|
|
100
|
+
zerone evt-listing-company-unlock --start-date 2024-01-01 --end-date 2024-12-31 --province 上海 --tag 新能源 --page 1 --page-size 20
|
|
101
101
|
|
|
102
102
|
# 查询减持事件
|
|
103
103
|
zerone evt-listing-company-reduction --start-date 2024-01-01 --end-date 2024-12-31 --province 上海 --tag 集成电路 --page 1 --page-size 20
|
|
@@ -52,7 +52,7 @@ zerone model-financing-probability "字节跳动" --type COMPANY
|
|
|
52
52
|
zerone model-company-match-gp "字节跳动" --page 1 --page-size 5
|
|
53
53
|
|
|
54
54
|
# 查询市场投融资事件
|
|
55
|
-
zerone evt-company-financing --start-date 2024-01-01 --end-date 2024-12-31 --province 北京
|
|
55
|
+
zerone evt-company-financing --start-date 2024-01-01 --end-date 2024-12-31 --province 北京 --tag 人工智能 --page 1 --page-size 20
|
|
56
56
|
|
|
57
57
|
# 查询LP出资事件
|
|
58
58
|
zerone evt-lp-investment --start-date 2024-01-01 --end-date 2024-12-31 --province 广东 --city 深圳 --page 1 --page-size 20
|
|
@@ -67,10 +67,10 @@ zerone evt-company-repurchase --start-date 2024-01-01 --end-date 2024-12-31 --pr
|
|
|
67
67
|
zerone evt-ma-company-deal --start-date 2024-01-01 --end-date 2024-12-31 --province 北京 --tag 新能源 --page 1 --page-size 20
|
|
68
68
|
|
|
69
69
|
# 查询IPO事件
|
|
70
|
-
zerone evt-company-ipo --start-date 2024-01-01 --end-date 2024-12-31 --
|
|
70
|
+
zerone evt-company-ipo --start-date 2024-01-01 --end-date 2024-12-31 --city 合肥 --tag 新材料 --page 1 --page-size 20
|
|
71
71
|
|
|
72
72
|
# 查询解禁事件
|
|
73
|
-
zerone evt-listing-company-unlock --start-date 2024-01-01 --end-date 2024-12-31 --province
|
|
73
|
+
zerone evt-listing-company-unlock --start-date 2024-01-01 --end-date 2024-12-31 --province 上海 --tag 新能源 --page 1 --page-size 20
|
|
74
74
|
|
|
75
75
|
# 查询减持事件
|
|
76
76
|
zerone evt-listing-company-reduction --start-date 2024-01-01 --end-date 2024-12-31 --province 上海 --tag 集成电路 --page 1 --page-size 20
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
from cli.config import config_manager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MCPClient:
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.api_key = config_manager.get_api_key()
|
|
12
|
+
self.server_url = config_manager.get_server_url()
|
|
13
|
+
self.client = httpx.Client(timeout=30.0)
|
|
14
|
+
|
|
15
|
+
def _request(
|
|
16
|
+
self,
|
|
17
|
+
method: str,
|
|
18
|
+
path: str,
|
|
19
|
+
json_data: Optional[dict] = None,
|
|
20
|
+
params: Optional[dict] = None,
|
|
21
|
+
) -> dict:
|
|
22
|
+
url = f"{self.server_url}{path}"
|
|
23
|
+
headers = {
|
|
24
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
25
|
+
"Content-Type": "application/json",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try:
|
|
29
|
+
response = self.client.request(
|
|
30
|
+
method=method,
|
|
31
|
+
url=url,
|
|
32
|
+
headers=headers,
|
|
33
|
+
json=json_data,
|
|
34
|
+
params=params,
|
|
35
|
+
)
|
|
36
|
+
response.raise_for_status()
|
|
37
|
+
data = response.json()
|
|
38
|
+
if not data.get("success", True):
|
|
39
|
+
error = data.get("error", {})
|
|
40
|
+
raise ValueError(f"[{error.get('code', 'UNKNOWN')}] {error.get('message', '未知错误')}")
|
|
41
|
+
return data
|
|
42
|
+
except httpx.HTTPStatusError as e:
|
|
43
|
+
try:
|
|
44
|
+
error_data = e.response.json()
|
|
45
|
+
detail = error_data.get("detail", "")
|
|
46
|
+
if detail:
|
|
47
|
+
raise ValueError(f"[HTTP {e.response.status_code}] {detail}")
|
|
48
|
+
except ValueError:
|
|
49
|
+
raise
|
|
50
|
+
except Exception:
|
|
51
|
+
pass
|
|
52
|
+
raise ValueError(f"请求失败: {e.response.status_code} - {e.response.text}")
|
|
53
|
+
except httpx.ConnectError:
|
|
54
|
+
raise ValueError(f"无法连接到 MCP Server,请检查 server_url 配置:{self.server_url}")
|
|
55
|
+
except httpx.TimeoutException:
|
|
56
|
+
raise ValueError("请求超时,请检查网络连接或稍后重试")
|
|
57
|
+
|
|
58
|
+
def entity_search(self, keyword: str) -> dict:
|
|
59
|
+
return self._request(
|
|
60
|
+
"POST",
|
|
61
|
+
"/rest-api/tool/entity_search",
|
|
62
|
+
json_data={"keyword": keyword},
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
def entity_profile(
|
|
66
|
+
self,
|
|
67
|
+
entity_name: str,
|
|
68
|
+
entity_type: Optional[str] = None,
|
|
69
|
+
) -> dict:
|
|
70
|
+
return self._request(
|
|
71
|
+
"POST",
|
|
72
|
+
"/rest-api/tool/entity_profile",
|
|
73
|
+
json_data={
|
|
74
|
+
"entity_name": entity_name,
|
|
75
|
+
"entity_type": entity_type or "",
|
|
76
|
+
},
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def entity_financial_list(
|
|
80
|
+
self,
|
|
81
|
+
entity_name: str,
|
|
82
|
+
entity_type: Optional[str] = None,
|
|
83
|
+
page: int = 1,
|
|
84
|
+
page_size: int = 20,
|
|
85
|
+
) -> dict:
|
|
86
|
+
return self._request(
|
|
87
|
+
"POST",
|
|
88
|
+
"/rest-api/tool/entity_financial_list",
|
|
89
|
+
json_data={
|
|
90
|
+
"entity_name": entity_name,
|
|
91
|
+
"entity_type": entity_type or "",
|
|
92
|
+
"page": page,
|
|
93
|
+
"page_size": page_size,
|
|
94
|
+
},
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def entity_managed_funds_list(
|
|
98
|
+
self,
|
|
99
|
+
entity_name: str,
|
|
100
|
+
entity_type: Optional[str] = None,
|
|
101
|
+
page: int = 1,
|
|
102
|
+
page_size: int = 20,
|
|
103
|
+
) -> dict:
|
|
104
|
+
return self._request(
|
|
105
|
+
"POST",
|
|
106
|
+
"/rest-api/tool/entity_managed_funds_list",
|
|
107
|
+
json_data={
|
|
108
|
+
"entity_name": entity_name,
|
|
109
|
+
"entity_type": entity_type or "",
|
|
110
|
+
"page": page,
|
|
111
|
+
"page_size": page_size,
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
def entity_exit_list(
|
|
116
|
+
self,
|
|
117
|
+
entity_name: str,
|
|
118
|
+
entity_type: Optional[str] = None,
|
|
119
|
+
exit_type: Optional[str] = None,
|
|
120
|
+
page: int = 1,
|
|
121
|
+
page_size: int = 20,
|
|
122
|
+
) -> dict:
|
|
123
|
+
return self._request(
|
|
124
|
+
"POST",
|
|
125
|
+
"/rest-api/tool/entity_exit_list",
|
|
126
|
+
json_data={
|
|
127
|
+
"entity_name": entity_name,
|
|
128
|
+
"entity_type": entity_type or "",
|
|
129
|
+
"exit_type": exit_type or "",
|
|
130
|
+
"page": page,
|
|
131
|
+
"page_size": page_size,
|
|
132
|
+
},
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
def entity_invest_list(
|
|
136
|
+
self,
|
|
137
|
+
entity_name: str,
|
|
138
|
+
entity_type: Optional[str] = None,
|
|
139
|
+
invest_type: Optional[str] = None,
|
|
140
|
+
page: int = 1,
|
|
141
|
+
page_size: int = 20,
|
|
142
|
+
) -> dict:
|
|
143
|
+
return self._request(
|
|
144
|
+
"POST",
|
|
145
|
+
"/rest-api/tool/entity_invest_list",
|
|
146
|
+
json_data={
|
|
147
|
+
"entity_name": entity_name,
|
|
148
|
+
"entity_type": entity_type or "",
|
|
149
|
+
"invest_type": invest_type or "",
|
|
150
|
+
"page": page,
|
|
151
|
+
"page_size": page_size,
|
|
152
|
+
},
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
def model_financing_probability(
|
|
156
|
+
self,
|
|
157
|
+
entity_name: str,
|
|
158
|
+
entity_type: Optional[str] = None,
|
|
159
|
+
) -> dict:
|
|
160
|
+
return self._request(
|
|
161
|
+
"POST",
|
|
162
|
+
"/rest-api/tool/model_financing_probability",
|
|
163
|
+
json_data={
|
|
164
|
+
"entity_name": entity_name,
|
|
165
|
+
"entity_type": entity_type or "",
|
|
166
|
+
},
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
def evt_company_financing(
|
|
170
|
+
self,
|
|
171
|
+
start_date: str = "",
|
|
172
|
+
end_date: str = "",
|
|
173
|
+
reg_province: str = "",
|
|
174
|
+
reg_city: str = "",
|
|
175
|
+
reg_county: str = "",
|
|
176
|
+
company_tag: str = "",
|
|
177
|
+
page: int = 1,
|
|
178
|
+
page_size: int = 20,
|
|
179
|
+
) -> dict:
|
|
180
|
+
return self._request(
|
|
181
|
+
"POST",
|
|
182
|
+
"/rest-api/tool/evt_company_financing",
|
|
183
|
+
json_data={
|
|
184
|
+
"start_date": start_date,
|
|
185
|
+
"end_date": end_date,
|
|
186
|
+
"reg_province": reg_province,
|
|
187
|
+
"reg_city": reg_city,
|
|
188
|
+
"reg_county": reg_county,
|
|
189
|
+
"company_tag": company_tag,
|
|
190
|
+
"page": page,
|
|
191
|
+
"page_size": page_size,
|
|
192
|
+
},
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
def evt_lp_investment(
|
|
196
|
+
self,
|
|
197
|
+
start_date: str = "",
|
|
198
|
+
end_date: str = "",
|
|
199
|
+
reg_province: str = "",
|
|
200
|
+
reg_city: str = "",
|
|
201
|
+
reg_county: str = "",
|
|
202
|
+
page: int = 1,
|
|
203
|
+
page_size: int = 20,
|
|
204
|
+
) -> dict:
|
|
205
|
+
return self._request(
|
|
206
|
+
"POST",
|
|
207
|
+
"/rest-api/tool/evt_lp_investment",
|
|
208
|
+
json_data={
|
|
209
|
+
"start_date": start_date,
|
|
210
|
+
"end_date": end_date,
|
|
211
|
+
"reg_province": reg_province,
|
|
212
|
+
"reg_city": reg_city,
|
|
213
|
+
"reg_county": reg_county,
|
|
214
|
+
"page": page,
|
|
215
|
+
"page_size": page_size,
|
|
216
|
+
},
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
def evt_company_secondary(
|
|
220
|
+
self,
|
|
221
|
+
start_date: str = "",
|
|
222
|
+
end_date: str = "",
|
|
223
|
+
reg_province: str = "",
|
|
224
|
+
reg_city: str = "",
|
|
225
|
+
reg_county: str = "",
|
|
226
|
+
company_tag: str = "",
|
|
227
|
+
page: int = 1,
|
|
228
|
+
page_size: int = 20,
|
|
229
|
+
) -> dict:
|
|
230
|
+
return self._request(
|
|
231
|
+
"POST",
|
|
232
|
+
"/rest-api/tool/evt_company_secondary",
|
|
233
|
+
json_data={
|
|
234
|
+
"start_date": start_date,
|
|
235
|
+
"end_date": end_date,
|
|
236
|
+
"reg_province": reg_province,
|
|
237
|
+
"reg_city": reg_city,
|
|
238
|
+
"reg_county": reg_county,
|
|
239
|
+
"company_tag": company_tag,
|
|
240
|
+
"page": page,
|
|
241
|
+
"page_size": page_size,
|
|
242
|
+
},
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
def evt_company_repurchase(
|
|
246
|
+
self,
|
|
247
|
+
start_date: str = "",
|
|
248
|
+
end_date: str = "",
|
|
249
|
+
reg_province: str = "",
|
|
250
|
+
reg_city: str = "",
|
|
251
|
+
reg_county: str = "",
|
|
252
|
+
company_tag: str = "",
|
|
253
|
+
page: int = 1,
|
|
254
|
+
page_size: int = 20,
|
|
255
|
+
) -> dict:
|
|
256
|
+
return self._request(
|
|
257
|
+
"POST",
|
|
258
|
+
"/rest-api/tool/evt_company_repurchase",
|
|
259
|
+
json_data={
|
|
260
|
+
"start_date": start_date,
|
|
261
|
+
"end_date": end_date,
|
|
262
|
+
"reg_province": reg_province,
|
|
263
|
+
"reg_city": reg_city,
|
|
264
|
+
"reg_county": reg_county,
|
|
265
|
+
"company_tag": company_tag,
|
|
266
|
+
"page": page,
|
|
267
|
+
"page_size": page_size,
|
|
268
|
+
},
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
def evt_ma_company_deal(
|
|
272
|
+
self,
|
|
273
|
+
start_date: str = "",
|
|
274
|
+
end_date: str = "",
|
|
275
|
+
reg_province: str = "",
|
|
276
|
+
reg_city: str = "",
|
|
277
|
+
reg_county: str = "",
|
|
278
|
+
target_company_tag: str = "",
|
|
279
|
+
page: int = 1,
|
|
280
|
+
page_size: int = 20,
|
|
281
|
+
) -> dict:
|
|
282
|
+
return self._request(
|
|
283
|
+
"POST",
|
|
284
|
+
"/rest-api/tool/evt_ma_company_deal",
|
|
285
|
+
json_data={
|
|
286
|
+
"start_date": start_date,
|
|
287
|
+
"end_date": end_date,
|
|
288
|
+
"reg_province": reg_province,
|
|
289
|
+
"reg_city": reg_city,
|
|
290
|
+
"reg_county": reg_county,
|
|
291
|
+
"target_company_tag": target_company_tag,
|
|
292
|
+
"page": page,
|
|
293
|
+
"page_size": page_size,
|
|
294
|
+
},
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
def evt_company_ipo(
|
|
298
|
+
self,
|
|
299
|
+
start_date: str = "",
|
|
300
|
+
end_date: str = "",
|
|
301
|
+
reg_province: str = "",
|
|
302
|
+
reg_city: str = "",
|
|
303
|
+
reg_county: str = "",
|
|
304
|
+
company_tag: str = "",
|
|
305
|
+
page: int = 1,
|
|
306
|
+
page_size: int = 20,
|
|
307
|
+
) -> dict:
|
|
308
|
+
return self._request(
|
|
309
|
+
"POST",
|
|
310
|
+
"/rest-api/tool/evt_company_ipo",
|
|
311
|
+
json_data={
|
|
312
|
+
"start_date": start_date,
|
|
313
|
+
"end_date": end_date,
|
|
314
|
+
"reg_province": reg_province,
|
|
315
|
+
"reg_city": reg_city,
|
|
316
|
+
"reg_county": reg_county,
|
|
317
|
+
"company_tag": company_tag,
|
|
318
|
+
"page": page,
|
|
319
|
+
"page_size": page_size,
|
|
320
|
+
},
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
def evt_listing_company_unlock(
|
|
324
|
+
self,
|
|
325
|
+
start_date: str = "",
|
|
326
|
+
end_date: str = "",
|
|
327
|
+
reg_province: str = "",
|
|
328
|
+
reg_city: str = "",
|
|
329
|
+
reg_county: str = "",
|
|
330
|
+
company_tag: str = "",
|
|
331
|
+
page: int = 1,
|
|
332
|
+
page_size: int = 20,
|
|
333
|
+
) -> dict:
|
|
334
|
+
return self._request(
|
|
335
|
+
"POST",
|
|
336
|
+
"/rest-api/tool/evt_listing_company_unlock",
|
|
337
|
+
json_data={
|
|
338
|
+
"start_date": start_date,
|
|
339
|
+
"end_date": end_date,
|
|
340
|
+
"reg_province": reg_province,
|
|
341
|
+
"reg_city": reg_city,
|
|
342
|
+
"reg_county": reg_county,
|
|
343
|
+
"company_tag": company_tag,
|
|
344
|
+
"page": page,
|
|
345
|
+
"page_size": page_size,
|
|
346
|
+
},
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
def evt_listing_company_reduction(
|
|
350
|
+
self,
|
|
351
|
+
start_date: str = "",
|
|
352
|
+
end_date: str = "",
|
|
353
|
+
reg_province: str = "",
|
|
354
|
+
reg_city: str = "",
|
|
355
|
+
reg_county: str = "",
|
|
356
|
+
company_tag: str = "",
|
|
357
|
+
page: int = 1,
|
|
358
|
+
page_size: int = 20,
|
|
359
|
+
) -> dict:
|
|
360
|
+
return self._request(
|
|
361
|
+
"POST",
|
|
362
|
+
"/rest-api/tool/evt_listing_company_reduction",
|
|
363
|
+
json_data={
|
|
364
|
+
"start_date": start_date,
|
|
365
|
+
"end_date": end_date,
|
|
366
|
+
"reg_province": reg_province,
|
|
367
|
+
"reg_city": reg_city,
|
|
368
|
+
"reg_county": reg_county,
|
|
369
|
+
"company_tag": company_tag,
|
|
370
|
+
"page": page,
|
|
371
|
+
"page_size": page_size,
|
|
372
|
+
},
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
def evt_s_fund_deal(
|
|
376
|
+
self,
|
|
377
|
+
start_date: str = "",
|
|
378
|
+
end_date: str = "",
|
|
379
|
+
reg_province: str = "",
|
|
380
|
+
reg_city: str = "",
|
|
381
|
+
reg_county: str = "",
|
|
382
|
+
page: int = 1,
|
|
383
|
+
page_size: int = 20,
|
|
384
|
+
) -> dict:
|
|
385
|
+
return self._request(
|
|
386
|
+
"POST",
|
|
387
|
+
"/rest-api/tool/evt_s_fund_deal",
|
|
388
|
+
json_data={
|
|
389
|
+
"start_date": start_date,
|
|
390
|
+
"end_date": end_date,
|
|
391
|
+
"reg_province": reg_province,
|
|
392
|
+
"reg_city": reg_city,
|
|
393
|
+
"reg_county": reg_county,
|
|
394
|
+
"page": page,
|
|
395
|
+
"page_size": page_size,
|
|
396
|
+
},
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
def model_company_match_gp(
|
|
400
|
+
self,
|
|
401
|
+
company_name: str,
|
|
402
|
+
page: int = 1,
|
|
403
|
+
page_size: int = 5,
|
|
404
|
+
) -> dict:
|
|
405
|
+
return self._request(
|
|
406
|
+
"POST",
|
|
407
|
+
"/rest-api/tool/model_company_match_gp",
|
|
408
|
+
json_data={
|
|
409
|
+
"company_name": company_name,
|
|
410
|
+
"page": page,
|
|
411
|
+
"page_size": page_size,
|
|
412
|
+
},
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
def close(self):
|
|
416
|
+
self.client.close()
|
|
417
|
+
|
|
418
|
+
def __enter__(self):
|
|
419
|
+
return self
|
|
420
|
+
|
|
421
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
422
|
+
self.close()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from cli.commands import config_cmd
|
|
2
|
+
from cli.commands.entity_search import entity_search
|
|
3
|
+
from cli.commands.entity_profile import entity_profile
|
|
4
|
+
from cli.commands.entity_financial_list import entity_financial_list
|
|
5
|
+
from cli.commands.entity_managed_funds_list import entity_managed_funds_list
|
|
6
|
+
from cli.commands.entity_exit_list import entity_exit_list
|
|
7
|
+
from cli.commands.entity_invest_list import entity_invest_list
|
|
8
|
+
from cli.commands.model_financing_probability import model_financing_probability
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"config_cmd",
|
|
12
|
+
"entity_search",
|
|
13
|
+
"entity_profile",
|
|
14
|
+
"entity_financial_list",
|
|
15
|
+
"entity_managed_funds_list",
|
|
16
|
+
"entity_exit_list",
|
|
17
|
+
"entity_invest_list",
|
|
18
|
+
"model_financing_probability",
|
|
19
|
+
]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
查询基本信息命令模块
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from cli.config import config_manager
|
|
11
|
+
from cli.utils.output import print_result
|
|
12
|
+
from mcp_server.tools.executor import ToolExecutor
|
|
13
|
+
from mcp_server.router.entity_router import EntityRouter
|
|
14
|
+
from mcp_server.router.type_router import TypeRouter
|
|
15
|
+
from mcp_server.services.entity_service import EntityService
|
|
16
|
+
from mcp_server.utils.field_mapper import FieldMapper
|
|
17
|
+
from mcp_server.openapi_client.client import OpenAPIClient
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def execute(entity_name: str, entity_type: Optional[str] = None) -> dict:
|
|
21
|
+
"""
|
|
22
|
+
执行查询基本信息
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
entity_name: 实体名称
|
|
26
|
+
entity_type: 实体类型 (gp/lp/fund/company/preipo/list/neeq)
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
查询结果字典
|
|
30
|
+
"""
|
|
31
|
+
app_id, app_key = config_manager.get_credentials()
|
|
32
|
+
config = config_manager.load()
|
|
33
|
+
|
|
34
|
+
client = OpenAPIClient(base_url=config.base_url)
|
|
35
|
+
entity_service = EntityService()
|
|
36
|
+
executor = ToolExecutor(
|
|
37
|
+
entity_router=EntityRouter(entity_service),
|
|
38
|
+
type_router=TypeRouter(),
|
|
39
|
+
field_mapper=FieldMapper(),
|
|
40
|
+
openapi_client=client,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
result = await executor.execute_get_basic_info(
|
|
45
|
+
entity_name=entity_name,
|
|
46
|
+
entity_type=entity_type,
|
|
47
|
+
app_id=app_id,
|
|
48
|
+
app_key=app_key,
|
|
49
|
+
)
|
|
50
|
+
return result
|
|
51
|
+
finally:
|
|
52
|
+
await client.close()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def get_basic_info(
|
|
56
|
+
entity_name: str = typer.Argument(..., help="实体名称,如'字节跳动'"),
|
|
57
|
+
entity_type: Optional[str] = typer.Option(
|
|
58
|
+
None, "--type", "-t", help="实体类型:gp/lp/fund/company/preipo/list/neeq"
|
|
59
|
+
),
|
|
60
|
+
output: str = typer.Option(
|
|
61
|
+
"table", "--output", "-o", help="输出格式:table/json/csv"
|
|
62
|
+
),
|
|
63
|
+
):
|
|
64
|
+
"""
|
|
65
|
+
查询实体基本信息
|
|
66
|
+
|
|
67
|
+
示例:
|
|
68
|
+
zerone-cli get-basic-info "字节跳动"
|
|
69
|
+
zerone-cli get-basic-info "红杉资本" --type gp
|
|
70
|
+
zerone-cli get-basic-info "字节跳动" --output json
|
|
71
|
+
"""
|
|
72
|
+
try:
|
|
73
|
+
result = asyncio.run(execute(entity_name, entity_type))
|
|
74
|
+
print_result(result, output)
|
|
75
|
+
except ValueError as e:
|
|
76
|
+
typer.echo(f"[red]错误: {e}[/red]", err=True)
|
|
77
|
+
raise typer.Exit(1)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from cli.config import config_manager
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(help="管理 CLI 配置")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("show")
|
|
9
|
+
def show_config():
|
|
10
|
+
"""显示当前配置"""
|
|
11
|
+
config = config_manager.load()
|
|
12
|
+
typer.echo("=== 当前配置 ===")
|
|
13
|
+
typer.echo(f"api_key: {'*' * 10 if config.api_key else '(未设置)'}")
|
|
14
|
+
typer.echo(f"server_url: {config.server_url}")
|
|
15
|
+
typer.echo(f"output_format: {config.output_format}")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command("set-api-key")
|
|
19
|
+
def set_api_key(api_key: str = typer.Argument(..., help="API Key(从平台获取)")):
|
|
20
|
+
"""设置 API Key"""
|
|
21
|
+
config = config_manager.load()
|
|
22
|
+
config.api_key = api_key
|
|
23
|
+
config_manager.save(config)
|
|
24
|
+
typer.echo("✓ API Key 已设置")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@app.command("set-server-url")
|
|
28
|
+
def set_server_url(url: str = typer.Argument(..., help="MCP Server 地址,如 http://localhost:8080")):
|
|
29
|
+
"""设置 MCP Server 地址"""
|
|
30
|
+
config = config_manager.load()
|
|
31
|
+
config.server_url = url
|
|
32
|
+
config_manager.save(config)
|
|
33
|
+
typer.echo(f"✓ Server URL 已设置: {url}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@app.command("set-output-format")
|
|
37
|
+
def set_output_format(
|
|
38
|
+
fmt: str = typer.Argument(..., help="输出格式 (table/json/csv)")
|
|
39
|
+
):
|
|
40
|
+
"""设置默认输出格式"""
|
|
41
|
+
if fmt not in ("table", "json", "csv"):
|
|
42
|
+
typer.echo("✗ 无效的输出格式,请选择: table, json, csv")
|
|
43
|
+
raise typer.Exit(1)
|
|
44
|
+
config = config_manager.load()
|
|
45
|
+
config.output_format = fmt
|
|
46
|
+
config_manager.save(config)
|
|
47
|
+
typer.echo(f"✓ Output format 已设置: {fmt}")
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from cli.client import MCPClient
|
|
6
|
+
from cli.utils.output import print_result
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def entity_exit_list(
|
|
10
|
+
entity_name: str = typer.Argument(..., help="实体名称,如'高瓴资本'"),
|
|
11
|
+
entity_type: Optional[str] = typer.Option(
|
|
12
|
+
None, "--type", "-t",
|
|
13
|
+
help="实体类型:GP/LP/FUND"
|
|
14
|
+
),
|
|
15
|
+
exit_type: Optional[str] = typer.Option(
|
|
16
|
+
None, "--exit-type", "-e",
|
|
17
|
+
help="退出类型:COMPANY/FUND"
|
|
18
|
+
),
|
|
19
|
+
page: int = typer.Option(1, "--page", "-p", help="页码,从 1 开始"),
|
|
20
|
+
page_size: int = typer.Option(20, "--page-size", "-s", help="每页条数,默认 20"),
|
|
21
|
+
output: str = typer.Option("table", "--output", "-o", help="输出格式:table/json/csv"),
|
|
22
|
+
):
|
|
23
|
+
"""
|
|
24
|
+
查询退出列表(分页)
|
|
25
|
+
|
|
26
|
+
支持 GP/LP/FUND 类型。
|
|
27
|
+
|
|
28
|
+
示例:
|
|
29
|
+
zerone entity-exit-list "高瓴资本" --type GP
|
|
30
|
+
zerone entity-exit-list "高瓴资本" --type GP --exit-type COMPANY
|
|
31
|
+
"""
|
|
32
|
+
try:
|
|
33
|
+
with MCPClient() as client:
|
|
34
|
+
result = client.entity_exit_list(
|
|
35
|
+
entity_name=entity_name,
|
|
36
|
+
entity_type=entity_type,
|
|
37
|
+
exit_type=exit_type,
|
|
38
|
+
page=page,
|
|
39
|
+
page_size=page_size,
|
|
40
|
+
)
|
|
41
|
+
print_result(result, output)
|
|
42
|
+
except ValueError as e:
|
|
43
|
+
typer.echo(f"错误: {e}", err=True)
|
|
44
|
+
raise typer.Exit(1)
|
|
45
|
+
except Exception as e:
|
|
46
|
+
typer.echo(f"请求失败: {e}", err=True)
|
|
47
|
+
raise typer.Exit(1)
|