tradingplan-cli 0.1.0__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.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: tradingplan-cli
3
+ Version: 0.1.0
4
+ Summary: Read-only trading journal CLI for agents. Query Trading Plan pre-market plans, node analysis, daily reviews, trades, and discipline records.
5
+ Project-URL: Homepage, https://tradingplan.day
6
+ Project-URL: Trading Plan (China), https://longtou.online
7
+ Project-URL: App Store, https://apps.apple.com/app/id6760321164
8
+ Project-URL: Google Play, https://play.google.com/store/apps/details?id=online.longtou.plan
9
+ Keywords: trading,trading-journal,trading-plan,trade-review,pre-market,discipline,cli,cursor,claude,agent
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: httpx>=0.27
23
+
24
+ # tradingplan-cli
25
+
26
+ Read-only trading journal CLI for agents. Cursor, Claude Code, and other tools with a shell can query your [Trading Plan](https://tradingplan.day) account: pre-market plans, node analysis, trade journals, daily reviews, fills, discipline records, and strategies.
27
+
28
+ Trading Plan separates execution from judgment. The daily loop is plan before the open, log what you did, then review after the close. This CLI reads that record. It does not create, edit, or delete anything.
29
+
30
+ - China site (交易计划 / 龙头在线): https://longtou.online
31
+ - Overseas site: https://tradingplan.day
32
+ - App Store (TradingPlan, id 6760321164): https://apps.apple.com/app/id6760321164
33
+ - Google Play (`online.longtou.plan`): https://play.google.com/store/apps/details?id=online.longtou.plan
34
+
35
+ ## Install
36
+
37
+ Python 3.10 or newer.
38
+
39
+ ```bash
40
+ pipx install tradingplan-cli
41
+ ```
42
+
43
+ Or, inside a virtualenv:
44
+
45
+ ```bash
46
+ pip install tradingplan-cli
47
+ ```
48
+
49
+ The console command is `tradingplan`.
50
+
51
+ ## Configure
52
+
53
+ Create an API key on the website under **API Keys** (membership), then:
54
+
55
+ ```bash
56
+ tradingplan init
57
+ ```
58
+
59
+ Or set the environment, which is the better fit for an agent:
60
+
61
+ ```bash
62
+ export TRADINGPLAN_API_KEY=sk_...
63
+ export TRADINGPLAN_API_URL=https://longtou.online/api/v1 # china
64
+ # export TRADINGPLAN_API_URL=https://tradingplan.day/api/v1 # overseas
65
+ ```
66
+
67
+ Flags `--api-key`, `--api-url`, and `--site china|overseas` override the environment. `--site china` uses `https://longtou.online/api/v1`. `--site overseas` uses `https://tradingplan.day/api/v1`.
68
+
69
+ ## Agent setup
70
+
71
+ ```bash
72
+ tradingplan skill
73
+ ```
74
+
75
+ Paste the printed instructions into the agent. The usual question — what did I plan, trade, and review on one day — is one command:
76
+
77
+ ```bash
78
+ tradingplan day 2026-09-10
79
+ ```
80
+
81
+ That returns the day's plans, node analysis, journal, daily review, transactions (with per-trade review notes), and discipline records as JSON.
82
+
83
+ ## Commands
84
+
85
+ | Command | What it reads |
86
+ | --- | --- |
87
+ | `tradingplan whoami` | Confirm the API key and site |
88
+ | `tradingplan day YYYY-MM-DD` | One-day snapshot |
89
+ | `tradingplan plans list\|get` | Pre-market and action plans |
90
+ | `tradingplan node-analysis YYYY-MM-DD` | Node analysis for one day |
91
+ | `tradingplan journals list\|get` | Trade journal |
92
+ | `tradingplan reviews daily list\|get` | Daily review |
93
+ | `tradingplan reviews notes list\|get` | Per-trade review notes |
94
+ | `tradingplan txs list\|get` | Transactions (`buy`, `sell`, `add`, `reduce`) |
95
+ | `tradingplan strategies list\|get` | Strategies |
96
+ | `tradingplan disciplines list\|get` | Discipline rules |
97
+ | `tradingplan disciplines records` | Followed or violated discipline records |
98
+
99
+ `--from` and `--to` are `YYYY-MM-DD`. List commands accept `--limit` and `--offset`. Success is JSON on stdout. Errors are JSON on stderr with `code`: `unauthorized`, `not_found`, `invalid_args`, `rate_limited`, or `network`.
100
+
101
+ ## 中文
102
+
103
+ 给 Cursor、Claude Code 用的只读命令行,读取你在交易计划(原龙头在线)里的盘前计划、节点分析、交易日记、每日复盘、成交、纪律和策略。对应网站上的计划 → 执行 → 复盘闭环。只查询,不写入。
104
+
105
+ ```bash
106
+ pipx install tradingplan-cli
107
+ export TRADINGPLAN_API_KEY=sk_...
108
+ export TRADINGPLAN_API_URL=https://longtou.online/api/v1
109
+ tradingplan day 2026-09-10
110
+ ```
111
+
112
+ 密钥在网站「API 密钥」页创建。`tradingplan skill` 会打印给 Agent 的使用说明。
113
+
114
+ 手机端安装:
115
+
116
+ - App Store:https://apps.apple.com/app/id6760321164
117
+ - Google Play:https://play.google.com/store/apps/details?id=online.longtou.plan
118
+
119
+ ## Develop from a checkout
120
+
121
+ ```bash
122
+ pip install -e ./packages/tradingplan-cli
123
+ ```
@@ -0,0 +1,100 @@
1
+ # tradingplan-cli
2
+
3
+ Read-only trading journal CLI for agents. Cursor, Claude Code, and other tools with a shell can query your [Trading Plan](https://tradingplan.day) account: pre-market plans, node analysis, trade journals, daily reviews, fills, discipline records, and strategies.
4
+
5
+ Trading Plan separates execution from judgment. The daily loop is plan before the open, log what you did, then review after the close. This CLI reads that record. It does not create, edit, or delete anything.
6
+
7
+ - China site (交易计划 / 龙头在线): https://longtou.online
8
+ - Overseas site: https://tradingplan.day
9
+ - App Store (TradingPlan, id 6760321164): https://apps.apple.com/app/id6760321164
10
+ - Google Play (`online.longtou.plan`): https://play.google.com/store/apps/details?id=online.longtou.plan
11
+
12
+ ## Install
13
+
14
+ Python 3.10 or newer.
15
+
16
+ ```bash
17
+ pipx install tradingplan-cli
18
+ ```
19
+
20
+ Or, inside a virtualenv:
21
+
22
+ ```bash
23
+ pip install tradingplan-cli
24
+ ```
25
+
26
+ The console command is `tradingplan`.
27
+
28
+ ## Configure
29
+
30
+ Create an API key on the website under **API Keys** (membership), then:
31
+
32
+ ```bash
33
+ tradingplan init
34
+ ```
35
+
36
+ Or set the environment, which is the better fit for an agent:
37
+
38
+ ```bash
39
+ export TRADINGPLAN_API_KEY=sk_...
40
+ export TRADINGPLAN_API_URL=https://longtou.online/api/v1 # china
41
+ # export TRADINGPLAN_API_URL=https://tradingplan.day/api/v1 # overseas
42
+ ```
43
+
44
+ Flags `--api-key`, `--api-url`, and `--site china|overseas` override the environment. `--site china` uses `https://longtou.online/api/v1`. `--site overseas` uses `https://tradingplan.day/api/v1`.
45
+
46
+ ## Agent setup
47
+
48
+ ```bash
49
+ tradingplan skill
50
+ ```
51
+
52
+ Paste the printed instructions into the agent. The usual question — what did I plan, trade, and review on one day — is one command:
53
+
54
+ ```bash
55
+ tradingplan day 2026-09-10
56
+ ```
57
+
58
+ That returns the day's plans, node analysis, journal, daily review, transactions (with per-trade review notes), and discipline records as JSON.
59
+
60
+ ## Commands
61
+
62
+ | Command | What it reads |
63
+ | --- | --- |
64
+ | `tradingplan whoami` | Confirm the API key and site |
65
+ | `tradingplan day YYYY-MM-DD` | One-day snapshot |
66
+ | `tradingplan plans list\|get` | Pre-market and action plans |
67
+ | `tradingplan node-analysis YYYY-MM-DD` | Node analysis for one day |
68
+ | `tradingplan journals list\|get` | Trade journal |
69
+ | `tradingplan reviews daily list\|get` | Daily review |
70
+ | `tradingplan reviews notes list\|get` | Per-trade review notes |
71
+ | `tradingplan txs list\|get` | Transactions (`buy`, `sell`, `add`, `reduce`) |
72
+ | `tradingplan strategies list\|get` | Strategies |
73
+ | `tradingplan disciplines list\|get` | Discipline rules |
74
+ | `tradingplan disciplines records` | Followed or violated discipline records |
75
+
76
+ `--from` and `--to` are `YYYY-MM-DD`. List commands accept `--limit` and `--offset`. Success is JSON on stdout. Errors are JSON on stderr with `code`: `unauthorized`, `not_found`, `invalid_args`, `rate_limited`, or `network`.
77
+
78
+ ## 中文
79
+
80
+ 给 Cursor、Claude Code 用的只读命令行,读取你在交易计划(原龙头在线)里的盘前计划、节点分析、交易日记、每日复盘、成交、纪律和策略。对应网站上的计划 → 执行 → 复盘闭环。只查询,不写入。
81
+
82
+ ```bash
83
+ pipx install tradingplan-cli
84
+ export TRADINGPLAN_API_KEY=sk_...
85
+ export TRADINGPLAN_API_URL=https://longtou.online/api/v1
86
+ tradingplan day 2026-09-10
87
+ ```
88
+
89
+ 密钥在网站「API 密钥」页创建。`tradingplan skill` 会打印给 Agent 的使用说明。
90
+
91
+ 手机端安装:
92
+
93
+ - App Store:https://apps.apple.com/app/id6760321164
94
+ - Google Play:https://play.google.com/store/apps/details?id=online.longtou.plan
95
+
96
+ ## Develop from a checkout
97
+
98
+ ```bash
99
+ pip install -e ./packages/tradingplan-cli
100
+ ```
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tradingplan-cli"
7
+ version = "0.1.0"
8
+ description = "Read-only trading journal CLI for agents. Query Trading Plan pre-market plans, node analysis, daily reviews, trades, and discipline records."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ keywords = [
12
+ "trading",
13
+ "trading-journal",
14
+ "trading-plan",
15
+ "trade-review",
16
+ "pre-market",
17
+ "discipline",
18
+ "cli",
19
+ "cursor",
20
+ "claude",
21
+ "agent",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Environment :: Console",
26
+ "Intended Audience :: Developers",
27
+ "Operating System :: OS Independent",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Topic :: Office/Business :: Financial",
34
+ ]
35
+ dependencies = [
36
+ "httpx>=0.27",
37
+ ]
38
+
39
+ [project.urls]
40
+ Homepage = "https://tradingplan.day"
41
+ "Trading Plan (China)" = "https://longtou.online"
42
+ "App Store" = "https://apps.apple.com/app/id6760321164"
43
+ "Google Play" = "https://play.google.com/store/apps/details?id=online.longtou.plan"
44
+
45
+ [project.scripts]
46
+ tradingplan = "tradingplan_cli.cli:run"
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"]
50
+
51
+ [tool.setuptools.package-data]
52
+ tradingplan_cli = ["SKILL.md"]
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests"]
56
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ # TradingPlan CLI
2
+
3
+ Read-only access to the current user's TradingPlan data (plans, node analysis, journal, reviews, trades, disciplines, strategies). Never write or delete.
4
+
5
+ ## Setup
6
+
7
+ Environment (preferred for agents):
8
+
9
+ - `TRADINGPLAN_API_KEY` — membership API key (`sk_...`)
10
+ - `TRADINGPLAN_API_URL` — `https://longtou.online/api/v1` (china) or `https://tradingplan.day/api/v1` (overseas)
11
+
12
+ Or `tradingplan --site china|overseas` plus the key.
13
+
14
+ ## Command routing
15
+
16
+ Prefer **one day at a time**:
17
+
18
+ ```text
19
+ tradingplan day YYYY-MM-DD
20
+ ```
21
+
22
+ Returns that day's plans, node analysis, journal, daily review, transactions (with per-trade review notes), and discipline records.
23
+
24
+ Then drill in only if needed:
25
+
26
+ - `tradingplan plans list --from DATE --to DATE`
27
+ - `tradingplan plans get ID`
28
+ - `tradingplan node-analysis DATE`
29
+ - `tradingplan journals list|get`
30
+ - `tradingplan reviews daily list|get`
31
+ - `tradingplan reviews notes list --tx ID --code CODE`
32
+ - `tradingplan txs list --from DATE --to DATE --code CODE --type buy|sell|add|reduce`
33
+ - `tradingplan strategies list|get`
34
+ - `tradingplan disciplines list|get`
35
+ - `tradingplan disciplines records --date DATE --status followed|violated`
36
+ - `tradingplan whoami` — confirm the key and site
37
+
38
+ `--from` / `--to` are `YYYY-MM-DD`. Output is JSON on stdout. On error, JSON on stderr with `code` (`unauthorized`, `not_found`, `invalid_args`, `rate_limited`, `network`).
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ __all__ = ["main"]
@@ -0,0 +1,4 @@
1
+ from tradingplan_cli.cli import run
2
+
3
+ if __name__ == "__main__":
4
+ run()
@@ -0,0 +1,362 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import json
5
+ import os
6
+ import sys
7
+ from importlib.resources import files
8
+ from typing import Optional
9
+
10
+ from . import client as api
11
+ from .config import CONFIG_PATH, ConfigError, SITES, dump_file, resolve_settings
12
+ from .errors import CliError
13
+
14
+
15
+ def _emit(payload) -> None:
16
+ print(json.dumps(payload, ensure_ascii=False))
17
+
18
+
19
+ def _settings(args):
20
+ return resolve_settings(
21
+ api_key=getattr(args, "api_key", None),
22
+ api_url=getattr(args, "api_url", None),
23
+ site=getattr(args, "site", None),
24
+ environ=os.environ,
25
+ )
26
+
27
+
28
+ def _get(args, path: str, params: Optional[dict] = None) -> None:
29
+ try:
30
+ settings = _settings(args)
31
+ _emit(api.get_json(settings, path, params))
32
+ except ConfigError as exc:
33
+ raise CliError(exc.message, "invalid_args", "See `tradingplan --help` or `tradingplan init`", 4) from exc
34
+
35
+
36
+ def _add_auth(parser: argparse.ArgumentParser) -> None:
37
+ parser.add_argument("--api-key", dest="api_key", default=None)
38
+ parser.add_argument("--api-url", dest="api_url", default=None)
39
+ parser.add_argument("--site", dest="site", choices=sorted(SITES), default=None)
40
+
41
+
42
+ def _add_page(parser: argparse.ArgumentParser) -> None:
43
+ parser.add_argument("--limit", type=int, default=50)
44
+ parser.add_argument("--offset", type=int, default=0)
45
+
46
+
47
+ def _add_range(parser: argparse.ArgumentParser, *, with_date: bool = True) -> None:
48
+ if with_date:
49
+ parser.add_argument("--date", default=None)
50
+ parser.add_argument("--from", dest="date_from", default=None)
51
+ parser.add_argument("--to", dest="date_to", default=None)
52
+
53
+
54
+ def cmd_whoami(args) -> None:
55
+ _get(args, "/cli/me")
56
+
57
+
58
+ def cmd_day(args) -> None:
59
+ _get(args, "/cli/day", {"date": args.date})
60
+
61
+
62
+ def cmd_node_analysis(args) -> None:
63
+ _get(args, "/cli/node-analysis", {"date": args.date})
64
+
65
+
66
+ def cmd_init(args) -> None:
67
+ if CONFIG_PATH.exists() and not args.force and not sys.stdin.isatty():
68
+ raise CliError("Config already exists", "invalid_args", "Pass --force to overwrite", 4)
69
+ chosen_site = args.site
70
+ if not chosen_site:
71
+ if not sys.stdin.isatty():
72
+ raise CliError("site is required", "invalid_args", "Pass --site china|overseas", 4)
73
+ chosen_site = input("Site [china]: ").strip() or "china"
74
+ if chosen_site not in SITES:
75
+ raise CliError("site must be china or overseas", "invalid_args", "Use china or overseas", 4)
76
+ key = args.api_key
77
+ if not key:
78
+ if not sys.stdin.isatty():
79
+ raise CliError("API key is required", "invalid_args", "Pass --api-key", 4)
80
+ key = input("API key: ").strip()
81
+ if not key:
82
+ raise CliError("API key is required", "invalid_args", "Pass --api-key", 4)
83
+ dump_file(CONFIG_PATH, {"site": chosen_site, "api_url": SITES[chosen_site], "api_key": key})
84
+ _emit({"ok": True, "path": str(CONFIG_PATH)})
85
+
86
+
87
+ def cmd_skill(_args) -> None:
88
+ text = files("tradingplan_cli").joinpath("SKILL.md").read_text(encoding="utf-8")
89
+ sys.stdout.write(text)
90
+
91
+
92
+ def cmd_plans_list(args) -> None:
93
+ _get(
94
+ args,
95
+ "/cli/plans",
96
+ {
97
+ "date": args.date,
98
+ "start_date": args.date_from,
99
+ "end_date": args.date_to,
100
+ "plan_type": args.type,
101
+ "limit": args.limit,
102
+ "offset": args.offset,
103
+ },
104
+ )
105
+
106
+
107
+ def cmd_plans_get(args) -> None:
108
+ _get(args, f"/cli/plans/{args.id}")
109
+
110
+
111
+ def cmd_journals_list(args) -> None:
112
+ _get(
113
+ args,
114
+ "/cli/journals",
115
+ {
116
+ "date": args.date,
117
+ "start_date": args.date_from,
118
+ "end_date": args.date_to,
119
+ "limit": args.limit,
120
+ "offset": args.offset,
121
+ },
122
+ )
123
+
124
+
125
+ def cmd_journals_get(args) -> None:
126
+ _get(args, f"/cli/journals/{args.id}")
127
+
128
+
129
+ def cmd_reviews_daily_list(args) -> None:
130
+ _get(
131
+ args,
132
+ "/cli/daily-reviews",
133
+ {
134
+ "date": args.date,
135
+ "start_date": args.date_from,
136
+ "end_date": args.date_to,
137
+ "limit": args.limit,
138
+ "offset": args.offset,
139
+ },
140
+ )
141
+
142
+
143
+ def cmd_reviews_daily_get(args) -> None:
144
+ _get(args, f"/cli/daily-reviews/{args.id}")
145
+
146
+
147
+ def cmd_reviews_notes_list(args) -> None:
148
+ _get(
149
+ args,
150
+ "/cli/review-notes",
151
+ {
152
+ "transaction_id": args.tx,
153
+ "start_date": args.date_from,
154
+ "end_date": args.date_to,
155
+ "stock_code": args.code,
156
+ "limit": args.limit,
157
+ "offset": args.offset,
158
+ },
159
+ )
160
+
161
+
162
+ def cmd_reviews_notes_get(args) -> None:
163
+ _get(args, f"/cli/review-notes/{args.id}")
164
+
165
+
166
+ def cmd_txs_list(args) -> None:
167
+ _get(
168
+ args,
169
+ "/cli/transactions",
170
+ {
171
+ "start_date": args.date_from,
172
+ "end_date": args.date_to,
173
+ "stock_code": args.code,
174
+ "trade_type": args.type,
175
+ "limit": args.limit,
176
+ "offset": args.offset,
177
+ },
178
+ )
179
+
180
+
181
+ def cmd_txs_get(args) -> None:
182
+ _get(args, f"/cli/transactions/{args.id}")
183
+
184
+
185
+ def cmd_strategies_list(args) -> None:
186
+ _get(args, "/cli/strategies", {"limit": args.limit, "offset": args.offset})
187
+
188
+
189
+ def cmd_strategies_get(args) -> None:
190
+ _get(args, f"/cli/strategies/{args.id}")
191
+
192
+
193
+ def cmd_disciplines_list(args) -> None:
194
+ _get(args, "/cli/disciplines", {"limit": args.limit, "offset": args.offset})
195
+
196
+
197
+ def cmd_disciplines_get(args) -> None:
198
+ _get(args, f"/cli/disciplines/{args.id}")
199
+
200
+
201
+ def cmd_disciplines_records(args) -> None:
202
+ _get(
203
+ args,
204
+ "/cli/discipline-records",
205
+ {
206
+ "date": args.date,
207
+ "start_date": args.date_from,
208
+ "end_date": args.date_to,
209
+ "status": args.status,
210
+ "limit": args.limit,
211
+ "offset": args.offset,
212
+ },
213
+ )
214
+
215
+
216
+ def build_parser() -> argparse.ArgumentParser:
217
+ parser = argparse.ArgumentParser(prog="tradingplan", description="Read-only TradingPlan CLI for agents")
218
+ sub = parser.add_subparsers(dest="command", required=True)
219
+
220
+ whoami = sub.add_parser("whoami", help="Confirm the API key and site")
221
+ _add_auth(whoami)
222
+ whoami.set_defaults(func=cmd_whoami)
223
+
224
+ day = sub.add_parser("day", help="One-day snapshot")
225
+ day.add_argument("date")
226
+ _add_auth(day)
227
+ day.set_defaults(func=cmd_day)
228
+
229
+ node = sub.add_parser("node-analysis", help="Node analysis for one day")
230
+ node.add_argument("date")
231
+ _add_auth(node)
232
+ node.set_defaults(func=cmd_node_analysis)
233
+
234
+ init = sub.add_parser("init", help="Write ~/.config/tradingplan/config.toml")
235
+ init.add_argument("--force", action="store_true")
236
+ _add_auth(init)
237
+ init.set_defaults(func=cmd_init)
238
+
239
+ skill = sub.add_parser("skill", help="Print the agent skill text")
240
+ skill.set_defaults(func=cmd_skill)
241
+
242
+ plans = sub.add_parser("plans").add_subparsers(dest="plans_cmd", required=True)
243
+ plans_list = plans.add_parser("list")
244
+ _add_range(plans_list)
245
+ plans_list.add_argument("--type", dest="type", default=None)
246
+ _add_page(plans_list)
247
+ _add_auth(plans_list)
248
+ plans_list.set_defaults(func=cmd_plans_list)
249
+ plans_get = plans.add_parser("get")
250
+ plans_get.add_argument("id", type=int)
251
+ _add_auth(plans_get)
252
+ plans_get.set_defaults(func=cmd_plans_get)
253
+
254
+ journals = sub.add_parser("journals").add_subparsers(dest="journals_cmd", required=True)
255
+ journals_list = journals.add_parser("list")
256
+ _add_range(journals_list)
257
+ _add_page(journals_list)
258
+ _add_auth(journals_list)
259
+ journals_list.set_defaults(func=cmd_journals_list)
260
+ journals_get = journals.add_parser("get")
261
+ journals_get.add_argument("id", type=int)
262
+ _add_auth(journals_get)
263
+ journals_get.set_defaults(func=cmd_journals_get)
264
+
265
+ reviews = sub.add_parser("reviews").add_subparsers(dest="reviews_cmd", required=True)
266
+ daily = reviews.add_parser("daily").add_subparsers(dest="reviews_daily_cmd", required=True)
267
+ daily_list = daily.add_parser("list")
268
+ _add_range(daily_list)
269
+ _add_page(daily_list)
270
+ _add_auth(daily_list)
271
+ daily_list.set_defaults(func=cmd_reviews_daily_list)
272
+ daily_get = daily.add_parser("get")
273
+ daily_get.add_argument("id", type=int)
274
+ _add_auth(daily_get)
275
+ daily_get.set_defaults(func=cmd_reviews_daily_get)
276
+
277
+ notes = reviews.add_parser("notes").add_subparsers(dest="reviews_notes_cmd", required=True)
278
+ notes_list = notes.add_parser("list")
279
+ notes_list.add_argument("--tx", type=int, default=None)
280
+ _add_range(notes_list, with_date=False)
281
+ notes_list.add_argument("--code", default=None)
282
+ _add_page(notes_list)
283
+ _add_auth(notes_list)
284
+ notes_list.set_defaults(func=cmd_reviews_notes_list)
285
+ notes_get = notes.add_parser("get")
286
+ notes_get.add_argument("id", type=int)
287
+ _add_auth(notes_get)
288
+ notes_get.set_defaults(func=cmd_reviews_notes_get)
289
+
290
+ txs = sub.add_parser("txs").add_subparsers(dest="txs_cmd", required=True)
291
+ txs_list = txs.add_parser("list")
292
+ _add_range(txs_list, with_date=False)
293
+ txs_list.add_argument("--code", default=None)
294
+ txs_list.add_argument("--type", dest="type", default=None)
295
+ _add_page(txs_list)
296
+ _add_auth(txs_list)
297
+ txs_list.set_defaults(func=cmd_txs_list)
298
+ txs_get = txs.add_parser("get")
299
+ txs_get.add_argument("id", type=int)
300
+ _add_auth(txs_get)
301
+ txs_get.set_defaults(func=cmd_txs_get)
302
+
303
+ strategies = sub.add_parser("strategies").add_subparsers(dest="strategies_cmd", required=True)
304
+ strategies_list = strategies.add_parser("list")
305
+ _add_page(strategies_list)
306
+ _add_auth(strategies_list)
307
+ strategies_list.set_defaults(func=cmd_strategies_list)
308
+ strategies_get = strategies.add_parser("get")
309
+ strategies_get.add_argument("id", type=int)
310
+ _add_auth(strategies_get)
311
+ strategies_get.set_defaults(func=cmd_strategies_get)
312
+
313
+ disciplines = sub.add_parser("disciplines").add_subparsers(dest="disciplines_cmd", required=True)
314
+ disciplines_list = disciplines.add_parser("list")
315
+ _add_page(disciplines_list)
316
+ _add_auth(disciplines_list)
317
+ disciplines_list.set_defaults(func=cmd_disciplines_list)
318
+ disciplines_get = disciplines.add_parser("get")
319
+ disciplines_get.add_argument("id", type=int)
320
+ _add_auth(disciplines_get)
321
+ disciplines_get.set_defaults(func=cmd_disciplines_get)
322
+ records = disciplines.add_parser("records")
323
+ _add_range(records)
324
+ records.add_argument("--status", default=None)
325
+ _add_page(records)
326
+ _add_auth(records)
327
+ records.set_defaults(func=cmd_disciplines_records)
328
+
329
+ return parser
330
+
331
+
332
+ def main(argv: Optional[list[str]] = None) -> int:
333
+ parser = build_parser()
334
+ try:
335
+ args = parser.parse_args(argv)
336
+ args.func(args)
337
+ return 0
338
+ except CliError as exc:
339
+ print(exc.to_json(), file=sys.stderr)
340
+ return exc.exit_code
341
+ except SystemExit as exc:
342
+ code = exc.code if isinstance(exc.code, int) else 1
343
+ if code == 0:
344
+ return 0
345
+ print(
346
+ CliError(
347
+ "Invalid arguments",
348
+ "invalid_args",
349
+ "See `tradingplan --help`",
350
+ 4,
351
+ ).to_json(),
352
+ file=sys.stderr,
353
+ )
354
+ return 4
355
+
356
+
357
+ def run() -> None:
358
+ raise SystemExit(main())
359
+
360
+
361
+ if __name__ == "__main__":
362
+ run()
@@ -0,0 +1,39 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Optional
4
+
5
+ import httpx
6
+
7
+ from .config import Settings
8
+ from .errors import CliError, from_http
9
+
10
+
11
+ def get_json(
12
+ settings: Settings,
13
+ path: str,
14
+ params: Optional[dict[str, Any]] = None,
15
+ *,
16
+ transport: Optional[httpx.BaseTransport] = None,
17
+ ) -> Any:
18
+ headers = {"X-API-Key": settings.api_key}
19
+ try:
20
+ with httpx.Client(
21
+ base_url=settings.api_url,
22
+ headers=headers,
23
+ timeout=30.0,
24
+ transport=transport,
25
+ ) as client:
26
+ response = client.get(path, params=_clean_params(params or {}))
27
+ except httpx.HTTPError as exc:
28
+ raise CliError(str(exc), "network", "Retry or check TRADINGPLAN_API_URL", 1) from exc
29
+ if response.status_code >= 400:
30
+ try:
31
+ body = response.json()
32
+ except ValueError:
33
+ body = response.text
34
+ raise from_http(response.status_code, body)
35
+ return response.json()
36
+
37
+
38
+ def _clean_params(params: dict[str, Any]) -> dict[str, Any]:
39
+ return {key: value for key, value in params.items() if value is not None}
@@ -0,0 +1,103 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from pathlib import Path
5
+ from typing import Mapping, Optional
6
+
7
+ SITES = {
8
+ "china": "https://longtou.online/api/v1",
9
+ "overseas": "https://tradingplan.day/api/v1",
10
+ }
11
+
12
+ CONFIG_PATH = Path.home() / ".config" / "tradingplan" / "config.toml"
13
+
14
+
15
+ class ConfigError(Exception):
16
+ def __init__(self, message: str):
17
+ super().__init__(message)
18
+ self.message = message
19
+
20
+
21
+ @dataclass
22
+ class Settings:
23
+ api_key: str
24
+ api_url: str
25
+ site: Optional[str] = None
26
+
27
+
28
+ def _parse_simple_toml(text: str) -> dict[str, str]:
29
+ data: dict[str, str] = {}
30
+ for raw in text.splitlines():
31
+ line = raw.strip()
32
+ if not line or line.startswith("#") or "=" not in line:
33
+ continue
34
+ key, value = line.split("=", 1)
35
+ data[key.strip()] = value.strip().strip('"').strip("'")
36
+ return data
37
+
38
+
39
+ def load_file(path: Path) -> dict[str, str]:
40
+ if not path.is_file():
41
+ return {}
42
+ return _parse_simple_toml(path.read_text(encoding="utf-8"))
43
+
44
+
45
+ def dump_file(path: Path, values: dict[str, str]) -> None:
46
+ path.parent.mkdir(parents=True, exist_ok=True)
47
+ lines = [f'{key} = "{value}"\n' for key, value in values.items() if value]
48
+ path.write_text("".join(lines), encoding="utf-8")
49
+ path.chmod(0o600)
50
+
51
+
52
+ def resolve_api_url(
53
+ *,
54
+ api_url: Optional[str] = None,
55
+ site: Optional[str] = None,
56
+ file_values: Optional[Mapping[str, str]] = None,
57
+ environ: Optional[Mapping[str, str]] = None,
58
+ ) -> Optional[str]:
59
+ file_values = file_values or {}
60
+ environ = environ or {}
61
+ if api_url:
62
+ return api_url.rstrip("/")
63
+ env_url = environ.get("TRADINGPLAN_API_URL")
64
+ if env_url:
65
+ return env_url.rstrip("/")
66
+ if site:
67
+ if site not in SITES:
68
+ raise ConfigError("site must be china or overseas")
69
+ return SITES[site]
70
+ file_url = file_values.get("api_url")
71
+ if file_url:
72
+ return file_url.rstrip("/")
73
+ file_site = file_values.get("site")
74
+ if file_site:
75
+ if file_site not in SITES:
76
+ raise ConfigError("site must be china or overseas")
77
+ return SITES[file_site]
78
+ return None
79
+
80
+
81
+ def resolve_settings(
82
+ *,
83
+ api_key: Optional[str] = None,
84
+ api_url: Optional[str] = None,
85
+ site: Optional[str] = None,
86
+ environ: Optional[Mapping[str, str]] = None,
87
+ config_path: Optional[Path] = None,
88
+ ) -> Settings:
89
+ environ = environ or {}
90
+ file_values = load_file(config_path or CONFIG_PATH)
91
+ key = api_key or environ.get("TRADINGPLAN_API_KEY") or file_values.get("api_key")
92
+ url = resolve_api_url(
93
+ api_url=api_url,
94
+ site=site,
95
+ file_values=file_values,
96
+ environ=environ,
97
+ )
98
+ if not key or not url:
99
+ raise ConfigError(
100
+ "Missing API key or URL. Run `tradingplan init` or set TRADINGPLAN_API_KEY and TRADINGPLAN_API_URL."
101
+ )
102
+ resolved_site = site or file_values.get("site")
103
+ return Settings(api_key=key, api_url=url, site=resolved_site)
@@ -0,0 +1,56 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from typing import Any, Optional
5
+
6
+
7
+ class CliError(Exception):
8
+ def __init__(self, error: str, code: str, hint: str, exit_code: int):
9
+ super().__init__(error)
10
+ self.error = error
11
+ self.code = code
12
+ self.hint = hint
13
+ self.exit_code = exit_code
14
+
15
+ def to_json(self) -> str:
16
+ return json.dumps(
17
+ {"error": self.error, "code": self.code, "hint": self.hint},
18
+ ensure_ascii=False,
19
+ )
20
+
21
+
22
+ def from_http(status_code: int, body: Any) -> CliError:
23
+ detail = ""
24
+ if isinstance(body, dict):
25
+ detail = str(body.get("detail") or body.get("error") or "")
26
+ elif isinstance(body, str):
27
+ detail = body
28
+ if status_code == 401:
29
+ return CliError(
30
+ detail or "Invalid API key",
31
+ "unauthorized",
32
+ "Check TRADINGPLAN_API_KEY and the site URL",
33
+ 2,
34
+ )
35
+ if status_code == 404:
36
+ return CliError(detail or "Not found", "not_found", "Check the id or date", 3)
37
+ if status_code == 422:
38
+ return CliError(
39
+ detail or "Invalid arguments",
40
+ "invalid_args",
41
+ "See `tradingplan --help`",
42
+ 4,
43
+ )
44
+ if status_code == 429:
45
+ return CliError(
46
+ detail or "Rate limited",
47
+ "rate_limited",
48
+ "Wait a minute and retry",
49
+ 1,
50
+ )
51
+ return CliError(
52
+ detail or f"HTTP {status_code}",
53
+ "network",
54
+ "Retry or check TRADINGPLAN_API_URL",
55
+ 1,
56
+ )
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: tradingplan-cli
3
+ Version: 0.1.0
4
+ Summary: Read-only trading journal CLI for agents. Query Trading Plan pre-market plans, node analysis, daily reviews, trades, and discipline records.
5
+ Project-URL: Homepage, https://tradingplan.day
6
+ Project-URL: Trading Plan (China), https://longtou.online
7
+ Project-URL: App Store, https://apps.apple.com/app/id6760321164
8
+ Project-URL: Google Play, https://play.google.com/store/apps/details?id=online.longtou.plan
9
+ Keywords: trading,trading-journal,trading-plan,trade-review,pre-market,discipline,cli,cursor,claude,agent
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: httpx>=0.27
23
+
24
+ # tradingplan-cli
25
+
26
+ Read-only trading journal CLI for agents. Cursor, Claude Code, and other tools with a shell can query your [Trading Plan](https://tradingplan.day) account: pre-market plans, node analysis, trade journals, daily reviews, fills, discipline records, and strategies.
27
+
28
+ Trading Plan separates execution from judgment. The daily loop is plan before the open, log what you did, then review after the close. This CLI reads that record. It does not create, edit, or delete anything.
29
+
30
+ - China site (交易计划 / 龙头在线): https://longtou.online
31
+ - Overseas site: https://tradingplan.day
32
+ - App Store (TradingPlan, id 6760321164): https://apps.apple.com/app/id6760321164
33
+ - Google Play (`online.longtou.plan`): https://play.google.com/store/apps/details?id=online.longtou.plan
34
+
35
+ ## Install
36
+
37
+ Python 3.10 or newer.
38
+
39
+ ```bash
40
+ pipx install tradingplan-cli
41
+ ```
42
+
43
+ Or, inside a virtualenv:
44
+
45
+ ```bash
46
+ pip install tradingplan-cli
47
+ ```
48
+
49
+ The console command is `tradingplan`.
50
+
51
+ ## Configure
52
+
53
+ Create an API key on the website under **API Keys** (membership), then:
54
+
55
+ ```bash
56
+ tradingplan init
57
+ ```
58
+
59
+ Or set the environment, which is the better fit for an agent:
60
+
61
+ ```bash
62
+ export TRADINGPLAN_API_KEY=sk_...
63
+ export TRADINGPLAN_API_URL=https://longtou.online/api/v1 # china
64
+ # export TRADINGPLAN_API_URL=https://tradingplan.day/api/v1 # overseas
65
+ ```
66
+
67
+ Flags `--api-key`, `--api-url`, and `--site china|overseas` override the environment. `--site china` uses `https://longtou.online/api/v1`. `--site overseas` uses `https://tradingplan.day/api/v1`.
68
+
69
+ ## Agent setup
70
+
71
+ ```bash
72
+ tradingplan skill
73
+ ```
74
+
75
+ Paste the printed instructions into the agent. The usual question — what did I plan, trade, and review on one day — is one command:
76
+
77
+ ```bash
78
+ tradingplan day 2026-09-10
79
+ ```
80
+
81
+ That returns the day's plans, node analysis, journal, daily review, transactions (with per-trade review notes), and discipline records as JSON.
82
+
83
+ ## Commands
84
+
85
+ | Command | What it reads |
86
+ | --- | --- |
87
+ | `tradingplan whoami` | Confirm the API key and site |
88
+ | `tradingplan day YYYY-MM-DD` | One-day snapshot |
89
+ | `tradingplan plans list\|get` | Pre-market and action plans |
90
+ | `tradingplan node-analysis YYYY-MM-DD` | Node analysis for one day |
91
+ | `tradingplan journals list\|get` | Trade journal |
92
+ | `tradingplan reviews daily list\|get` | Daily review |
93
+ | `tradingplan reviews notes list\|get` | Per-trade review notes |
94
+ | `tradingplan txs list\|get` | Transactions (`buy`, `sell`, `add`, `reduce`) |
95
+ | `tradingplan strategies list\|get` | Strategies |
96
+ | `tradingplan disciplines list\|get` | Discipline rules |
97
+ | `tradingplan disciplines records` | Followed or violated discipline records |
98
+
99
+ `--from` and `--to` are `YYYY-MM-DD`. List commands accept `--limit` and `--offset`. Success is JSON on stdout. Errors are JSON on stderr with `code`: `unauthorized`, `not_found`, `invalid_args`, `rate_limited`, or `network`.
100
+
101
+ ## 中文
102
+
103
+ 给 Cursor、Claude Code 用的只读命令行,读取你在交易计划(原龙头在线)里的盘前计划、节点分析、交易日记、每日复盘、成交、纪律和策略。对应网站上的计划 → 执行 → 复盘闭环。只查询,不写入。
104
+
105
+ ```bash
106
+ pipx install tradingplan-cli
107
+ export TRADINGPLAN_API_KEY=sk_...
108
+ export TRADINGPLAN_API_URL=https://longtou.online/api/v1
109
+ tradingplan day 2026-09-10
110
+ ```
111
+
112
+ 密钥在网站「API 密钥」页创建。`tradingplan skill` 会打印给 Agent 的使用说明。
113
+
114
+ 手机端安装:
115
+
116
+ - App Store:https://apps.apple.com/app/id6760321164
117
+ - Google Play:https://play.google.com/store/apps/details?id=online.longtou.plan
118
+
119
+ ## Develop from a checkout
120
+
121
+ ```bash
122
+ pip install -e ./packages/tradingplan-cli
123
+ ```
@@ -0,0 +1,16 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/tradingplan_cli/SKILL.md
4
+ src/tradingplan_cli/__init__.py
5
+ src/tradingplan_cli/__main__.py
6
+ src/tradingplan_cli/cli.py
7
+ src/tradingplan_cli/client.py
8
+ src/tradingplan_cli/config.py
9
+ src/tradingplan_cli/errors.py
10
+ src/tradingplan_cli.egg-info/PKG-INFO
11
+ src/tradingplan_cli.egg-info/SOURCES.txt
12
+ src/tradingplan_cli.egg-info/dependency_links.txt
13
+ src/tradingplan_cli.egg-info/entry_points.txt
14
+ src/tradingplan_cli.egg-info/requires.txt
15
+ src/tradingplan_cli.egg-info/top_level.txt
16
+ tests/test_cli.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ tradingplan = tradingplan_cli.cli:run
@@ -0,0 +1 @@
1
+ tradingplan_cli
@@ -0,0 +1,150 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import sys
7
+ from io import StringIO
8
+ from pathlib import Path
9
+
10
+ import httpx
11
+
12
+ from tradingplan_cli.cli import main
13
+ from tradingplan_cli.config import SITES, resolve_api_url
14
+ from tradingplan_cli.errors import from_http
15
+
16
+
17
+ def _run(monkeypatch, argv, *, stdin=None):
18
+ stdout = StringIO()
19
+ stderr = StringIO()
20
+ monkeypatch.setattr("sys.stdout", stdout)
21
+ monkeypatch.setattr("sys.stderr", stderr)
22
+ if stdin is not None:
23
+ monkeypatch.setattr("sys.stdin", stdin)
24
+ code = main(argv)
25
+ return code, stdout.getvalue(), stderr.getvalue()
26
+
27
+
28
+ def test_from_to_map_to_start_end_dates(monkeypatch):
29
+ captured = {}
30
+
31
+ def fake_get_json(settings, path, params=None, **kwargs):
32
+ captured["path"] = path
33
+ captured["params"] = params
34
+ captured["url"] = settings.api_url
35
+ captured["key"] = settings.api_key
36
+ return {"items": [], "limit": 50, "offset": 0, "has_more": False}
37
+
38
+ monkeypatch.setattr("tradingplan_cli.cli.api.get_json", fake_get_json)
39
+ code, out, err = _run(
40
+ monkeypatch,
41
+ [
42
+ "plans",
43
+ "list",
44
+ "--from",
45
+ "2026-09-01",
46
+ "--to",
47
+ "2026-09-10",
48
+ "--api-key",
49
+ "sk_test",
50
+ "--site",
51
+ "china",
52
+ ],
53
+ )
54
+ assert code == 0, err
55
+ assert captured["path"] == "/cli/plans"
56
+ assert captured["params"]["start_date"] == "2026-09-01"
57
+ assert captured["params"]["end_date"] == "2026-09-10"
58
+ assert captured["url"] == SITES["china"]
59
+ assert captured["key"] == "sk_test"
60
+ assert json.loads(out)["items"] == []
61
+
62
+
63
+ def test_site_overseas_url():
64
+ assert resolve_api_url(site="overseas") == SITES["overseas"]
65
+
66
+
67
+ def test_api_url_wins_over_site():
68
+ assert resolve_api_url(api_url="https://example.test/api/v1", site="china") == "https://example.test/api/v1"
69
+
70
+
71
+ def test_unauthorized_exit_code_2(monkeypatch):
72
+ def fake_get_json(*args, **kwargs):
73
+ raise from_http(401, {"detail": "Invalid API key"})
74
+
75
+ monkeypatch.setattr("tradingplan_cli.cli.api.get_json", fake_get_json)
76
+ code, _out, err = _run(monkeypatch, ["whoami", "--api-key", "sk_bad", "--site", "china"])
77
+ assert code == 2
78
+ assert json.loads(err)["code"] == "unauthorized"
79
+
80
+
81
+ def test_missing_config_exit_4(monkeypatch, tmp_path):
82
+ monkeypatch.delenv("TRADINGPLAN_API_KEY", raising=False)
83
+ monkeypatch.delenv("TRADINGPLAN_API_URL", raising=False)
84
+ monkeypatch.setattr("tradingplan_cli.config.CONFIG_PATH", tmp_path / "missing.toml")
85
+ code, _out, err = _run(monkeypatch, ["whoami"])
86
+ assert code == 4
87
+ assert json.loads(err)["code"] == "invalid_args"
88
+
89
+
90
+ def test_init_writes_config(monkeypatch, tmp_path):
91
+ path = tmp_path / "config.toml"
92
+ monkeypatch.setattr("tradingplan_cli.cli.CONFIG_PATH", path)
93
+ code, out, err = _run(
94
+ monkeypatch,
95
+ ["init", "--force", "--site", "overseas", "--api-key", "sk_live"],
96
+ )
97
+ assert code == 0, err
98
+ text = path.read_text(encoding="utf-8")
99
+ assert "overseas" in text
100
+ assert "sk_live" in text
101
+ assert SITES["overseas"] in text
102
+ assert (path.stat().st_mode & 0o777) == 0o600
103
+ assert json.loads(out)["ok"] is True
104
+
105
+
106
+ def test_skill_prints_markdown(monkeypatch):
107
+ code, out, err = _run(monkeypatch, ["skill"])
108
+ assert code == 0, err
109
+ assert "tradingplan day" in out
110
+ assert "TRADINGPLAN_API_KEY" in out
111
+
112
+
113
+ def test_module_entrypoint_propagates_exit_code(tmp_path):
114
+ """`python -m tradingplan_cli` must return the documented exit code, not 0."""
115
+ env = dict(os.environ)
116
+ env.pop("TRADINGPLAN_API_KEY", None)
117
+ env.pop("TRADINGPLAN_API_URL", None)
118
+ env["HOME"] = str(tmp_path)
119
+ env["PYTHONPATH"] = str(Path(__file__).resolve().parents[1] / "src")
120
+ result = subprocess.run(
121
+ [sys.executable, "-m", "tradingplan_cli", "whoami"],
122
+ capture_output=True,
123
+ text=True,
124
+ env=env,
125
+ )
126
+ assert result.returncode == 4, result.stderr
127
+ assert json.loads(result.stderr)["code"] == "invalid_args"
128
+
129
+
130
+ def test_http_client_sends_query_params():
131
+ captured = {}
132
+
133
+ def handler(request: httpx.Request) -> httpx.Response:
134
+ captured["url"] = str(request.url)
135
+ captured["header"] = request.headers.get("x-api-key")
136
+ return httpx.Response(200, json={"ok": True})
137
+
138
+ from tradingplan_cli.client import get_json
139
+ from tradingplan_cli.config import Settings
140
+
141
+ body = get_json(
142
+ Settings(api_key="sk_x", api_url="https://longtou.online/api/v1"),
143
+ "/cli/plans",
144
+ {"start_date": "2026-09-01", "end_date": "2026-09-10"},
145
+ transport=httpx.MockTransport(handler),
146
+ )
147
+ assert body == {"ok": True}
148
+ assert "start_date=2026-09-01" in captured["url"]
149
+ assert "end_date=2026-09-10" in captured["url"]
150
+ assert captured["header"] == "sk_x"