@quantbrasil/cli 0.1.0-beta.1 → 0.1.0-beta.10
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.
- package/README.md +63 -11
- package/dist/cli/client.js +4 -0
- package/dist/cli/index.d.ts +12 -4
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +64 -14
- package/dist/cli/prompt.d.ts +1 -0
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +17 -0
- package/dist/cli/skills.d.ts +9 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +68 -4
- package/dist/commands/auth.d.ts +18 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +49 -0
- package/dist/commands/market.d.ts +1 -0
- package/dist/commands/market.d.ts.map +1 -1
- package/dist/commands/market.js +17 -1
- package/dist/commands/portfolios.d.ts +148 -8
- package/dist/commands/portfolios.d.ts.map +1 -1
- package/dist/commands/portfolios.js +557 -55
- package/dist/commands/rankings.d.ts +82 -0
- package/dist/commands/rankings.d.ts.map +1 -0
- package/dist/commands/rankings.js +235 -0
- package/dist/commands/screening.d.ts +120 -0
- package/dist/commands/screening.d.ts.map +1 -0
- package/dist/commands/screening.js +361 -0
- package/dist/commands/skills.js +7 -7
- package/dist/commands/update.d.ts +23 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +209 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/vendor/core/capabilities/index.d.ts +2 -1
- package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/index.js +2 -1
- package/dist/vendor/core/capabilities/market.d.ts +9 -1
- package/dist/vendor/core/capabilities/market.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/market.js +10 -0
- package/dist/vendor/core/capabilities/portfolios.d.ts +452 -56
- package/dist/vendor/core/capabilities/portfolios.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/portfolios.js +434 -116
- package/dist/vendor/core/capabilities/rankings.d.ts +83 -0
- package/dist/vendor/core/capabilities/rankings.d.ts.map +1 -0
- package/dist/vendor/core/capabilities/rankings.js +95 -0
- package/dist/vendor/core/capabilities/registry.d.ts +1279 -413
- package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/registry.js +4 -2
- package/dist/vendor/core/capabilities/screening.d.ts +136 -0
- package/dist/vendor/core/capabilities/screening.d.ts.map +1 -0
- package/dist/vendor/core/capabilities/screening.js +155 -0
- package/dist/vendor/core/capabilities/types.d.ts +1 -1
- package/dist/vendor/core/capabilities/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/skills/quantbrasil/SKILL.md +28 -11
- package/skills/quantbrasil/references/cli.md +96 -20
- package/skills/quantbrasil/references/costs.md +9 -4
- package/skills/quantbrasil/references/errors.md +16 -5
- package/skills/quantbrasil/references/portfolios.md +114 -0
- package/skills/quantbrasil/references/quality-eval-queries.json +127 -0
- package/skills/quantbrasil/references/rankings.md +62 -0
- package/skills/quantbrasil/references/screening.md +212 -0
- package/skills/quantbrasil/references/unsupported.md +7 -2
- package/skills/quantbrasil/references/workflows.md +95 -23
- package/dist/commands/analytics.d.ts +0 -131
- package/dist/commands/analytics.d.ts.map +0 -1
- package/dist/commands/analytics.js +0 -291
- package/dist/vendor/core/capabilities/analytics.d.ts +0 -187
- package/dist/vendor/core/capabilities/analytics.d.ts.map +0 -1
- package/dist/vendor/core/capabilities/analytics.js +0 -214
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Error Handling
|
|
2
2
|
|
|
3
|
+
## Binary not found
|
|
4
|
+
|
|
5
|
+
If `quantbrasil` is not available on `PATH`, report that the CLI binary is not
|
|
6
|
+
installed or not visible to the current shell.
|
|
7
|
+
|
|
8
|
+
Do not inspect local repositories, package source, or credential files to work
|
|
9
|
+
around a missing binary. The CLI owns auth lookup and backend selection.
|
|
10
|
+
Do not silently fall back to generic web or finance search unless the user
|
|
11
|
+
approves another source.
|
|
12
|
+
|
|
3
13
|
## Auth / readiness
|
|
4
14
|
|
|
5
15
|
Check:
|
|
@@ -26,9 +36,9 @@ Treat CLI validation as user-input error.
|
|
|
26
36
|
|
|
27
37
|
Examples:
|
|
28
38
|
|
|
29
|
-
- invalid
|
|
39
|
+
- invalid watchlist or holding id
|
|
30
40
|
- invalid `--sections`
|
|
31
|
-
- invalid `--
|
|
41
|
+
- invalid `--target TICKER:WEIGHT_PCT`
|
|
32
42
|
- invalid `--years`
|
|
33
43
|
|
|
34
44
|
Fix input. Do not retry same bad command.
|
|
@@ -60,14 +70,15 @@ Stable codes:
|
|
|
60
70
|
|
|
61
71
|
Possible causes:
|
|
62
72
|
|
|
63
|
-
-
|
|
73
|
+
- watchlist or holding id does not exist
|
|
64
74
|
- ticker not tracked
|
|
65
75
|
- requested history unavailable for period
|
|
66
76
|
|
|
67
77
|
Recovery:
|
|
68
78
|
|
|
69
79
|
- use `market assets` for discovery
|
|
70
|
-
- use `
|
|
80
|
+
- use `watchlists list` before `watchlists get`
|
|
81
|
+
- use `holdings list` before holding metrics
|
|
71
82
|
- narrow period or pick another ticker
|
|
72
83
|
|
|
73
84
|
Stable code:
|
|
@@ -96,7 +107,7 @@ when a requested ticker is invalid for the operation.
|
|
|
96
107
|
Recovery:
|
|
97
108
|
|
|
98
109
|
- read the error message
|
|
99
|
-
- fix the requested
|
|
110
|
+
- fix the requested watchlist/holding id, name, ticker list, or operation
|
|
100
111
|
- do not retry unchanged mutation input
|
|
101
112
|
|
|
102
113
|
Stable code:
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Portfolio Reference
|
|
2
|
+
|
|
3
|
+
Use this reference whenever the user mentions portfolios, carteiras, holdings,
|
|
4
|
+
watchlists, target weights, positions, historical return, beta, VaR, risk,
|
|
5
|
+
screening universes, or a saved composition.
|
|
6
|
+
|
|
7
|
+
## Domain model
|
|
8
|
+
|
|
9
|
+
- `Portfolio` is the umbrella domain term for a user-owned saved asset set.
|
|
10
|
+
- `Watchlist` is a portfolio used for monitoring assets. It has assets, but it
|
|
11
|
+
is not an investable composition and does not define weights or positions.
|
|
12
|
+
- `Holding` is a portfolio used as an investable composition. It can be based on
|
|
13
|
+
target weights or positions.
|
|
14
|
+
- `System Portfolio` is a backend-managed portfolio-backed universe exposed by
|
|
15
|
+
slug for screening discovery and runs.
|
|
16
|
+
- `Screening Universe` is exactly one system portfolio, watchlist, or holding
|
|
17
|
+
selected for indicator screening.
|
|
18
|
+
- A theoretical portfolio is a holding with target weights. Save it first, then
|
|
19
|
+
run metrics on the returned holding id.
|
|
20
|
+
- A holding used as a screening universe contributes only its asset set; target
|
|
21
|
+
weights and positions do not affect indicator screening.
|
|
22
|
+
- Target weights and positions are independent: target weights describe intended
|
|
23
|
+
allocation, while positions describe actual ownership.
|
|
24
|
+
- Position quantities are shares, units, or coin amounts. Do not pass monetary
|
|
25
|
+
values as positions in the public CLI.
|
|
26
|
+
|
|
27
|
+
## Command routing
|
|
28
|
+
|
|
29
|
+
- Use `quantbrasil watchlists ...` for monitoring lists, ticker groups, and
|
|
30
|
+
non-investable saved lists.
|
|
31
|
+
- Use `quantbrasil holdings ...` for investable compositions, target weights,
|
|
32
|
+
positions, historical return, beta, VaR, and risk/return checks.
|
|
33
|
+
- Use `quantbrasil screening universes` to discover system portfolios,
|
|
34
|
+
watchlists, and holdings available for screening.
|
|
35
|
+
- Use `quantbrasil screening run` with exactly one selector to run indicator
|
|
36
|
+
screening over that selected asset set.
|
|
37
|
+
- Use `quantbrasil holdings list` when the user names a saved holding but does
|
|
38
|
+
not provide an id.
|
|
39
|
+
- Use `quantbrasil watchlists list` when the user names a saved watchlist but
|
|
40
|
+
does not provide an id.
|
|
41
|
+
- If the user asks for portfolio analytics without specifying an object, resolve
|
|
42
|
+
or create a holding first.
|
|
43
|
+
|
|
44
|
+
Do not use these patterns:
|
|
45
|
+
|
|
46
|
+
- `quantbrasil portfolios ...`
|
|
47
|
+
- `quantbrasil analytics ...`
|
|
48
|
+
- ad-hoc asset lists passed directly into metric commands
|
|
49
|
+
- ad-hoc asset lists passed directly into screening commands
|
|
50
|
+
- running holding metrics on a watchlist
|
|
51
|
+
|
|
52
|
+
## Holdings
|
|
53
|
+
|
|
54
|
+
Create target-weight holdings when the user wants to analyze a hypothetical or
|
|
55
|
+
model composition.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
quantbrasil holdings create "Teórica energia" --target VALE3:50 --target PRIO3:50
|
|
59
|
+
quantbrasil holdings historical-return 93 --from 2025-01-01 --to 2026-01-01
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`holdings create` returns the holding id. Reuse that id for follow-up commands.
|
|
63
|
+
|
|
64
|
+
Use `set-targets` to replace a holding target allocation.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
quantbrasil holdings set-targets 93 VALE3:40 PRIO3:35 PETR4:25
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use position mode only when the user is creating or managing a real position
|
|
71
|
+
holding.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
quantbrasil holdings create "Carteira Real" --mode position
|
|
75
|
+
quantbrasil holdings set-positions 93 PRIO3:1600 BTC-USD:0.25 QQQ:10
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`set-positions` is a partial quantity upsert: it changes only the mentioned
|
|
79
|
+
tickers and leaves unmentioned positions unchanged. It does not clear or replace
|
|
80
|
+
target weights.
|
|
81
|
+
|
|
82
|
+
## Watchlists
|
|
83
|
+
|
|
84
|
+
Use watchlists for saved sets of assets that the user wants to monitor, screen,
|
|
85
|
+
or revisit later.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
quantbrasil watchlists create "Dividendos"
|
|
89
|
+
quantbrasil watchlists add-assets 93 PETR4 VALE3
|
|
90
|
+
quantbrasil watchlists get 93
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
If the user asks for return, beta, VaR, or risk on a watchlist, explain that a
|
|
94
|
+
watchlist has no investable composition. Create a target-weight holding or use
|
|
95
|
+
an existing holding instead.
|
|
96
|
+
|
|
97
|
+
## Metrics
|
|
98
|
+
|
|
99
|
+
Holding metrics always run through `holdings`.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
quantbrasil holdings historical-return 93 --from 2025-01-01 --to 2026-01-01
|
|
103
|
+
quantbrasil holdings historical-return 93 --period 1y
|
|
104
|
+
quantbrasil holdings beta 93 --years 1
|
|
105
|
+
quantbrasil holdings var 93 --years 1 --confidence 95
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Rules:
|
|
109
|
+
|
|
110
|
+
- `historical-return` accepts either absolute ISO dates with `--from`/`--to` or
|
|
111
|
+
a shorthand lookback with `--period`, such as `1y` or `6m`.
|
|
112
|
+
- `beta` accepts `--years 1|3|5`.
|
|
113
|
+
- `var --confidence` takes percentages such as `95` or `99`.
|
|
114
|
+
- Use `--json` for machine parsing.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"query": "Qual foi o último preço da PETR4 no QuantBrasil?",
|
|
4
|
+
"should_trigger": true,
|
|
5
|
+
"expected_behavior": "Use quantbrasil market price PETR4 before generic web or finance search."
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"query": "Mostra o preço e a análise técnica da VALE3.",
|
|
9
|
+
"should_trigger": true,
|
|
10
|
+
"expected_behavior": "Use assets overview with the price and technicals sections."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"query": "Quero preço, fundamentos e rankings de ITUB4.",
|
|
14
|
+
"should_trigger": true,
|
|
15
|
+
"expected_behavior": "Use assets overview with only valid sections: price,fundamentals,rankings."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"query": "Mostra valuation e resumo da PETR4 pela CLI.",
|
|
19
|
+
"should_trigger": true,
|
|
20
|
+
"expected_behavior": "Do not pass invalid sections like valuation or summary; inspect capabilities or explain the supported asset overview sections."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"query": "Crie uma watchlist chamada Dividendos e adicione PETR4 e VALE3.",
|
|
24
|
+
"should_trigger": true,
|
|
25
|
+
"expected_behavior": "Use watchlists create followed by watchlists add-assets with explicit tickers."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"query": "Atualize os pesos alvo da carteira Longo Prazo para PETR4 50 e VALE3 50.",
|
|
29
|
+
"should_trigger": true,
|
|
30
|
+
"expected_behavior": "Resolve the holding id if needed, then use holdings set-targets; do not use a generic portfolio command."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"query": "Liste minhas carteiras e calcule o retorno histórico da carteira Longo Prazo.",
|
|
34
|
+
"should_trigger": true,
|
|
35
|
+
"expected_behavior": "Use holdings list to resolve the saved holding, then holdings historical-return."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"query": "Qual é o beta da minha carteira contra o Ibovespa?",
|
|
39
|
+
"should_trigger": true,
|
|
40
|
+
"expected_behavior": "Use holdings beta for a saved holding; do not calculate beta for a watchlist."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"query": "Quais universos salvos eu posso usar no screening de indicadores?",
|
|
44
|
+
"should_trigger": true,
|
|
45
|
+
"expected_behavior": "Use screening universes and present system portfolios, watchlists, and holdings."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"query": "Quais indicadores posso usar no screening?",
|
|
49
|
+
"should_trigger": true,
|
|
50
|
+
"expected_behavior": "Use screening indicators and present supported indicator names, params, examples, timeframes, and operators."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"query": "Rode um screening de IFR na carteira do sistema Ações Mais Líquidas.",
|
|
54
|
+
"should_trigger": true,
|
|
55
|
+
"expected_behavior": "Use screening run with one explicit --system selector and a ScreenerRequest JSON payload."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"query": "A CLI retornou auth_failed quando tentei buscar PETR4.",
|
|
59
|
+
"should_trigger": true,
|
|
60
|
+
"expected_behavior": "Load error guidance; explain auth login or QUANTBRASIL_API_KEY without inspecting credential files."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"query": "A CLI disse rate_limited ao rodar várias métricas de carteira.",
|
|
64
|
+
"should_trigger": true,
|
|
65
|
+
"expected_behavior": "Load errors and costs guidance; avoid retry loops and recommend waiting or narrowing heavy calls."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"query": "Meu terminal diz quantbrasil: command not found.",
|
|
69
|
+
"should_trigger": true,
|
|
70
|
+
"expected_behavior": "Report that the CLI binary is not on PATH and ask the user to install it or fix PATH; do not inspect the repo."
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"query": "Apague uma carteira salva da minha conta.",
|
|
74
|
+
"should_trigger": true,
|
|
75
|
+
"expected_behavior": "Load unsupported guidance and explain that deleting holdings is not public in the CLI."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"query": "Exporte uma resposta JSON grande para arquivo usando a CLI.",
|
|
79
|
+
"should_trigger": true,
|
|
80
|
+
"expected_behavior": "Load unsupported guidance and explain that --output file export is not public yet."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"query": "Rode um filtro com estes tickers avulsos: PETR4, VALE3 e BBAS3.",
|
|
84
|
+
"should_trigger": true,
|
|
85
|
+
"expected_behavior": "Load unsupported guidance; do not invent ad-hoc ticker-list screening."
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"query": "What's the latest PETR4 price in QuantBrasil?",
|
|
89
|
+
"should_trigger": true,
|
|
90
|
+
"expected_behavior": "Use quantbrasil market price PETR4."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"query": "Show me the price and technical overview for VALE3.",
|
|
94
|
+
"should_trigger": true,
|
|
95
|
+
"expected_behavior": "Use assets overview with price and technicals sections."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"query": "Run a screen over these ad-hoc tickers: PETR4, VALE3, BBAS3.",
|
|
99
|
+
"should_trigger": true,
|
|
100
|
+
"expected_behavior": "Load unsupported guidance; do not invent ad-hoc ticker-list screening."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"query": "Implemente um novo comando na CLI dentro do repositório do QuantBrasil.",
|
|
104
|
+
"should_trigger": false,
|
|
105
|
+
"expected_behavior": "Handle as code implementation work, not as a market-data CLI usage task."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"query": "Revise este pull request procurando bugs no backend.",
|
|
109
|
+
"should_trigger": false,
|
|
110
|
+
"expected_behavior": "Handle as code review work, not as a QuantBrasil CLI data task."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"query": "Procure na web a cotação de hoje do dólar contra o real.",
|
|
114
|
+
"should_trigger": false,
|
|
115
|
+
"expected_behavior": "Use external lookup because the user explicitly requested the web and this is not a QuantBrasil-supported asset workflow."
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"query": "Explique conceitualmente o que significa beta de uma carteira.",
|
|
119
|
+
"should_trigger": false,
|
|
120
|
+
"expected_behavior": "Answer conceptually; no CLI call is needed unless the user asks for a saved holding metric."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"query": "Monte uma planilha para meus gastos mensais.",
|
|
124
|
+
"should_trigger": false,
|
|
125
|
+
"expected_behavior": "Use spreadsheet/document workflow, not the QuantBrasil CLI skill."
|
|
126
|
+
}
|
|
127
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Rankings
|
|
2
|
+
|
|
3
|
+
Use rankings for order-first questions: Magic Formula, momentum leaders,
|
|
4
|
+
dividend-yield leaders, Momentum Double, or saved user rankings. A ranking
|
|
5
|
+
returns an ordered asset list plus the metric used to order it.
|
|
6
|
+
|
|
7
|
+
## Discovery
|
|
8
|
+
|
|
9
|
+
Always discover ids before running a ranking unless the user already gave an
|
|
10
|
+
exact id.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
quantbrasil rankings list
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The list is grouped into:
|
|
17
|
+
|
|
18
|
+
- system rankings: platform-provided rankings selected by stable slugs
|
|
19
|
+
- user rankings: saved rankings owned by the authenticated user
|
|
20
|
+
|
|
21
|
+
## Current ranking
|
|
22
|
+
|
|
23
|
+
System ranking:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
quantbrasil rankings current --system momentum-90d --top 20
|
|
27
|
+
quantbrasil rankings current --system magic-formula --top 10
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
User ranking:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
quantbrasil rankings current --id 123 --top 20
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Rules:
|
|
37
|
+
|
|
38
|
+
- use exactly one selector: `--system` for system rankings or `--id` for user rankings
|
|
39
|
+
- system rankings use slugs such as `momentum-90d` or `magic-formula`
|
|
40
|
+
- user rankings use the numeric id shown under "Meus rankings"
|
|
41
|
+
- `--top` is the number of ranked assets to return
|
|
42
|
+
- use `--json` when another step needs to parse tickers, rank, score, or metric values
|
|
43
|
+
- do not use `factor:<id>` in command syntax; ranking fatorial is a saved user ranking and uses `--id <id>`
|
|
44
|
+
|
|
45
|
+
## Ranking vs screening
|
|
46
|
+
|
|
47
|
+
Use rankings when the user starts from an ordered list:
|
|
48
|
+
|
|
49
|
+
- "top 20 do momentum"
|
|
50
|
+
- "top 10 Magic Formula"
|
|
51
|
+
- "meu ranking de qualidade"
|
|
52
|
+
- "ativos com maior dividend yield"
|
|
53
|
+
|
|
54
|
+
Use screening when the user starts from a condition:
|
|
55
|
+
|
|
56
|
+
- "IFR14 abaixo de 30"
|
|
57
|
+
- "ativos sobrevendidos"
|
|
58
|
+
- "preço acima da média móvel"
|
|
59
|
+
|
|
60
|
+
If the user wants both ranking and a condition, keep the steps explicit. First
|
|
61
|
+
get the ranking with `--json`, then apply the follow-up workflow only if the CLI
|
|
62
|
+
surface supports that next step. Do not invent ranking-specific screening flags.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Screening
|
|
2
|
+
|
|
3
|
+
Use screening for indicator filters over saved QuantBrasil universes.
|
|
4
|
+
|
|
5
|
+
## Discovery
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
quantbrasil screening universes
|
|
9
|
+
quantbrasil screening indicators
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use `screening universes` to pick the asset set. The CLI supports only saved,
|
|
13
|
+
portfolio-backed universes:
|
|
14
|
+
|
|
15
|
+
- system portfolios via `--system <slug>`
|
|
16
|
+
- watchlists via `--watchlist <id>`
|
|
17
|
+
- holdings via `--holding <id>`
|
|
18
|
+
|
|
19
|
+
Do not invent ad-hoc ticker-list screening. If the user gives loose tickers,
|
|
20
|
+
explain that this CLI slice only screens saved universes.
|
|
21
|
+
|
|
22
|
+
Use `screening indicators` before building JSON when the indicator name,
|
|
23
|
+
parameters, timeframes, or comparison operators are unclear.
|
|
24
|
+
|
|
25
|
+
## Common Portuguese mappings
|
|
26
|
+
|
|
27
|
+
- `IFR`, `IFR14`, `IFR(14)` -> `RSI` with `params.period = 14`
|
|
28
|
+
- `IFR2`, `IFR(2)` -> `RSI` with `params.period = 2`
|
|
29
|
+
- `sobrevendido` usually means low RSI, commonly `< 30` or a threshold supplied by the user
|
|
30
|
+
- `sobrecomprado` usually means high RSI, commonly `> 70` or a threshold supplied by the user
|
|
31
|
+
- `Ações Mais Líquidas` -> system universe slug `acoes-mais-liquidas` when present in `screening universes`
|
|
32
|
+
|
|
33
|
+
## Operators
|
|
34
|
+
|
|
35
|
+
- `lt` means less than
|
|
36
|
+
- `lte` means less than or equal to
|
|
37
|
+
- `gt` means greater than
|
|
38
|
+
- `gte` means greater than or equal to
|
|
39
|
+
- `eq` means equal to
|
|
40
|
+
- `neq` means not equal to
|
|
41
|
+
|
|
42
|
+
## IFR14 abaixo de 25
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"query": {
|
|
47
|
+
"comparison": {
|
|
48
|
+
"left": {
|
|
49
|
+
"indicator": {
|
|
50
|
+
"name": "RSI",
|
|
51
|
+
"timeframe": "D1",
|
|
52
|
+
"offset": 0,
|
|
53
|
+
"params": {
|
|
54
|
+
"period": 14
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"operator": "lt",
|
|
59
|
+
"right": {
|
|
60
|
+
"constant": {
|
|
61
|
+
"value": 25
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"limit": 500,
|
|
67
|
+
"sort": "ticker"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Run it:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening-ifr14-lt-25.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For agent/script parsing:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening-ifr14-lt-25.json --json
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## IFR14 acima de 70
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"query": {
|
|
88
|
+
"comparison": {
|
|
89
|
+
"left": {
|
|
90
|
+
"indicator": {
|
|
91
|
+
"name": "RSI",
|
|
92
|
+
"timeframe": "D1",
|
|
93
|
+
"offset": 0,
|
|
94
|
+
"params": {
|
|
95
|
+
"period": 14
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"operator": "gt",
|
|
100
|
+
"right": {
|
|
101
|
+
"constant": {
|
|
102
|
+
"value": 70
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"limit": 500,
|
|
108
|
+
"sort": "ticker"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## IFR2 abaixo de 10
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"query": {
|
|
117
|
+
"comparison": {
|
|
118
|
+
"left": {
|
|
119
|
+
"indicator": {
|
|
120
|
+
"name": "RSI",
|
|
121
|
+
"timeframe": "D1",
|
|
122
|
+
"offset": 0,
|
|
123
|
+
"params": {
|
|
124
|
+
"period": 2
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"operator": "lt",
|
|
129
|
+
"right": {
|
|
130
|
+
"constant": {
|
|
131
|
+
"value": 10
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"limit": 500,
|
|
137
|
+
"sort": "ticker"
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Exemplo com AND lógico
|
|
142
|
+
|
|
143
|
+
Este exemplo filtra ativos com fechamento acima da média móvel de 20 períodos e
|
|
144
|
+
IFR14 abaixo de 30.
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"query": {
|
|
149
|
+
"logical": {
|
|
150
|
+
"op": "AND",
|
|
151
|
+
"expressions": [
|
|
152
|
+
{
|
|
153
|
+
"comparison": {
|
|
154
|
+
"left": {
|
|
155
|
+
"indicator": {
|
|
156
|
+
"name": "OHLC",
|
|
157
|
+
"timeframe": "D1",
|
|
158
|
+
"offset": 0,
|
|
159
|
+
"params": {
|
|
160
|
+
"price_type": "close"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"operator": "gt",
|
|
165
|
+
"right": {
|
|
166
|
+
"indicator": {
|
|
167
|
+
"name": "RollingWindow",
|
|
168
|
+
"timeframe": "D1",
|
|
169
|
+
"offset": 0,
|
|
170
|
+
"params": {
|
|
171
|
+
"window": 20,
|
|
172
|
+
"method": "mean"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"comparison": {
|
|
180
|
+
"left": {
|
|
181
|
+
"indicator": {
|
|
182
|
+
"name": "RSI",
|
|
183
|
+
"timeframe": "D1",
|
|
184
|
+
"offset": 0,
|
|
185
|
+
"params": {
|
|
186
|
+
"period": 14
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"operator": "lt",
|
|
191
|
+
"right": {
|
|
192
|
+
"constant": {
|
|
193
|
+
"value": 30
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"limit": 100,
|
|
202
|
+
"sort": "ticker"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Stdin
|
|
207
|
+
|
|
208
|
+
Use stdin when creating the JSON dynamically:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
cat ./screening-ifr14-lt-25.json | quantbrasil screening run --system acoes-mais-liquidas --query-file -
|
|
212
|
+
```
|
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
Unsupported in the public CLI:
|
|
4
4
|
|
|
5
5
|
- `--output <file>` response export
|
|
6
|
+
- deleting watchlists or holdings
|
|
7
|
+
- value-based position input for traded assets
|
|
8
|
+
- ad-hoc ticker-list screening
|
|
6
9
|
|
|
7
10
|
Not a supported pattern:
|
|
8
11
|
|
|
9
12
|
- inventing commands not shown in `quantbrasil --help`
|
|
10
13
|
- assuming hidden flags exist
|
|
11
14
|
- treating backend internals as public CLI contract
|
|
15
|
+
- treating a watchlist as an investable composition for metrics
|
|
12
16
|
|
|
13
17
|
Use the public surface only:
|
|
14
18
|
|
|
@@ -16,5 +20,6 @@ Use the public surface only:
|
|
|
16
20
|
- `capabilities`
|
|
17
21
|
- `market`
|
|
18
22
|
- `assets`
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
23
|
+
- `screening`
|
|
24
|
+
- `watchlists`
|
|
25
|
+
- `holdings`
|