reportify-cli 0.1.3__tar.gz → 0.1.4__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.
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/PKG-INFO +1 -1
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/pyproject.toml +1 -1
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/scripts/bump_version.sh +24 -15
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/scripts/publish.sh +29 -29
- reportify_cli-0.1.4/src/commands/user.py +339 -0
- reportify_cli-0.1.3/src/commands/user.py +0 -92
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/.gitignore +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/Makefile +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/README.md +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/scripts/README.md +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/skills/reportify-ai/SKILL.md +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/skills/reportify-ai/references/API_REFERENCE.md +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/skills/reportify-ai/references/COMMANDS.md +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/__init__.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/client.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/__init__.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/channels.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/concepts.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/docs.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/kb.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/quant.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/search.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/stock.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/commands/timeline.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/main.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/output.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/params.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/settings.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/src/utils.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/tests/__init__.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/tests/integration/test_docs_integration.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/tests/integration/test_stock_integration.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/tests/test_commands/__init__.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/tests/test_commands/test_docs.py +0 -0
- {reportify_cli-0.1.3 → reportify_cli-0.1.4}/uv.lock +0 -0
|
@@ -13,7 +13,7 @@ NC='\033[0m' # No Color
|
|
|
13
13
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
14
14
|
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
15
15
|
|
|
16
|
-
cd "$PROJECT_DIR"
|
|
16
|
+
cd "$PROJECT_DIR/"
|
|
17
17
|
|
|
18
18
|
echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
|
|
19
19
|
echo -e "${BLUE} Reportify CLI - Version Bump Script${NC}"
|
|
@@ -65,11 +65,11 @@ echo -e "${GREEN}New version: ${NEW_VERSION}${NC}"
|
|
|
65
65
|
echo ""
|
|
66
66
|
|
|
67
67
|
# Confirm the change
|
|
68
|
-
read -p "Bump version from ${CURRENT_VERSION} to ${NEW_VERSION}? (y/n): " CONFIRM
|
|
69
|
-
if [ "$CONFIRM" != "y" ]; then
|
|
70
|
-
echo -e "${YELLOW}Version bump cancelled${NC}"
|
|
71
|
-
exit 0
|
|
72
|
-
fi
|
|
68
|
+
#read -p "Bump version from ${CURRENT_VERSION} to ${NEW_VERSION}? (y/n): " CONFIRM
|
|
69
|
+
#if [ "$CONFIRM" != "y" ]; then
|
|
70
|
+
# echo -e "${YELLOW}Version bump cancelled${NC}"
|
|
71
|
+
# exit 0
|
|
72
|
+
#fi
|
|
73
73
|
|
|
74
74
|
# Update version in pyproject.toml
|
|
75
75
|
echo -e "${BLUE}Updating pyproject.toml...${NC}"
|
|
@@ -89,19 +89,28 @@ git diff pyproject.toml
|
|
|
89
89
|
echo ""
|
|
90
90
|
|
|
91
91
|
# Ask if we should commit
|
|
92
|
-
|
|
93
|
-
if [ "$
|
|
92
|
+
|
|
93
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
94
|
+
echo -e "${RED}提交版本修改记录"
|
|
95
|
+
# 配置git信息
|
|
96
|
+
git config --global user.name "GitLab Runner Bot"
|
|
97
|
+
git config --global user.email "gitlab-runner-arm@xiaobangtouzi.com"
|
|
98
|
+
git remote set-url origin "https://gitlab-ci-token:${GITLAB_PUSHER_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
|
|
99
|
+
# 提交和推送代码逻辑
|
|
94
100
|
git add pyproject.toml
|
|
95
|
-
git commit -
|
|
101
|
+
git commit -am "chore: bump version to ${NEW_VERSION} [ci skip]"
|
|
96
102
|
echo -e "${GREEN}✓ Changes committed${NC}"
|
|
97
103
|
echo ""
|
|
104
|
+
git push origin -o ci.skip HEAD:${CI_COMMIT_REF_NAME}
|
|
105
|
+
echo -e "${GREEN}✓ Changes pushed to remote${NC}"
|
|
106
|
+
fi
|
|
98
107
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
109
|
+
echo -e "${RED}Error: You have uncommitted changes. Please commit or stash them first.${NC}"
|
|
110
|
+
git status --short
|
|
111
|
+
exit 1
|
|
112
|
+
else
|
|
113
|
+
echo -e "${GREEN}✓ No uncommitted changes${NC}"
|
|
105
114
|
fi
|
|
106
115
|
|
|
107
116
|
echo ""
|
|
@@ -51,14 +51,14 @@ fi
|
|
|
51
51
|
echo ""
|
|
52
52
|
|
|
53
53
|
# Step 1: Check for uncommitted changes
|
|
54
|
-
echo -e "${BLUE}Step 1: Checking for uncommitted changes...${NC}"
|
|
55
|
-
if [ -n "$(git status --porcelain)" ]; then
|
|
56
|
-
echo -e "${RED}Error: You have uncommitted changes. Please commit or stash them first.${NC}"
|
|
57
|
-
git status --short
|
|
58
|
-
exit 1
|
|
59
|
-
fi
|
|
60
|
-
echo -e "${GREEN}✓ No uncommitted changes${NC}"
|
|
61
|
-
echo ""
|
|
54
|
+
#echo -e "${BLUE}Step 1: Checking for uncommitted changes...${NC}"
|
|
55
|
+
#if [ -n "$(git status --porcelain)" ]; then
|
|
56
|
+
# echo -e "${RED}Error: You have uncommitted changes. Please commit or stash them first.${NC}"
|
|
57
|
+
# git status --short
|
|
58
|
+
# exit 1
|
|
59
|
+
#fi
|
|
60
|
+
#echo -e "${GREEN}✓ No uncommitted changes${NC}"
|
|
61
|
+
#echo ""
|
|
62
62
|
|
|
63
63
|
# Step 2: Run tests
|
|
64
64
|
# echo -e "${BLUE}Step 2: Running tests...${NC}"
|
|
@@ -131,12 +131,12 @@ fi
|
|
|
131
131
|
|
|
132
132
|
# Publish
|
|
133
133
|
if [ "$PUBLISH_TYPE" == "prod" ]; then
|
|
134
|
-
echo -e "${YELLOW}Publishing to PRODUCTION PyPI...${NC}"
|
|
135
|
-
read -p "Are you sure? Type 'y' to confirm: " CONFIRM
|
|
136
|
-
if [ "$CONFIRM" != "y" ]; then
|
|
137
|
-
echo -e "${YELLOW}Publish cancelled${NC}"
|
|
138
|
-
exit 1
|
|
139
|
-
fi
|
|
134
|
+
# echo -e "${YELLOW}Publishing to PRODUCTION PyPI...${NC}"
|
|
135
|
+
# read -p "Are you sure? Type 'y' to confirm: " CONFIRM
|
|
136
|
+
# if [ "$CONFIRM" != "y" ]; then
|
|
137
|
+
# echo -e "${YELLOW}Publish cancelled${NC}"
|
|
138
|
+
# exit 1
|
|
139
|
+
# fi
|
|
140
140
|
uv publish
|
|
141
141
|
else
|
|
142
142
|
echo -e "${GREEN}Publishing to TEST PyPI...${NC}"
|
|
@@ -148,21 +148,21 @@ echo -e "${GREEN}✓ Package published successfully${NC}"
|
|
|
148
148
|
echo ""
|
|
149
149
|
|
|
150
150
|
# Step 8: Create git tag
|
|
151
|
-
|
|
152
|
-
TAG="v${VERSION}"
|
|
153
|
-
|
|
154
|
-
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
155
|
-
echo -e "${YELLOW}Warning: Tag $TAG already exists${NC}"
|
|
156
|
-
else
|
|
157
|
-
git tag -a "$TAG" -m "Release $VERSION"
|
|
158
|
-
echo -e "${GREEN}✓ Created tag: $TAG${NC}"
|
|
159
|
-
|
|
160
|
-
read -p "Push tag to remote? (y/n): " PUSH_TAG
|
|
161
|
-
if [ "$PUSH_TAG" == "y" ]; then
|
|
162
|
-
git push origin "$TAG"
|
|
163
|
-
echo -e "${GREEN}✓ Tag pushed to remote${NC}"
|
|
164
|
-
fi
|
|
165
|
-
fi
|
|
151
|
+
#cho -e "${BLUE}Step 8: Creating git tag...${NC}"
|
|
152
|
+
#TAG="v${VERSION}"
|
|
153
|
+
|
|
154
|
+
#if git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
155
|
+
# echo -e "${YELLOW}Warning: Tag $TAG already exists${NC}"
|
|
156
|
+
#else
|
|
157
|
+
# git tag -a "$TAG" -m "Release $VERSION"
|
|
158
|
+
# echo -e "${GREEN}✓ Created tag: $TAG${NC}"
|
|
159
|
+
#
|
|
160
|
+
# read -p "Push tag to remote? (y/n): " PUSH_TAG
|
|
161
|
+
# if [ "$PUSH_TAG" == "y" ]; then
|
|
162
|
+
# git push origin "$TAG"
|
|
163
|
+
# echo -e "${GREEN}✓ Tag pushed to remote${NC}"
|
|
164
|
+
# fi
|
|
165
|
+
#fi
|
|
166
166
|
echo ""
|
|
167
167
|
|
|
168
168
|
echo -e "${GREEN}═══════════════════════════════════════════════${NC}"
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"""User 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="User data", rich_markup_mode="rich")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command(
|
|
16
|
+
name="followed_companies",
|
|
17
|
+
epilog=generate_epilog(
|
|
18
|
+
params.USER_FOLLOWED_COMPANIES_PARAMS, ["reportify-cli user followed_companies"]
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
def followed_companies(
|
|
22
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
23
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
24
|
+
):
|
|
25
|
+
"""Get all followed companies"""
|
|
26
|
+
try:
|
|
27
|
+
params_dict = parse_json_input(input)
|
|
28
|
+
client = get_client()
|
|
29
|
+
result = client.user.followed_companies(**params_dict)
|
|
30
|
+
format_output(result, format)
|
|
31
|
+
except Exception as e:
|
|
32
|
+
typer.echo(f"Error: {e}", err=True)
|
|
33
|
+
raise typer.Exit(1)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@app.command(
|
|
37
|
+
name="follow_company",
|
|
38
|
+
epilog=generate_epilog(
|
|
39
|
+
params.USER_FOLLOW_COMPANY_PARAMS,
|
|
40
|
+
[
|
|
41
|
+
'reportify-cli user follow_company --input \'{"symbol": "US:AAPL"}\'',
|
|
42
|
+
'reportify-cli user follow_company --input \'{"symbol": "HK:00700"}\'',
|
|
43
|
+
'reportify-cli user follow_company --input \'{"symbol": "SH:600519"}\'',
|
|
44
|
+
'reportify-cli user follow_company --input \'{"symbol": "SZ:000001"}\'',
|
|
45
|
+
|
|
46
|
+
],
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
def follow_company(
|
|
50
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
51
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
52
|
+
):
|
|
53
|
+
"""Follow a company (add to watchlist)"""
|
|
54
|
+
try:
|
|
55
|
+
params_dict = parse_json_input(input)
|
|
56
|
+
client = get_client()
|
|
57
|
+
symbol = params_dict.get("symbol")
|
|
58
|
+
if not symbol:
|
|
59
|
+
raise ValueError("symbol is required")
|
|
60
|
+
result = client.user.follow_company(symbol)
|
|
61
|
+
format_output(result, format)
|
|
62
|
+
except Exception as e:
|
|
63
|
+
typer.echo(f"Error: {e}", err=True)
|
|
64
|
+
raise typer.Exit(1)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@app.command(
|
|
68
|
+
name="unfollow_company",
|
|
69
|
+
epilog=generate_epilog(
|
|
70
|
+
params.USER_UNFOLLOW_COMPANY_PARAMS,
|
|
71
|
+
[
|
|
72
|
+
'reportify-cli user unfollow_company --input \'{"symbol": "US:AAPL"}\'',
|
|
73
|
+
'reportify-cli user unfollow_company --input \'{"symbol": "HK:00700"}\'',
|
|
74
|
+
],
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
def unfollow_company(
|
|
78
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
79
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
80
|
+
):
|
|
81
|
+
"""Unfollow a company (remove from watchlist)"""
|
|
82
|
+
try:
|
|
83
|
+
params_dict = parse_json_input(input)
|
|
84
|
+
client = get_client()
|
|
85
|
+
symbol = params_dict.get("symbol")
|
|
86
|
+
if not symbol:
|
|
87
|
+
raise ValueError("symbol is required")
|
|
88
|
+
result = client.user.unfollow_company(symbol)
|
|
89
|
+
format_output(result, format)
|
|
90
|
+
except Exception as e:
|
|
91
|
+
typer.echo(f"Error: {e}", err=True)
|
|
92
|
+
raise typer.Exit(1)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@app.command(
|
|
96
|
+
name="create_follow_group",
|
|
97
|
+
epilog=generate_epilog(
|
|
98
|
+
{},
|
|
99
|
+
[
|
|
100
|
+
'reportify-cli user create_follow_group --input \'{"name": "My Stocks", "follow_values": [{"follow_type": 1, "follow_value": "US:AAPL"}]}\'',
|
|
101
|
+
],
|
|
102
|
+
),
|
|
103
|
+
)
|
|
104
|
+
def create_follow_group(
|
|
105
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
106
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
107
|
+
):
|
|
108
|
+
"""Create a follow group"""
|
|
109
|
+
try:
|
|
110
|
+
params_dict = parse_json_input(input)
|
|
111
|
+
client = get_client()
|
|
112
|
+
name = params_dict.get("name")
|
|
113
|
+
if not name:
|
|
114
|
+
raise ValueError("name is required")
|
|
115
|
+
follow_values = params_dict.get("follow_values", [])
|
|
116
|
+
result = client.user.create_follow_group(name, follow_values)
|
|
117
|
+
format_output(result, format)
|
|
118
|
+
except Exception as e:
|
|
119
|
+
typer.echo(f"Error: {e}", err=True)
|
|
120
|
+
raise typer.Exit(1)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@app.command(
|
|
124
|
+
name="get_follow_groups",
|
|
125
|
+
epilog=generate_epilog(
|
|
126
|
+
{},
|
|
127
|
+
[
|
|
128
|
+
'reportify-cli user get_follow_groups',
|
|
129
|
+
],
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
def get_follow_groups(
|
|
133
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
134
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
135
|
+
):
|
|
136
|
+
"""Get all follow groups"""
|
|
137
|
+
try:
|
|
138
|
+
params_dict = parse_json_input(input)
|
|
139
|
+
client = get_client()
|
|
140
|
+
result = client.user.get_follow_groups()
|
|
141
|
+
format_output(result, format)
|
|
142
|
+
except Exception as e:
|
|
143
|
+
typer.echo(f"Error: {e}", err=True)
|
|
144
|
+
raise typer.Exit(1)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@app.command(
|
|
148
|
+
name="get_follow_group",
|
|
149
|
+
epilog=generate_epilog(
|
|
150
|
+
{},
|
|
151
|
+
[
|
|
152
|
+
'reportify-cli user get_follow_group --input \'{"group_id": "123"}\'',
|
|
153
|
+
],
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
def get_follow_group(
|
|
157
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
158
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
159
|
+
):
|
|
160
|
+
"""Get a follow group by ID"""
|
|
161
|
+
try:
|
|
162
|
+
params_dict = parse_json_input(input)
|
|
163
|
+
client = get_client()
|
|
164
|
+
group_id = params_dict.get("group_id")
|
|
165
|
+
if not group_id:
|
|
166
|
+
raise ValueError("group_id is required")
|
|
167
|
+
result = client.user.get_follow_group(group_id)
|
|
168
|
+
format_output(result, format)
|
|
169
|
+
except Exception as e:
|
|
170
|
+
typer.echo(f"Error: {e}", err=True)
|
|
171
|
+
raise typer.Exit(1)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@app.command(
|
|
175
|
+
name="update_follow_group",
|
|
176
|
+
epilog=generate_epilog(
|
|
177
|
+
{},
|
|
178
|
+
[
|
|
179
|
+
'reportify-cli user update_follow_group --input \'{"group_id": "123", "name": "New Name"}\'',
|
|
180
|
+
],
|
|
181
|
+
),
|
|
182
|
+
)
|
|
183
|
+
def update_follow_group(
|
|
184
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
185
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
186
|
+
):
|
|
187
|
+
"""Update a follow group"""
|
|
188
|
+
try:
|
|
189
|
+
params_dict = parse_json_input(input)
|
|
190
|
+
client = get_client()
|
|
191
|
+
group_id = params_dict.get("group_id")
|
|
192
|
+
if not group_id:
|
|
193
|
+
raise ValueError("group_id is required")
|
|
194
|
+
name = params_dict.get("name")
|
|
195
|
+
result = client.user.update_follow_group(group_id, name)
|
|
196
|
+
format_output(result, format)
|
|
197
|
+
except Exception as e:
|
|
198
|
+
typer.echo(f"Error: {e}", err=True)
|
|
199
|
+
raise typer.Exit(1)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@app.command(
|
|
203
|
+
name="delete_follow_group",
|
|
204
|
+
epilog=generate_epilog(
|
|
205
|
+
{},
|
|
206
|
+
[
|
|
207
|
+
'reportify-cli user delete_follow_group --input \'{"group_id": "123"}\'',
|
|
208
|
+
],
|
|
209
|
+
),
|
|
210
|
+
)
|
|
211
|
+
def delete_follow_group(
|
|
212
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
213
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
214
|
+
):
|
|
215
|
+
"""Delete a follow group"""
|
|
216
|
+
try:
|
|
217
|
+
params_dict = parse_json_input(input)
|
|
218
|
+
client = get_client()
|
|
219
|
+
group_id = params_dict.get("group_id")
|
|
220
|
+
if not group_id:
|
|
221
|
+
raise ValueError("group_id is required")
|
|
222
|
+
result = client.user.delete_follow_group(group_id)
|
|
223
|
+
format_output(result, format)
|
|
224
|
+
except Exception as e:
|
|
225
|
+
typer.echo(f"Error: {e}", err=True)
|
|
226
|
+
raise typer.Exit(1)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
@app.command(
|
|
230
|
+
name="add_follows_to_group",
|
|
231
|
+
epilog=generate_epilog(
|
|
232
|
+
{},
|
|
233
|
+
[
|
|
234
|
+
'reportify-cli user add_follows_to_group --input \'{"group_id": "123", "follow_values": [{"follow_type": 1, "follow_value": "US:TSLA"}]}\'',
|
|
235
|
+
],
|
|
236
|
+
),
|
|
237
|
+
)
|
|
238
|
+
def add_follows_to_group(
|
|
239
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
240
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
241
|
+
):
|
|
242
|
+
"""Add follows to a group"""
|
|
243
|
+
try:
|
|
244
|
+
params_dict = parse_json_input(input)
|
|
245
|
+
client = get_client()
|
|
246
|
+
group_id = params_dict.get("group_id")
|
|
247
|
+
if not group_id:
|
|
248
|
+
raise ValueError("group_id is required")
|
|
249
|
+
follow_values = params_dict.get("follow_values", [])
|
|
250
|
+
result = client.user.add_follows_to_group(group_id, follow_values)
|
|
251
|
+
format_output(result, format)
|
|
252
|
+
except Exception as e:
|
|
253
|
+
typer.echo(f"Error: {e}", err=True)
|
|
254
|
+
raise typer.Exit(1)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
@app.command(
|
|
258
|
+
name="remove_follows_from_group",
|
|
259
|
+
epilog=generate_epilog(
|
|
260
|
+
{},
|
|
261
|
+
[
|
|
262
|
+
'reportify-cli user remove_follows_from_group --input \'{"group_id": "123", "follow_ids": ["follow_1", "follow_2"]}\'',
|
|
263
|
+
],
|
|
264
|
+
),
|
|
265
|
+
)
|
|
266
|
+
def remove_follows_from_group(
|
|
267
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
268
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
269
|
+
):
|
|
270
|
+
"""Remove follows from a group"""
|
|
271
|
+
try:
|
|
272
|
+
params_dict = parse_json_input(input)
|
|
273
|
+
client = get_client()
|
|
274
|
+
group_id = params_dict.get("group_id")
|
|
275
|
+
if not group_id:
|
|
276
|
+
raise ValueError("group_id is required")
|
|
277
|
+
follow_ids = params_dict.get("follow_ids", [])
|
|
278
|
+
result = client.user.remove_follows_from_group(group_id, follow_ids)
|
|
279
|
+
format_output(result, format)
|
|
280
|
+
except Exception as e:
|
|
281
|
+
typer.echo(f"Error: {e}", err=True)
|
|
282
|
+
raise typer.Exit(1)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
@app.command(
|
|
286
|
+
name="set_group_follows",
|
|
287
|
+
epilog=generate_epilog(
|
|
288
|
+
{},
|
|
289
|
+
[
|
|
290
|
+
'reportify-cli user set_group_follows --input \'{"group_id": "123", "follow_values": [{"follow_type": 1, "follow_value": "US:AAPL"}]}\'',
|
|
291
|
+
],
|
|
292
|
+
),
|
|
293
|
+
)
|
|
294
|
+
def set_group_follows(
|
|
295
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
296
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
297
|
+
):
|
|
298
|
+
"""Set follows for a group (replace all)"""
|
|
299
|
+
try:
|
|
300
|
+
params_dict = parse_json_input(input)
|
|
301
|
+
client = get_client()
|
|
302
|
+
group_id = params_dict.get("group_id")
|
|
303
|
+
if not group_id:
|
|
304
|
+
raise ValueError("group_id is required")
|
|
305
|
+
follow_values = params_dict.get("follow_values", [])
|
|
306
|
+
result = client.user.set_group_follows(group_id, follow_values)
|
|
307
|
+
format_output(result, format)
|
|
308
|
+
except Exception as e:
|
|
309
|
+
typer.echo(f"Error: {e}", err=True)
|
|
310
|
+
raise typer.Exit(1)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
@app.command(
|
|
314
|
+
name="get_follow_group_reports",
|
|
315
|
+
epilog=generate_epilog(
|
|
316
|
+
{},
|
|
317
|
+
[
|
|
318
|
+
'reportify-cli user get_follow_group_reports --input \'{"group_id": "123", "page_num": 1, "page_size": 20}\'',
|
|
319
|
+
],
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
def get_follow_group_reports(
|
|
323
|
+
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
324
|
+
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
325
|
+
):
|
|
326
|
+
"""Get reports for a follow group"""
|
|
327
|
+
try:
|
|
328
|
+
params_dict = parse_json_input(input)
|
|
329
|
+
client = get_client()
|
|
330
|
+
group_id = params_dict.get("group_id")
|
|
331
|
+
if not group_id:
|
|
332
|
+
raise ValueError("group_id is required")
|
|
333
|
+
page_num = params_dict.get("page_num", 1)
|
|
334
|
+
page_size = params_dict.get("page_size", 10)
|
|
335
|
+
result = client.user.get_follow_group_reports(group_id, page_num, page_size)
|
|
336
|
+
format_output(result, format)
|
|
337
|
+
except Exception as e:
|
|
338
|
+
typer.echo(f"Error: {e}", err=True)
|
|
339
|
+
raise typer.Exit(1)
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"""User 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="User data", rich_markup_mode="rich")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@app.command(
|
|
16
|
-
name="followed_companies",
|
|
17
|
-
epilog=generate_epilog(
|
|
18
|
-
params.USER_FOLLOWED_COMPANIES_PARAMS, ["reportify-cli user followed_companies"]
|
|
19
|
-
),
|
|
20
|
-
)
|
|
21
|
-
def followed_companies(
|
|
22
|
-
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
23
|
-
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
24
|
-
):
|
|
25
|
-
"""Get all followed companies"""
|
|
26
|
-
try:
|
|
27
|
-
params_dict = parse_json_input(input)
|
|
28
|
-
client = get_client()
|
|
29
|
-
result = client.user.followed_companies(**params_dict)
|
|
30
|
-
format_output(result, format)
|
|
31
|
-
except Exception as e:
|
|
32
|
-
typer.echo(f"Error: {e}", err=True)
|
|
33
|
-
raise typer.Exit(1)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@app.command(
|
|
37
|
-
name="follow_company",
|
|
38
|
-
epilog=generate_epilog(
|
|
39
|
-
params.USER_FOLLOW_COMPANY_PARAMS,
|
|
40
|
-
[
|
|
41
|
-
'reportify-cli user follow_company --input \'{"symbol": "US:AAPL"}\'',
|
|
42
|
-
'reportify-cli user follow_company --input \'{"symbol": "HK:00700"}\'',
|
|
43
|
-
'reportify-cli user follow_company --input \'{"symbol": "SH:600519"}\'',
|
|
44
|
-
'reportify-cli user follow_company --input \'{"symbol": "SZ:000001"}\'',
|
|
45
|
-
|
|
46
|
-
],
|
|
47
|
-
),
|
|
48
|
-
)
|
|
49
|
-
def follow_company(
|
|
50
|
-
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
51
|
-
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
52
|
-
):
|
|
53
|
-
"""Follow a company (add to watchlist)"""
|
|
54
|
-
try:
|
|
55
|
-
params_dict = parse_json_input(input)
|
|
56
|
-
client = get_client()
|
|
57
|
-
symbol = params_dict.get("symbol")
|
|
58
|
-
if not symbol:
|
|
59
|
-
raise ValueError("symbol is required")
|
|
60
|
-
result = client.user.follow_company(symbol)
|
|
61
|
-
format_output(result, format)
|
|
62
|
-
except Exception as e:
|
|
63
|
-
typer.echo(f"Error: {e}", err=True)
|
|
64
|
-
raise typer.Exit(1)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@app.command(
|
|
68
|
-
name="unfollow_company",
|
|
69
|
-
epilog=generate_epilog(
|
|
70
|
-
params.USER_UNFOLLOW_COMPANY_PARAMS,
|
|
71
|
-
[
|
|
72
|
-
'reportify-cli user unfollow_company --input \'{"symbol": "US:AAPL"}\'',
|
|
73
|
-
'reportify-cli user unfollow_company --input \'{"symbol": "HK:00700"}\'',
|
|
74
|
-
],
|
|
75
|
-
),
|
|
76
|
-
)
|
|
77
|
-
def unfollow_company(
|
|
78
|
-
input: Annotated[str, typer.Option(help="JSON input parameters")] = "{}",
|
|
79
|
-
format: Annotated[str, typer.Option(help="Output format: json, table, csv")] = "json",
|
|
80
|
-
):
|
|
81
|
-
"""Unfollow a company (remove from watchlist)"""
|
|
82
|
-
try:
|
|
83
|
-
params_dict = parse_json_input(input)
|
|
84
|
-
client = get_client()
|
|
85
|
-
symbol = params_dict.get("symbol")
|
|
86
|
-
if not symbol:
|
|
87
|
-
raise ValueError("symbol is required")
|
|
88
|
-
result = client.user.unfollow_company(symbol)
|
|
89
|
-
format_output(result, format)
|
|
90
|
-
except Exception as e:
|
|
91
|
-
typer.echo(f"Error: {e}", err=True)
|
|
92
|
-
raise typer.Exit(1)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|