@quantbrasil/cli 0.1.0-beta.7 → 0.1.0-beta.9
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 +12 -0
- package/dist/cli/index.d.ts +8 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +22 -3
- 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/rankings.d.ts +82 -0
- package/dist/commands/rankings.d.ts.map +1 -0
- package/dist/commands/rankings.js +202 -0
- package/dist/commands/screening.d.ts +44 -0
- package/dist/commands/screening.d.ts.map +1 -1
- package/dist/commands/screening.js +63 -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 +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/vendor/core/capabilities/index.d.ts +1 -0
- package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/index.js +1 -0
- 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 +216 -0
- package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/registry.js +2 -0
- package/dist/vendor/core/capabilities/screening.d.ts +27 -0
- package/dist/vendor/core/capabilities/screening.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/screening.js +31 -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 +10 -5
- package/skills/quantbrasil/references/cli.md +26 -0
- package/skills/quantbrasil/references/costs.md +2 -0
- package/skills/quantbrasil/references/quality-eval-queries.json +5 -0
- package/skills/quantbrasil/references/rankings.md +60 -0
- package/skills/quantbrasil/references/screening.md +212 -0
- package/skills/quantbrasil/references/workflows.md +29 -3
|
@@ -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
|
+
```
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
- asset price, quote, or daily move → `market price`
|
|
6
6
|
- supported assets, tickers, or market universe → `market assets`
|
|
7
7
|
- asset performance, technicals, risk, fundamentals, or ranking → `assets overview`
|
|
8
|
+
- current ordered asset lists such as Magic Formula, momentum, or user rankings → `rankings list`, then `rankings current`
|
|
8
9
|
- watchlist details or changes → `watchlists ...`
|
|
9
10
|
- holding details or changes → `holdings ...`
|
|
10
11
|
- holding return, beta, risk, VaR, or comparison → `holdings historical-return|beta|var`
|
|
11
|
-
- indicator screening over saved asset sets → `screening universes`, then `screening run`
|
|
12
|
+
- indicator screening over saved asset sets → `screening universes`, `screening indicators` when needed, then `screening run`
|
|
12
13
|
|
|
13
14
|
## Find supported ticker, then get price
|
|
14
15
|
|
|
@@ -62,6 +63,28 @@ Guidance:
|
|
|
62
63
|
|
|
63
64
|
Avoid asking for every section unless user clearly wants full report.
|
|
64
65
|
|
|
66
|
+
## Get current ranked assets
|
|
67
|
+
|
|
68
|
+
Use this when the user asks for an ordered list such as top Magic Formula,
|
|
69
|
+
momentum leaders, dividend-yield leaders, Momentum Double, or a saved user
|
|
70
|
+
ranking.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
quantbrasil rankings list
|
|
74
|
+
quantbrasil rankings current --system momentum-90d --top 20
|
|
75
|
+
quantbrasil rankings current --system magic-formula --top 10
|
|
76
|
+
quantbrasil rankings current --user 123 --top 20
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Rules:
|
|
80
|
+
|
|
81
|
+
- rankings answer order-first questions
|
|
82
|
+
- system rankings use `--system <id>` from `rankings list`
|
|
83
|
+
- user rankings use `--user <id>` from `rankings list`
|
|
84
|
+
- do not call user rankings "factor:" in command syntax; ranking fatorial is a saved user ranking
|
|
85
|
+
- use `--json` if another step needs to parse tickers, ranks, or ordering metrics
|
|
86
|
+
- do not route ranking-first questions through screening unless the user asks for indicator conditions
|
|
87
|
+
|
|
65
88
|
## Analyze saved holding
|
|
66
89
|
|
|
67
90
|
1. Discover holding id.
|
|
@@ -79,11 +102,13 @@ quantbrasil holdings var 93 --years 1 --confidence 95
|
|
|
79
102
|
## Run indicator screening
|
|
80
103
|
|
|
81
104
|
1. Discover available universes.
|
|
82
|
-
2.
|
|
83
|
-
3.
|
|
105
|
+
2. Discover available indicators when the filter JSON is not already known.
|
|
106
|
+
3. Pick exactly one system portfolio, watchlist, or holding.
|
|
107
|
+
4. Run screening with a full `ScreenerRequest` JSON file.
|
|
84
108
|
|
|
85
109
|
```bash
|
|
86
110
|
quantbrasil screening universes
|
|
111
|
+
quantbrasil screening indicators
|
|
87
112
|
quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening.json
|
|
88
113
|
quantbrasil screening run --watchlist 93 --query-file ./screening.json --limit 25
|
|
89
114
|
quantbrasil screening run --holding 182 --query-file ./screening.json --sort ticker
|
|
@@ -94,6 +119,7 @@ Rules:
|
|
|
94
119
|
- screening universes are portfolio-backed only: system portfolios, watchlists, or holdings
|
|
95
120
|
- a holding used as a screening universe contributes only its asset set
|
|
96
121
|
- do not invent ad-hoc ticker-list screening commands
|
|
122
|
+
- load `references/screening.md` for IFR/RSI examples and full JSON payloads
|
|
97
123
|
- use `--json` when the result will be parsed by an agent or script
|
|
98
124
|
|
|
99
125
|
## Analyze a theoretical composition
|