nemo-cli 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,311 @@
1
+ Metadata-Version: 2.4
2
+ Name: nemo-cli
3
+ Version: 0.0.1
4
+ Summary: Personal CLI to query Chilean stockbroker portals (currently compatible with portalclientes.vectorcapital.cl).
5
+ Project-URL: Homepage, https://github.com/albertomarturelo/nemo-cli
6
+ Project-URL: Repository, https://github.com/albertomarturelo/nemo-cli
7
+ Project-URL: Issues, https://github.com/albertomarturelo/nemo-cli/issues
8
+ Project-URL: Changelog, https://github.com/albertomarturelo/nemo-cli/blob/main/CHANGELOG.md
9
+ Author-email: Alberto Marturelo Lorenzo <amarturelo@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 Alberto Marturelo Lorenzo
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: broker,chile,cli,finance,investment,stockbroker
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: End Users/Desktop
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Topic :: Office/Business :: Financial :: Investment
43
+ Classifier: Topic :: Utilities
44
+ Requires-Python: >=3.11
45
+ Requires-Dist: httpx>=0.27
46
+ Requires-Dist: platformdirs>=4.0
47
+ Requires-Dist: python-dotenv>=1.0
48
+ Requires-Dist: rich>=13.0
49
+ Requires-Dist: typer>=0.12
50
+ Provides-Extra: dev
51
+ Requires-Dist: pyright>=1.1; extra == 'dev'
52
+ Requires-Dist: pytest>=8.0; extra == 'dev'
53
+ Requires-Dist: respx>=0.21; extra == 'dev'
54
+ Requires-Dist: ruff>=0.5; extra == 'dev'
55
+ Description-Content-Type: text/markdown
56
+
57
+ # nemo-cli
58
+
59
+ A personal command-line tool to inspect your holdings on Chilean stockbroker portals. Authenticates with your own credentials, caches a bearer token locally, and exposes portal operations as composable terminal commands.
60
+
61
+ > **Disclaimer.** This project is **not affiliated, endorsed, or sponsored** by Vector Capital S.A. Corredores de Bolsa or any other broker. It is a personal, unofficial client and is provided "as is", without any warranty. You are the sole responsible party for compliance with your contract with the broker whose portal you connect to. The CLI calls only documented endpoints reachable from the official web UI under your own session, with your own credentials, and never redistributes data. Currently compatible with the Vector Capital client portal at `portalclientes.vectorcapital.cl`.
62
+
63
+ ## Highlights
64
+
65
+ - One-command authentication — `nemo login` exchanges credentials for a token and caches it per user.
66
+ - Transparent token refresh — every authenticated call retries once on `401` after re-authenticating.
67
+ - Credentials live in environment variables; only the short-lived token is persisted.
68
+ - Browse Chilean and US-listed instruments — `nemo instruments local` / `nemo instruments international`, with `--json` output for downstream agent / scripted consumption.
69
+ - Inspect your portfolio — `nemo portfolio summary` returns each holding plus computed P&L and totals by classification.
70
+ - 1-year price history per local instrument — `nemo instruments prices --id <ID>` with stats (total return, σ, min/max) and an ASCII sparkline.
71
+ - Cash movements with classification — `nemo portfolio movements` parses each row into `dividend` / `buy` / `sell` / `commission` / `cash_in` / `cash_out` and aggregates by nemotécnico, ready for dividend-yield analysis.
72
+ - Pure-Python, type-hinted (`pyright` strict), tested (~98% line coverage), distributed via `pipx`.
73
+
74
+ ## Requirements
75
+
76
+ - Python **≥ 3.11**
77
+ - [`pipx`](https://pipx.pypa.io/) (recommended) or `pip`
78
+ - A Chilean stockbroker portal account (currently: Vector Capital)
79
+
80
+ ## Installation
81
+
82
+ The recommended path is [`pipx`](https://pipx.pypa.io/) so the `nemo` command is available in every terminal — isolated venv, automatic `$PATH` wiring, clean uninstall.
83
+
84
+ ### 1. Install `pipx` (one-time)
85
+
86
+ **macOS (Homebrew):**
87
+
88
+ ```bash
89
+ brew install pipx
90
+ pipx ensurepath
91
+ ```
92
+
93
+ **Any platform (with `pip`):**
94
+
95
+ ```bash
96
+ python3 -m pip install --user pipx
97
+ python3 -m pipx ensurepath
98
+ ```
99
+
100
+ After running `pipx ensurepath`, open a new terminal so the updated `$PATH` is picked up. Verify with `pipx --version`.
101
+
102
+ ### 2. Install nemo-cli
103
+
104
+ ```bash
105
+ git clone <repo-url> nemo-cli
106
+ cd nemo-cli
107
+ pipx install .
108
+ ```
109
+
110
+ To upgrade after pulling new changes:
111
+
112
+ ```bash
113
+ pipx install --force .
114
+ ```
115
+
116
+ To uninstall:
117
+
118
+ ```bash
119
+ pipx uninstall nemo-cli
120
+ ```
121
+
122
+ ## Configuration
123
+
124
+ Credentials are read from environment variables. The simplest way is a `.env` file at the project root (or your shell session):
125
+
126
+ ```bash
127
+ cp .env.example .env
128
+ # then edit .env with your credentials
129
+ ```
130
+
131
+ | Variable | Required | Description |
132
+ |--------------------|----------|---------------------------|
133
+ | `NEMO_USERNAME` | yes | Email used to sign in |
134
+ | `NEMO_PASSWORD` | yes | Account password |
135
+
136
+ > The Vector API base URL is intentionally hardcoded in `nemo_cli.config`. There is no env override; if you need one (e.g. for a staging environment), add an ADR first.
137
+
138
+ > The `.env` file is gitignored. Never commit real credentials.
139
+
140
+ The cached bearer token is stored under your OS user-config directory, e.g. `~/Library/Application Support/nemo-cli/token.json` on macOS. Run `nemo logout` to clear it.
141
+
142
+ ## Usage
143
+
144
+ ```bash
145
+ nemo login # authenticate and cache the token
146
+ nemo whoami # show the configured user and token state
147
+ nemo logout # drop the cached token
148
+ nemo instruments local --search BCI # list Chilean instruments matching "BCI"
149
+ nemo instruments international --search aapl --page-size 5
150
+ nemo instruments prices --id 52185 # 1-year price history (local instruments only)
151
+ nemo portfolio summary # holdings + P&L + totals by classification
152
+ nemo portfolio movements # default window: last 365 days
153
+ nemo portfolio movements --desde 2025-01-18 --hasta 2026-01-25 # explicit date range (YYYY-MM-DD)
154
+ nemo --version # print the CLI version and exit
155
+ nemo --help # general help
156
+ nemo <cmd> --help # per-command help
157
+ ```
158
+
159
+ ### Commands
160
+
161
+ | Command | Description |
162
+ |-------------------------------|----------------------------------------------------------------------------------|
163
+ | `login` | Authenticate against the configured broker portal and cache the bearer token. |
164
+ | `logout` | Clear the cached bearer token. |
165
+ | `whoami` | Show the configured user and whether a token is currently cached. |
166
+ | `instruments local` | List Chilean instruments. Filters: `--search`, `--classes`, `--page`, `--limit`. |
167
+ | `instruments international` | List US-listed assets. Filters: `--search`, `--exchange`, `--page`, `--page-size`. |
168
+ | `instruments prices` | Show ~1 year of daily prices for a local Chilean instrument (stats + sparkline). Flag: `--id`. **Local instruments only.** |
169
+ | `portfolio summary` | Show your holdings with P&L and totals by classification. Flags: `--account-id`, `--currency`, `--with-dividends/--no-dividends`. |
170
+ | `portfolio movements` | List cash movements over a date range, classified per kind (dividend / buy / sell / commission / cash flows) with per-nemotécnico aggregates. Flags: `--desde YYYY-MM-DD` (default: 1 year ago), `--hasta YYYY-MM-DD` (default: today), `--account-id`. |
171
+
172
+ All listing commands accept `--json` to emit a machine-readable payload
173
+ (`{ market, page, page_size, total, items: [...] }`) instead of a Rich table.
174
+ That payload is the integration contract for downstream tooling.
175
+
176
+ More commands will be added incrementally.
177
+
178
+ ## Development
179
+
180
+ For day-to-day development, install editable inside a virtual environment so changes are picked up immediately and tooling stays isolated from the rest of your system.
181
+
182
+ ### Create and activate the venv
183
+
184
+ ```bash
185
+ python3 -m venv .venv # create the venv (one time)
186
+ source .venv/bin/activate # activate it — macOS / Linux (bash, zsh)
187
+ # source .venv/bin/activate.fish # fish shell
188
+ # .venv\Scripts\Activate.ps1 # PowerShell on Windows
189
+ pip install --upgrade pip
190
+ pip install -e .[dev] # editable install with dev deps
191
+ ```
192
+
193
+ Your prompt will show `(.venv)` while the environment is active. Leave it with `deactivate`.
194
+
195
+ ### Day-to-day commands
196
+
197
+ ```bash
198
+ python -m nemo_cli <cmd> # run from source without installing the entry point
199
+ nemo <cmd> # the entry point also works (editable install wires it)
200
+ pyright # typecheck (strict, src/ only)
201
+ ruff check . # lint + import sort (src/ + tests/)
202
+ pytest # run the unit-test suite
203
+ pytest -k <name> # run a single test or pattern
204
+ ```
205
+
206
+ > If you only want a one-off run without polluting your shell, you can skip activation and call the binaries directly: `.venv/bin/nemo <cmd>`, `.venv/bin/pytest`, etc.
207
+
208
+ ### Testing
209
+
210
+ The unit-test suite mirrors the package tree under `tests/` and runs in well
211
+ under a second. No real network calls — `httpx` is intercepted at the
212
+ transport layer with [`respx`](https://github.com/lundberg/respx) — and no
213
+ real filesystem writes outside `tmp_path`.
214
+
215
+ ```bash
216
+ pytest # ~144 tests, ~98% line coverage
217
+ pytest tests/portfolio/ # one package
218
+ pytest tests/portfolio/test_summary.py # one file
219
+ pytest -k "compute_totals" # by name pattern
220
+ ```
221
+
222
+ What the suite covers:
223
+
224
+ - Pure parsers (`_to_*`) and aggregators (`_compute_*`, `_sparkline`) — 100%.
225
+ - HTTP services (`sign_in`, `api_request`, the four list / detail endpoints) — happy paths plus the 401-refresh-and-retry-once flow, mocked end-to-end with `respx`.
226
+ - CLI commands via `typer.testing.CliRunner` — table output, args passthrough, `--json` envelope shape, error paths exit `1`.
227
+
228
+ Conventions for adding tests live in
229
+ [`docs/CONVENTIONS.md`](docs/CONVENTIONS.md) (testing section). There is
230
+ **no CI/CD configured** at the moment — checks run locally before opening
231
+ a PR.
232
+
233
+ ## Project Structure
234
+
235
+ ```
236
+ .
237
+ ├── CLAUDE.md # Index of agent-facing context
238
+ ├── CHANGELOG.md # Keep a Changelog (see Versioning)
239
+ ├── context-first-development.md # CFD methodology
240
+ ├── pyproject.toml # Project metadata, deps, entry point
241
+ ├── docs/
242
+ │ ├── ARCHITECTURE.md
243
+ │ ├── STACK.md
244
+ │ ├── CONVENTIONS.md
245
+ │ └── decisions/ # Architecture Decision Records
246
+ ├── .claude/skills/ # CFD skills (start-session, status, new-decision, validate-context)
247
+ ├── src/nemo_cli/
248
+ │ ├── cli.py, __main__.py # Entry + Typer app
249
+ │ ├── commands/ # One module per subcommand (login, logout, whoami, instruments, portfolio)
250
+ │ ├── portfolio/ # Holdings service + P&L / totals computation
251
+ │ ├── instruments/ # Local + international market services + price history
252
+ │ ├── api/client.py # api_request — single point for portal HTTP
253
+ │ ├── auth/ # SignIn call and local token store
254
+ │ └── config.py # Env-var loader; hardcoded base URL
255
+ └── tests/ # Unit tests, mirror src/nemo_cli/ tree
256
+ ├── conftest.py # Shared fixtures (env, isolated token store)
257
+ ├── auth/, api/, instruments/, portfolio/, commands/
258
+ └── test_cli.py, test_config.py
259
+ ```
260
+
261
+ ## Versioning
262
+
263
+ This project follows [Semantic Versioning 2.0.0](https://semver.org/) and
264
+ maintains a [Keep a Changelog](https://keepachangelog.com/) — see
265
+ [`CHANGELOG.md`](CHANGELOG.md). The current version is the one declared in
266
+ `pyproject.toml` and mirrored in `nemo_cli.__version__`. The release process
267
+ is documented in [ADR-007](docs/decisions/007-versioning-and-changelog.md).
268
+
269
+ ## Methodology
270
+
271
+ This repository follows **Context-First Development (CFD)**. Architecture, conventions, and decisions live in [`docs/`](docs/); the methodology itself is documented in [`context-first-development.md`](context-first-development.md). When pairing with an AI agent, start with [`CLAUDE.md`](CLAUDE.md).
272
+
273
+ ### Starting a development session
274
+
275
+ The CFD session-start ritual loads project context without scanning source code — the agent orients itself in ~500 tokens instead of tens of thousands.
276
+
277
+ ```bash
278
+ # 1. Sync the working copy with the remote
279
+ git pull --ff-only
280
+
281
+ # 2. Glance at open work (optional, requires GitHub CLI)
282
+ gh pr list --state open
283
+ gh issue list
284
+
285
+ # 3. Start Claude Code from the repo root
286
+ claude
287
+
288
+ # 4. Inside the session, run the orientation skill
289
+ > /start-session
290
+ ```
291
+
292
+ `/start-session` reads `docs/CURRENT_STATUS.md` (a local-only file — see "Closing a session" below) and [`docs/decisions/_index.md`](docs/decisions/_index.md), and returns a short summary of what was in flight, what is blocked, and what the next priority should be. The other CFD skills shipped in [`.claude/skills/`](.claude/skills/):
293
+
294
+ | Skill | When to use |
295
+ |----------------------|--------------------------------------------------------------------------------------------|
296
+ | `/start-session` | At the start of every session — load current status + recent decisions. |
297
+ | `/status` | Quick "where are we" without the full orientation. |
298
+ | `/new-decision` | Before implementing any significant technical choice — captures it as an ADR. |
299
+ | `/validate-context` | Audit context-file integrity (CLAUDE.md size, @-references, ADR index, status freshness). |
300
+
301
+ ### Closing a session
302
+
303
+ Before ending, ask the agent to create or update `docs/CURRENT_STATUS.md` with what was done, what is still pending, and any blockers discovered. That file is the only thing the next session reads to know where work was left — skipping it breaks the loop.
304
+
305
+ `docs/CURRENT_STATUS.md` is **gitignored on purpose** — it is working state, not a shared artifact, so each clone keeps its own notes. The file does not exist in a fresh clone; the first `/start-session` after `git clone` will simply have less context to summarise, and you create the file when you close the session.
306
+
307
+ ## Security
308
+
309
+ - Credentials never touch disk through this CLI. They are read from `os.environ` at command time.
310
+ - Only the bearer token is persisted, in a per-user JSON file under your OS config directory.
311
+ - Run `nemo logout` (or delete the JSON file) to revoke the local session at any time.
@@ -0,0 +1,28 @@
1
+ nemo_cli/__init__.py,sha256=sXLh7g3KC4QCFxcZGBTpG2scR7hmmBsMjq6LqRptkRg,22
2
+ nemo_cli/__main__.py,sha256=faQsEifImPpBQreJnb0mhSDN8T-so8HAWMDP699LA34,69
3
+ nemo_cli/cli.py,sha256=C_S_ScRQcOX7XDq5JvrSljz1kRmYjuQCWFUJdBa1i0E,1121
4
+ nemo_cli/config.py,sha256=FqesRSkFMKHbu9DlkJHj208_YijEl_4AR_QJxFm-vm4,619
5
+ nemo_cli/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ nemo_cli/api/client.py,sha256=KaqRc1-iZ7F9RTqw6c93kkZ2zRIXhgXLpmu-62jyijo,2396
7
+ nemo_cli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ nemo_cli/auth/jwt.py,sha256=wVPAmYT2bY1-nKYQuMGK7pIXNXPWtfZy7XJiPOkEhK4,1431
9
+ nemo_cli/auth/service.py,sha256=mT5d9h_r9c2ZGUve1Mho27KXjR7oSXckBOv13p_R3HI,1913
10
+ nemo_cli/auth/token_store.py,sha256=gH16JsgKm6mFlAyo4iAWxSoeQfOr_9xnAjTHTnh_5Rk,894
11
+ nemo_cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ nemo_cli/commands/instruments.py,sha256=XDghst2HdpKnPjxbnfOAJflzpkfpSNI7670FE_C3WxE,8962
13
+ nemo_cli/commands/login.py,sha256=By9WYa0-PueumQOMtxie56oECNfkYaUXKWy7AhnwPqw,484
14
+ nemo_cli/commands/logout.py,sha256=nKinYDXq8RRhkRGtD78OGznNqA1BSHjXK-dQ4kUMNtM,231
15
+ nemo_cli/commands/portfolio.py,sha256=8FLRZ3y5MmSTLfH0nfRZn7HnuvKO50gWHve-RaNzHsY,9643
16
+ nemo_cli/commands/whoami.py,sha256=D68d-c-lVI48vWMv9Bn-6Wjd4Eu7X5c0pTgb0y06qqs,625
17
+ nemo_cli/instruments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ nemo_cli/instruments/international.py,sha256=t39ppONAfogw1LWQpaLc1n9bchppM6m8sSPK_lHOoVk,2976
19
+ nemo_cli/instruments/local.py,sha256=VGAkU_XAH9D8Bf1yE1dYVpebJZ3MrvDgI55hdtxzpLM,2875
20
+ nemo_cli/instruments/prices.py,sha256=n8FCPtdcVVYzgQckgW0gfWBc6Pw76gA8bHYoaoraIj0,3652
21
+ nemo_cli/portfolio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ nemo_cli/portfolio/movements.py,sha256=JV8tUETfkssmlFM3cG_4u5GXpGy-IpFs5AqWddnNX5I,9563
23
+ nemo_cli/portfolio/summary.py,sha256=UQmN_48AG4t-ylI6lBX0vW7pXg8lRolIuos7hfCBb0w,5446
24
+ nemo_cli-0.0.1.dist-info/METADATA,sha256=3lIY8Thd5egyV1L3yxOqFoWaEzOMXBRZ1FcntOWnvtQ,16210
25
+ nemo_cli-0.0.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
26
+ nemo_cli-0.0.1.dist-info/entry_points.txt,sha256=6CgvxpKdqPj9rbAfvoLkxm0VaQ5LrOspLPGA6URCt50,43
27
+ nemo_cli-0.0.1.dist-info/licenses/LICENSE,sha256=7EWQIdGWtI4AHWe7fxmjuepc8W195aWDzGbIM3uAs5k,1082
28
+ nemo_cli-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ nemo = nemo_cli.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alberto Marturelo Lorenzo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.