nexusquant-cli 0.2.1__tar.gz → 0.4.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.
- nexusquant_cli-0.4.0/CLAUDE.md +59 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/PKG-INFO +111 -5
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/README.md +107 -3
- nexusquant_cli-0.4.0/docs/investor-operations.md +60 -0
- nexusquant_cli-0.4.0/nexusquant_cli/__init__.py +1 -0
- nexusquant_cli-0.4.0/nexusquant_cli/api_client.py +409 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/auth_pkce.py +2 -2
- nexusquant_cli-0.4.0/nexusquant_cli/commands/__init__.py +16 -0
- nexusquant_cli-0.4.0/nexusquant_cli/commands/_util.py +61 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/config.py +16 -0
- nexusquant_cli-0.4.0/nexusquant_cli/embedded.py +118 -0
- nexusquant_cli-0.4.0/nexusquant_cli/identity.py +59 -0
- nexusquant_cli-0.4.0/nexusquant_cli/nexus.py +48 -0
- nexusquant_cli-0.4.0/nexusquant_cli/roles/__init__.py +0 -0
- nexusquant_cli-0.4.0/nexusquant_cli/roles/_agent.py +193 -0
- nexusquant_cli-0.4.0/nexusquant_cli/roles/admin.py +272 -0
- nexusquant_cli-0.4.0/nexusquant_cli/roles/auth.py +91 -0
- nexusquant_cli-0.4.0/nexusquant_cli/roles/investor.py +849 -0
- nexusquant_cli-0.4.0/nexusquant_cli/roles/provider.py +141 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/pyproject.toml +6 -2
- nexusquant_cli-0.4.0/tests/__init__.py +0 -0
- nexusquant_cli-0.4.0/tests/test_nexus_cli.py +643 -0
- nexusquant_cli-0.4.0/uv.lock +345 -0
- nexusquant_cli-0.2.1/CLAUDE.md +0 -66
- nexusquant_cli-0.2.1/nexusquant_cli/__init__.py +0 -1
- nexusquant_cli-0.2.1/nexusquant_cli/api_client.py +0 -83
- nexusquant_cli-0.2.1/nexusquant_cli/commands/__init__.py +0 -13
- nexusquant_cli-0.2.1/nexusquant_cli/commands/_util.py +0 -36
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/.gitignore +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/__main__.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/commands/auth/__init__.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/commands/auth/cmd.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/commands/policy/__init__.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/commands/policy/cmd.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/commands/strategy/__init__.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/commands/strategy/cmd.py +0 -0
- {nexusquant_cli-0.2.1 → nexusquant_cli-0.4.0}/nexusquant_cli/main.py +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# nexusquant-cli
|
|
2
|
+
|
|
3
|
+
Python CLI for NexusQuant users, strategy providers and admins. Cognito PKCE browser login, token storage/refresh, and wrappers over the nexus-service REST API.
|
|
4
|
+
|
|
5
|
+
Two entry points, one login (credentials shared with nexusquant-sdk under `platformdirs/nexusquant-sdk/credentials.json`):
|
|
6
|
+
|
|
7
|
+
- `nexus-cli` (`nexusquant_cli/nexus.py`) — `nexus-cli <role> <verb> <resource>`; roles `investor` / `provider` / `admin`, plus `auth`.
|
|
8
|
+
- `nexusquant` (`nexusquant_cli/main.py`) — legacy flat provider layout. Keep it working: scheduled tasks and the nexus-admin webhook-adapter skill call it, and `webhook_admin.py` imports `nexusquant_cli.api_client`, `config` and `auth_pkce.ensure_fresh_id_token` directly.
|
|
9
|
+
|
|
10
|
+
## Code structure
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
nexusquant_cli/
|
|
14
|
+
nexus.py # nexus-cli entry (role groups)
|
|
15
|
+
main.py # legacy nexusquant entry
|
|
16
|
+
roles/ # auth / investor / provider / admin — verb-first sub-apps
|
|
17
|
+
# provider.py mounts the functions from commands/ rather than copying them
|
|
18
|
+
commands/ # legacy command bodies (auth, strategy, policy) + _util (fail / JSON helpers)
|
|
19
|
+
api_client.py # HTTP wrapper; ApiError; retries once on stale-Wall-Pro 403
|
|
20
|
+
identity.py # decode local ID token for whoami / 403 hints (display only, never gates)
|
|
21
|
+
auth_pkce.py # Cognito PKCE flow
|
|
22
|
+
config.py # endpoints, credential path
|
|
23
|
+
docs/investor-operations.md # investor API surface survey + phase-2 roadmap
|
|
24
|
+
tests/ # pytest, httpx.MockTransport — no network
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Tests: `pip install -e '.[dev]' && python -m pytest -q tests`.
|
|
28
|
+
|
|
29
|
+
Investor commands deliberately exclude anything that arms auto-trading, changes sizing, or touches broker secrets — see docs/investor-operations.md before adding those.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Development (editable)
|
|
35
|
+
pip install -e .
|
|
36
|
+
|
|
37
|
+
# From PyPI
|
|
38
|
+
pip install nexusquant-cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
See README.md.
|
|
44
|
+
|
|
45
|
+
## Deploy / publish
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Build distribution
|
|
49
|
+
python -m build
|
|
50
|
+
|
|
51
|
+
# Publish to PyPI
|
|
52
|
+
twine upload dist/*
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
API base URL is set in `nexusquant_cli/config.py`. Change `API_BASE_URL` to point at a different environment (staging vs production).
|
|
58
|
+
|
|
59
|
+
Provider commands need `custom:userType=strategyProvider` or admin; admin commands need admin (or the `admin` Cognito group). User commands work for any login; some need Wall Pro.
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: nexusquant-cli
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: NexusQuant strategy
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: NexusQuant CLI for users, strategy providers and admins
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: httpx>=0.27
|
|
7
7
|
Requires-Dist: nexusquant-sdk>=0.2
|
|
8
8
|
Requires-Dist: platformdirs>=4.2
|
|
9
9
|
Requires-Dist: rich>=13.7
|
|
10
10
|
Requires-Dist: typer>=0.12
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
11
13
|
Description-Content-Type: text/markdown
|
|
12
14
|
|
|
13
15
|
# nexusquant-cli
|
|
14
16
|
|
|
15
|
-
Command line tool for NexusQuant strategy providers.
|
|
17
|
+
Command line tool for NexusQuant investors, strategy providers and admins.
|
|
16
18
|
|
|
17
|
-
It supports browser login through Cognito, stores tokens locally, refreshes tokens, and calls the Nexus
|
|
19
|
+
It supports browser login through Cognito, stores tokens locally, refreshes tokens, and calls the Nexus APIs. Two entry points share one login:
|
|
20
|
+
|
|
21
|
+
- **`nexus-cli`** — role-first grammar, `nexus-cli <role> <verb> <resource> [args]`. Use this.
|
|
22
|
+
- `nexusquant` — the original flat provider layout (`nexusquant strategy|policy …`), kept unchanged for existing scripts. Everything below the `nexus-cli` section documents it.
|
|
18
23
|
|
|
19
24
|
## Install
|
|
20
25
|
|
|
@@ -26,7 +31,108 @@ python3 -m pip install -e .
|
|
|
26
31
|
pip install nexusquant-cli
|
|
27
32
|
```
|
|
28
33
|
|
|
29
|
-
##
|
|
34
|
+
## nexus-cli
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
nexus-cli auth login # browser login; one login covers every role
|
|
38
|
+
nexus-cli auth whoami # account, userType, Wall Pro tier, usable roles
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The role is not picked at login — it is the account's `custom:userType` (or the `admin` Cognito group), and the server checks it on every call. `whoami` reads it from the local token; on a 403 the CLI prints which account type is logged in.
|
|
42
|
+
|
|
43
|
+
Every read takes `--json` for scripting; the default output is a table.
|
|
44
|
+
|
|
45
|
+
### investor — any logged-in account
|
|
46
|
+
|
|
47
|
+
| Command | What it does |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `investor list strategies [--subscribed]` | Marketplace, with backtest summary and a flag for strategies whose sizing reads your holdings |
|
|
50
|
+
| `investor read strategy <id>` | Detail + 30 most recent signals |
|
|
51
|
+
| `investor read backtest <id>` | Backtest stats, rolling returns, per-ticker attribution, return since you added it |
|
|
52
|
+
| `investor subscribe strategy <id>...` | Add to My Strategies (Wall Pro). **Does not start auto-trading** |
|
|
53
|
+
| `investor unsubscribe strategy <id> [-y]` | Remove from My Strategies; asks first, and warns if it is listening (this stops auto-trading) |
|
|
54
|
+
| `investor list subscriptions` | My Strategies: listening on/off, config saved, broker |
|
|
55
|
+
| `investor read config <id>` | Your personal config, effective config, and the schema of what you can set |
|
|
56
|
+
| `investor list signals [--strategy-id --status --direction --limit --offset]` | Signals that reached you, with your own broker result for each |
|
|
57
|
+
| `investor read stats` | Signal counts and broker success rate |
|
|
58
|
+
| `investor read profile` / `investor read settings` | Account; daily-report setting |
|
|
59
|
+
| `investor update settings --daily-report/--no-daily-report` | Toggle the daily report email |
|
|
60
|
+
| `investor read container` | Trading environment state, broker login, selected account |
|
|
61
|
+
| `investor list brokers` | Supported brokers and their login fields |
|
|
62
|
+
| `investor list activity` | Your own activity log |
|
|
63
|
+
|
|
64
|
+
#### Nexus AI agent — permissions and logs
|
|
65
|
+
|
|
66
|
+
Nexus AI is the agent you chat with in the web app. Commands for the agent are under `investor`, and you can only **narrow** what it may do. The ceiling comes from your profile and is enforced on the agent host.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
nexus-cli investor read agent-access # enabled?, profile, tools, extra denied tools
|
|
70
|
+
nexus-cli investor update agent-access --profile readonly # investor | readonly (admins: operator) | default
|
|
71
|
+
nexus-cli investor update agent-access --deny-tool Write --deny-tool Edit
|
|
72
|
+
nexus-cli investor update agent-access --clear-deny
|
|
73
|
+
nexus-cli investor list agent-sessions # past conversations: title, turns, tool calls, denials, cost
|
|
74
|
+
nexus-cli investor read agent-session ws-… # the full conversation, as it happened
|
|
75
|
+
nexus-cli investor delete agent-session ws-… # remove it from your history (soft delete)
|
|
76
|
+
nexus-cli investor list agent-logs --denied # every refused tool call
|
|
77
|
+
nexus-cli investor list agent-logs --session ws-… --event tool_executed
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Profile | Tools | Files |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| `investor` | Read, Glob, Grep, Write, Edit, MultiEdit, TodoWrite, WebSearch. No shell, no sub-agents, no WebFetch | Only your own workspace |
|
|
83
|
+
| `readonly` | `investor` without the write tools | Only your own workspace |
|
|
84
|
+
| `operator` (admins only) | Everything | The whole agent workspace |
|
|
85
|
+
|
|
86
|
+
- Conversations are kept permanently so you can read your history. Deleting one hides it from you; the platform keeps a copy, and admins can still see it.
|
|
87
|
+
- Audit entries (the per-tool-call log) are kept for 90 days.
|
|
88
|
+
- Changes apply to sessions opened afterwards.
|
|
89
|
+
- Every tool call is logged: which tool, a summary of its input, and whether it was auto-allowed, approved by you, or refused. Refusals record who refused it: the profile, you, or a timeout.
|
|
90
|
+
- Each turn also logs its cost.
|
|
91
|
+
|
|
92
|
+
Not in the CLI yet, on purpose: switching listening on (arms auto-trading), editing sizing config, broker connect, container start/stop/reset, and webhook strategies. They place real orders or carry broker secrets and need their own confirmation / secret-handling design — see `docs/investor-operations.md`.
|
|
93
|
+
|
|
94
|
+
### provider — `custom:userType=strategyProvider` or admin
|
|
95
|
+
|
|
96
|
+
| Command | Same as legacy |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `provider create strategy -i ID -n NAME [--schema-file …]` | `nexusquant strategy create` |
|
|
99
|
+
| `provider list strategies` | `nexusquant strategy list` |
|
|
100
|
+
| `provider list signals <id> [--limit --offset --status --direction]` | `nexusquant strategy signal <id> --history` |
|
|
101
|
+
| `provider send signal <id> --ticker … --direction … --price … --quantity …` / `--signals-file` | `nexusquant strategy signal <id> --ticker …` |
|
|
102
|
+
| `provider list subscribers <id>` | `nexusquant strategy sub config <id>` |
|
|
103
|
+
| `provider list features [--scope --json]` | `nexusquant policy features` |
|
|
104
|
+
| `provider publish policy --strategy-id … --ticker … --file …` | `nexusquant policy publish` |
|
|
105
|
+
| `provider list policies <id>` | `nexusquant policy list` |
|
|
106
|
+
| `provider update policy --policy-id … --mode off` | `nexusquant policy set-mode` |
|
|
107
|
+
| `provider send policy-signal …` | `nexusquant policy send-signal` |
|
|
108
|
+
|
|
109
|
+
Options are identical to the legacy commands documented below. One difference: `provider send signal` with no send fields is an error, where the legacy `strategy signal` silently listed history.
|
|
110
|
+
|
|
111
|
+
### admin — `custom:userType=admin`
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
nexus-cli admin list reviews [--status all] [--verbose]
|
|
115
|
+
nexus-cli admin review strategy <id> --action approve|reject|suspend [--note …]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
nexus-cli admin list agent-access # who besides admins may use Nexus AI
|
|
120
|
+
nexus-cli admin grant agent-access --email someone@x.com
|
|
121
|
+
nexus-cli admin revoke agent-access --email someone@x.com
|
|
122
|
+
nexus-cli admin list agent-sessions [--email … | --user-id …] [--include-deleted]
|
|
123
|
+
nexus-cli admin read agent-session ws-… # any user's conversation; each read goes into your admin activity log
|
|
124
|
+
nexus-cli admin list agent-logs --email someone@x.com --denied
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
How grant and revoke take effect:
|
|
128
|
+
- Granting adds the user to the `NEXUS_AI_USERS` flag. Non-admins can only connect once the backend's `NEXUS_AI_BRIDGE_POLICY` is also on.
|
|
129
|
+
- Revoking refuses new connections within about 30 seconds. A session that is already open closes at its next token renewal; the web app renews every 20 minutes.
|
|
130
|
+
|
|
131
|
+
Agent ops (weekly analysis uploads, S3 reads, Discord KB, notify) stay in `nexus-agent` (nexus-agent-cli) for now.
|
|
132
|
+
|
|
133
|
+
## Legacy `nexusquant` commands
|
|
134
|
+
|
|
135
|
+
### Login
|
|
30
136
|
|
|
31
137
|
```bash
|
|
32
138
|
nexusquant auth
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# nexusquant-cli
|
|
2
2
|
|
|
3
|
-
Command line tool for NexusQuant strategy providers.
|
|
3
|
+
Command line tool for NexusQuant investors, strategy providers and admins.
|
|
4
4
|
|
|
5
|
-
It supports browser login through Cognito, stores tokens locally, refreshes tokens, and calls the Nexus
|
|
5
|
+
It supports browser login through Cognito, stores tokens locally, refreshes tokens, and calls the Nexus APIs. Two entry points share one login:
|
|
6
|
+
|
|
7
|
+
- **`nexus-cli`** — role-first grammar, `nexus-cli <role> <verb> <resource> [args]`. Use this.
|
|
8
|
+
- `nexusquant` — the original flat provider layout (`nexusquant strategy|policy …`), kept unchanged for existing scripts. Everything below the `nexus-cli` section documents it.
|
|
6
9
|
|
|
7
10
|
## Install
|
|
8
11
|
|
|
@@ -14,7 +17,108 @@ python3 -m pip install -e .
|
|
|
14
17
|
pip install nexusquant-cli
|
|
15
18
|
```
|
|
16
19
|
|
|
17
|
-
##
|
|
20
|
+
## nexus-cli
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
nexus-cli auth login # browser login; one login covers every role
|
|
24
|
+
nexus-cli auth whoami # account, userType, Wall Pro tier, usable roles
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The role is not picked at login — it is the account's `custom:userType` (or the `admin` Cognito group), and the server checks it on every call. `whoami` reads it from the local token; on a 403 the CLI prints which account type is logged in.
|
|
28
|
+
|
|
29
|
+
Every read takes `--json` for scripting; the default output is a table.
|
|
30
|
+
|
|
31
|
+
### investor — any logged-in account
|
|
32
|
+
|
|
33
|
+
| Command | What it does |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `investor list strategies [--subscribed]` | Marketplace, with backtest summary and a flag for strategies whose sizing reads your holdings |
|
|
36
|
+
| `investor read strategy <id>` | Detail + 30 most recent signals |
|
|
37
|
+
| `investor read backtest <id>` | Backtest stats, rolling returns, per-ticker attribution, return since you added it |
|
|
38
|
+
| `investor subscribe strategy <id>...` | Add to My Strategies (Wall Pro). **Does not start auto-trading** |
|
|
39
|
+
| `investor unsubscribe strategy <id> [-y]` | Remove from My Strategies; asks first, and warns if it is listening (this stops auto-trading) |
|
|
40
|
+
| `investor list subscriptions` | My Strategies: listening on/off, config saved, broker |
|
|
41
|
+
| `investor read config <id>` | Your personal config, effective config, and the schema of what you can set |
|
|
42
|
+
| `investor list signals [--strategy-id --status --direction --limit --offset]` | Signals that reached you, with your own broker result for each |
|
|
43
|
+
| `investor read stats` | Signal counts and broker success rate |
|
|
44
|
+
| `investor read profile` / `investor read settings` | Account; daily-report setting |
|
|
45
|
+
| `investor update settings --daily-report/--no-daily-report` | Toggle the daily report email |
|
|
46
|
+
| `investor read container` | Trading environment state, broker login, selected account |
|
|
47
|
+
| `investor list brokers` | Supported brokers and their login fields |
|
|
48
|
+
| `investor list activity` | Your own activity log |
|
|
49
|
+
|
|
50
|
+
#### Nexus AI agent — permissions and logs
|
|
51
|
+
|
|
52
|
+
Nexus AI is the agent you chat with in the web app. Commands for the agent are under `investor`, and you can only **narrow** what it may do. The ceiling comes from your profile and is enforced on the agent host.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
nexus-cli investor read agent-access # enabled?, profile, tools, extra denied tools
|
|
56
|
+
nexus-cli investor update agent-access --profile readonly # investor | readonly (admins: operator) | default
|
|
57
|
+
nexus-cli investor update agent-access --deny-tool Write --deny-tool Edit
|
|
58
|
+
nexus-cli investor update agent-access --clear-deny
|
|
59
|
+
nexus-cli investor list agent-sessions # past conversations: title, turns, tool calls, denials, cost
|
|
60
|
+
nexus-cli investor read agent-session ws-… # the full conversation, as it happened
|
|
61
|
+
nexus-cli investor delete agent-session ws-… # remove it from your history (soft delete)
|
|
62
|
+
nexus-cli investor list agent-logs --denied # every refused tool call
|
|
63
|
+
nexus-cli investor list agent-logs --session ws-… --event tool_executed
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| Profile | Tools | Files |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `investor` | Read, Glob, Grep, Write, Edit, MultiEdit, TodoWrite, WebSearch. No shell, no sub-agents, no WebFetch | Only your own workspace |
|
|
69
|
+
| `readonly` | `investor` without the write tools | Only your own workspace |
|
|
70
|
+
| `operator` (admins only) | Everything | The whole agent workspace |
|
|
71
|
+
|
|
72
|
+
- Conversations are kept permanently so you can read your history. Deleting one hides it from you; the platform keeps a copy, and admins can still see it.
|
|
73
|
+
- Audit entries (the per-tool-call log) are kept for 90 days.
|
|
74
|
+
- Changes apply to sessions opened afterwards.
|
|
75
|
+
- Every tool call is logged: which tool, a summary of its input, and whether it was auto-allowed, approved by you, or refused. Refusals record who refused it: the profile, you, or a timeout.
|
|
76
|
+
- Each turn also logs its cost.
|
|
77
|
+
|
|
78
|
+
Not in the CLI yet, on purpose: switching listening on (arms auto-trading), editing sizing config, broker connect, container start/stop/reset, and webhook strategies. They place real orders or carry broker secrets and need their own confirmation / secret-handling design — see `docs/investor-operations.md`.
|
|
79
|
+
|
|
80
|
+
### provider — `custom:userType=strategyProvider` or admin
|
|
81
|
+
|
|
82
|
+
| Command | Same as legacy |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `provider create strategy -i ID -n NAME [--schema-file …]` | `nexusquant strategy create` |
|
|
85
|
+
| `provider list strategies` | `nexusquant strategy list` |
|
|
86
|
+
| `provider list signals <id> [--limit --offset --status --direction]` | `nexusquant strategy signal <id> --history` |
|
|
87
|
+
| `provider send signal <id> --ticker … --direction … --price … --quantity …` / `--signals-file` | `nexusquant strategy signal <id> --ticker …` |
|
|
88
|
+
| `provider list subscribers <id>` | `nexusquant strategy sub config <id>` |
|
|
89
|
+
| `provider list features [--scope --json]` | `nexusquant policy features` |
|
|
90
|
+
| `provider publish policy --strategy-id … --ticker … --file …` | `nexusquant policy publish` |
|
|
91
|
+
| `provider list policies <id>` | `nexusquant policy list` |
|
|
92
|
+
| `provider update policy --policy-id … --mode off` | `nexusquant policy set-mode` |
|
|
93
|
+
| `provider send policy-signal …` | `nexusquant policy send-signal` |
|
|
94
|
+
|
|
95
|
+
Options are identical to the legacy commands documented below. One difference: `provider send signal` with no send fields is an error, where the legacy `strategy signal` silently listed history.
|
|
96
|
+
|
|
97
|
+
### admin — `custom:userType=admin`
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
nexus-cli admin list reviews [--status all] [--verbose]
|
|
101
|
+
nexus-cli admin review strategy <id> --action approve|reject|suspend [--note …]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
nexus-cli admin list agent-access # who besides admins may use Nexus AI
|
|
106
|
+
nexus-cli admin grant agent-access --email someone@x.com
|
|
107
|
+
nexus-cli admin revoke agent-access --email someone@x.com
|
|
108
|
+
nexus-cli admin list agent-sessions [--email … | --user-id …] [--include-deleted]
|
|
109
|
+
nexus-cli admin read agent-session ws-… # any user's conversation; each read goes into your admin activity log
|
|
110
|
+
nexus-cli admin list agent-logs --email someone@x.com --denied
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
How grant and revoke take effect:
|
|
114
|
+
- Granting adds the user to the `NEXUS_AI_USERS` flag. Non-admins can only connect once the backend's `NEXUS_AI_BRIDGE_POLICY` is also on.
|
|
115
|
+
- Revoking refuses new connections within about 30 seconds. A session that is already open closes at its next token renewal; the web app renews every 20 minutes.
|
|
116
|
+
|
|
117
|
+
Agent ops (weekly analysis uploads, S3 reads, Discord KB, notify) stay in `nexus-agent` (nexus-agent-cli) for now.
|
|
118
|
+
|
|
119
|
+
## Legacy `nexusquant` commands
|
|
120
|
+
|
|
121
|
+
### Login
|
|
18
122
|
|
|
19
123
|
```bash
|
|
20
124
|
nexusquant auth
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# What a normal user can do — API surface and CLI roadmap
|
|
2
|
+
|
|
3
|
+
Surveyed 2026-10-07 against nexus-service `58f1d16` and nexus-frontend-platform.
|
|
4
|
+
"User" = any Cognito login that is neither `strategyProvider` nor `admin`.
|
|
5
|
+
Paths are under `/api`.
|
|
6
|
+
|
|
7
|
+
**Auth.** Send the **ID token** (Bearer). An access token alone authenticates, but
|
|
8
|
+
carries no `custom:access*` claims, so every Wall Pro endpoint 403s. The backend
|
|
9
|
+
reads `custom:userType`, falling back to the `admin` Cognito group.
|
|
10
|
+
|
|
11
|
+
**Wall Pro.** Wall Pro requires `custom:accessStatus=active` plus `custom:accessLevel=pro` in the ID token. Admins bypass the check.
|
|
12
|
+
|
|
13
|
+
A token minted before an upgrade fails until it is refreshed. The web app and `nexus-cli` both handle this the same way: on a 403 that mentions "Wall Pro", they force a refresh and retry once.
|
|
14
|
+
|
|
15
|
+
## Phase 1 — in `nexus-cli investor` now
|
|
16
|
+
|
|
17
|
+
| Command | Endpoint | Tier |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| list strategies | GET `strategy/market/` | login |
|
|
20
|
+
| list strategies --subscribed | GET `strategy/market/subscribed/` | login |
|
|
21
|
+
| read strategy | GET `strategy/market/<id>/` | login |
|
|
22
|
+
| read backtest | GET `strategy/market/<id>/backtest/` | login (private: owner/admin) |
|
|
23
|
+
| subscribe strategy | POST `strategy/market/checkout/` `{strategy_ids}` | Pro |
|
|
24
|
+
| unsubscribe strategy | POST `strategy/unsubscribe/<id>/` | login |
|
|
25
|
+
| list subscriptions | GET `user/strategy/list/` | login |
|
|
26
|
+
| read config | GET `user/strategy/list/` (one row) | login |
|
|
27
|
+
| list signals | GET `strategy-signal/logs/` | login |
|
|
28
|
+
| read stats | GET `strategy-signal/statistics/` | login |
|
|
29
|
+
| read profile | GET `auth/profile/` | login |
|
|
30
|
+
| read / update settings | GET / PUT `user/settings/` `{receive_daily_report}` | login |
|
|
31
|
+
| read container | GET `user/container/health/` + `container/<cid>/status/` | login |
|
|
32
|
+
| list brokers | GET `container/brokers/` | public |
|
|
33
|
+
| list activity | GET `user/activity-logs/?mine=true` | login |
|
|
34
|
+
|
|
35
|
+
Use the `strategy/market/*` endpoints, never `strategy/list|detail|subscribe/`. The latter filter by status only and skip `is_listed` and visibility.
|
|
36
|
+
|
|
37
|
+
## Phase 2 — candidates, highest risk first
|
|
38
|
+
|
|
39
|
+
| Operation | Endpoint | Risk / design needed |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| Listening on (arms auto-trading) | POST `user/strategy/subscribe/<id>/` (Pro) | **Real orders follow.** Needs a saved config (400 `needs_config_acknowledgement`); webhook strategies return 409 `WEBHOOK_PRECONDITION`. Show the effective config and broker account, then require typed confirmation. |
|
|
42
|
+
| Listening off | POST `user/strategy/unsubscribe/<id>/` | Disarms. Returns 503 and leaves state unchanged if Redis fails. |
|
|
43
|
+
| Save sizing config | PUT/PATCH `user/strategy/config/<id>/` `{personal_config}` or `{strategy_params, execution}` | Changes order size. **Any save after the first turns listening off** — say so. Validate against `strategy_schema` + `enabled_execution_keys` locally first. |
|
|
44
|
+
| Broker connect wizard | POST `container/<cid>/connect/` `{step, broker_id, broker_credentials}` | Secrets: moomoo/futu password (the frontend MD5-hashes it, then RSA-encrypts it with the key from `user/kms/public-key/`); tiger private key; webull and schwab app_secret; ibkr password. Prompt for secrets and never take them from argv. Prompts can be built from the catalog's `login_fields`. Schwab uses OAuth: `oauth_start` → paste the redirect URL → `oauth_callback`. |
|
|
45
|
+
| Trading PIN | POST `container/<cid>/unlock_trade/` `{trading_password}` | Secret; prompt only. |
|
|
46
|
+
| Container start / restart / stop | POST `user/container/start/` (Pro), `container/<cid>/restart/` `{"mode":"in_place"}`, `user/container/stop/` | Stop returns 409 while the broker is connected. |
|
|
47
|
+
| Container reset | POST `container/<cid>/reset/` | **Destructive:** wipes stored broker credentials. Typed confirmation. |
|
|
48
|
+
| Broker health | GET `container/<cid>/broker_token_status/`, POST `…/ping/`, GET/POST `…/broker-disconnect-notice/[ack/]` | Read-mostly; low risk. Good next step. |
|
|
49
|
+
| Webhook strategies (`wh_…`) | `webhook-strategies/` CRUD, `samples/`, `submit/`, `acknowledge/`, `rotate-secret/`, `deliveries/` (Pro + `WEBHOOK_STRATEGIES` flag) | Create and rotate return the secret once; print it once and never log it. |
|
|
50
|
+
| Pro research reads | GET `nexus-agent/backtest|market-analysis/?ticker=`, `portfolio-recommendation/`, `wall-bot/triggers|price|nav/` | Read-only, Pro. Easy. |
|
|
51
|
+
| Research jobs / KB files | `research/analysis-jobs/*`, `research/kb-files/*` | `run` spends platform LLM budget. |
|
|
52
|
+
| Docs | GET `docs/nav/`, `docs/articles/<slug>/`, `docs/search/?q=` | Read-only. |
|
|
53
|
+
|
|
54
|
+
## Do not wrap
|
|
55
|
+
|
|
56
|
+
- **Stubs or mock data:** `user/opend/*` (fake stubs; `login` writes the verification code into the activity log) and `user/cognito/<sub>/strategies/` (mock).
|
|
57
|
+
- **Legacy / dead:** `signal/*`. Its table is empty in prod, and `signal/<id>/retry/` has no ownership check.
|
|
58
|
+
- **Too broad:** `logs/strategy/` exposes platform-wide logs, and `logs/filter-options/` lists every username. These are backend issues, not CLI material.
|
|
59
|
+
- **Superseded:** the old DDD `container/list|detail|start|stop|delete`. The frontend uses the endpoints listed above instead.
|
|
60
|
+
- **Billing:** there is none in nexus-service (`apps/subscriptions` is not routed). The tier lives on Cognito attributes, and the CLI can only report it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.0"
|