@quantbrasil/cli 0.1.0-beta.0 → 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.
Files changed (70) hide show
  1. package/README.md +63 -11
  2. package/dist/cli/client.js +4 -0
  3. package/dist/cli/index.d.ts +12 -4
  4. package/dist/cli/index.d.ts.map +1 -1
  5. package/dist/cli/index.js +64 -14
  6. package/dist/cli/prompt.d.ts +1 -0
  7. package/dist/cli/prompt.d.ts.map +1 -1
  8. package/dist/cli/prompt.js +17 -0
  9. package/dist/cli/skills.d.ts +9 -0
  10. package/dist/cli/skills.d.ts.map +1 -1
  11. package/dist/cli/skills.js +68 -4
  12. package/dist/commands/auth.d.ts +18 -0
  13. package/dist/commands/auth.d.ts.map +1 -1
  14. package/dist/commands/auth.js +49 -0
  15. package/dist/commands/market.d.ts +1 -0
  16. package/dist/commands/market.d.ts.map +1 -1
  17. package/dist/commands/market.js +17 -1
  18. package/dist/commands/portfolios.d.ts +148 -8
  19. package/dist/commands/portfolios.d.ts.map +1 -1
  20. package/dist/commands/portfolios.js +557 -55
  21. package/dist/commands/rankings.d.ts +82 -0
  22. package/dist/commands/rankings.d.ts.map +1 -0
  23. package/dist/commands/rankings.js +235 -0
  24. package/dist/commands/screening.d.ts +120 -0
  25. package/dist/commands/screening.d.ts.map +1 -0
  26. package/dist/commands/screening.js +361 -0
  27. package/dist/commands/skills.js +7 -7
  28. package/dist/commands/update.d.ts +23 -0
  29. package/dist/commands/update.d.ts.map +1 -0
  30. package/dist/commands/update.js +209 -0
  31. package/dist/index.d.ts +3 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +3 -1
  34. package/dist/vendor/core/capabilities/index.d.ts +2 -1
  35. package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
  36. package/dist/vendor/core/capabilities/index.js +2 -1
  37. package/dist/vendor/core/capabilities/market.d.ts +9 -1
  38. package/dist/vendor/core/capabilities/market.d.ts.map +1 -1
  39. package/dist/vendor/core/capabilities/market.js +10 -0
  40. package/dist/vendor/core/capabilities/portfolios.d.ts +452 -56
  41. package/dist/vendor/core/capabilities/portfolios.d.ts.map +1 -1
  42. package/dist/vendor/core/capabilities/portfolios.js +434 -116
  43. package/dist/vendor/core/capabilities/rankings.d.ts +83 -0
  44. package/dist/vendor/core/capabilities/rankings.d.ts.map +1 -0
  45. package/dist/vendor/core/capabilities/rankings.js +95 -0
  46. package/dist/vendor/core/capabilities/registry.d.ts +1279 -413
  47. package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
  48. package/dist/vendor/core/capabilities/registry.js +4 -2
  49. package/dist/vendor/core/capabilities/screening.d.ts +136 -0
  50. package/dist/vendor/core/capabilities/screening.d.ts.map +1 -0
  51. package/dist/vendor/core/capabilities/screening.js +155 -0
  52. package/dist/vendor/core/capabilities/types.d.ts +1 -1
  53. package/dist/vendor/core/capabilities/types.d.ts.map +1 -1
  54. package/package.json +1 -1
  55. package/skills/quantbrasil/SKILL.md +28 -11
  56. package/skills/quantbrasil/references/cli.md +96 -20
  57. package/skills/quantbrasil/references/costs.md +9 -4
  58. package/skills/quantbrasil/references/errors.md +16 -5
  59. package/skills/quantbrasil/references/portfolios.md +114 -0
  60. package/skills/quantbrasil/references/quality-eval-queries.json +127 -0
  61. package/skills/quantbrasil/references/rankings.md +62 -0
  62. package/skills/quantbrasil/references/screening.md +212 -0
  63. package/skills/quantbrasil/references/unsupported.md +7 -2
  64. package/skills/quantbrasil/references/workflows.md +95 -23
  65. package/dist/commands/analytics.d.ts +0 -131
  66. package/dist/commands/analytics.d.ts.map +0 -1
  67. package/dist/commands/analytics.js +0 -291
  68. package/dist/vendor/core/capabilities/analytics.d.ts +0 -187
  69. package/dist/vendor/core/capabilities/analytics.d.ts.map +0 -1
  70. package/dist/vendor/core/capabilities/analytics.js +0 -214
@@ -1,13 +1,59 @@
1
1
  import { publicRuntimeVisibility, standardOutputModes } from "./shared.js";
2
+ const portfolioIdPositional = {
3
+ kind: "positional",
4
+ name: "portfolio_id",
5
+ type: "integer",
6
+ required: true,
7
+ placeholder: "ID",
8
+ description: "Stable saved object identifier.",
9
+ };
10
+ const namePositional = {
11
+ kind: "positional",
12
+ name: "name",
13
+ type: "string",
14
+ required: true,
15
+ placeholder: "NOME",
16
+ description: "Name to save.",
17
+ };
18
+ const symbolsPositional = {
19
+ kind: "positional",
20
+ name: "symbols",
21
+ type: "string_array",
22
+ required: true,
23
+ placeholder: "TICKER",
24
+ multiple: true,
25
+ collectionFormat: "space_separated",
26
+ description: "One or more monitored ticker symbols.",
27
+ };
28
+ const targetsPositional = {
29
+ kind: "positional",
30
+ name: "targets",
31
+ type: "string_array",
32
+ required: true,
33
+ placeholder: "TICKER:PESO",
34
+ multiple: true,
35
+ collectionFormat: "space_separated",
36
+ description: "One or more target weights in TICKER:WEIGHT_PCT form.",
37
+ };
38
+ const positionsPositional = {
39
+ kind: "positional",
40
+ name: "positions",
41
+ type: "string_array",
42
+ required: true,
43
+ placeholder: "TICKER:QUANTIDADE",
44
+ multiple: true,
45
+ collectionFormat: "space_separated",
46
+ description: "One or more position quantities in TICKER:QUANTITY form.",
47
+ };
2
48
  export const portfolioCapabilities = [
3
49
  {
4
- id: "portfolios.list",
50
+ id: "watchlists.list",
5
51
  kind: "read",
6
52
  visibility: publicRuntimeVisibility,
7
- description: "List every portfolio owned by the authenticated user.",
53
+ description: "List watchlists owned by the authenticated user.",
8
54
  http: {
9
55
  method: "GET",
10
- path: "/api/desk/tools/portfolio/list",
56
+ path: "/api/desk/tools/watchlist/list",
11
57
  inputMode: "none",
12
58
  schemas: {
13
59
  request: null,
@@ -15,27 +61,27 @@ export const portfolioCapabilities = [
15
61
  },
16
62
  },
17
63
  cli: {
18
- group: "portfolios",
64
+ group: "watchlists",
19
65
  command: "list",
20
- summary: "List the user portfolios available in QuantBrasil.",
66
+ summary: "List watchlists for tracking ideas and filters.",
21
67
  positional: [],
22
68
  options: [],
23
- examples: ["quantbrasil portfolios list"],
69
+ examples: ["quantbrasil watchlists list"],
24
70
  },
25
71
  tool: {
26
- name: "qb_portfolio_list",
27
- title: "List portfolios",
72
+ name: "qb_watchlist_list",
73
+ title: "List watchlists",
28
74
  },
29
75
  outputModes: standardOutputModes,
30
76
  },
31
77
  {
32
- id: "portfolios.get",
78
+ id: "watchlists.get",
33
79
  kind: "read",
34
80
  visibility: publicRuntimeVisibility,
35
- description: "Return one saved portfolio by id, scoped to the acting user.",
81
+ description: "Return one watchlist by id, scoped to the acting user.",
36
82
  http: {
37
83
  method: "POST",
38
- path: "/api/desk/tools/portfolio/get",
84
+ path: "/api/desk/tools/watchlist/get",
39
85
  inputMode: "json_body",
40
86
  schemas: {
41
87
  request: "PortfolioGetRequest",
@@ -43,36 +89,27 @@ export const portfolioCapabilities = [
43
89
  },
44
90
  },
45
91
  cli: {
46
- group: "portfolios",
92
+ group: "watchlists",
47
93
  command: "get",
48
- summary: "Get a saved portfolio by id.",
49
- positional: [
50
- {
51
- kind: "positional",
52
- name: "portfolio_id",
53
- type: "integer",
54
- required: true,
55
- placeholder: "ID",
56
- description: "Saved portfolio identifier.",
57
- },
58
- ],
94
+ summary: "Get a watchlist by id.",
95
+ positional: [portfolioIdPositional],
59
96
  options: [],
60
- examples: ["quantbrasil portfolios get 123"],
97
+ examples: ["quantbrasil watchlists get 123"],
61
98
  },
62
99
  tool: {
63
- name: "qb_portfolio_get",
64
- title: "Get portfolio",
100
+ name: "qb_watchlist_get",
101
+ title: "Get watchlist",
65
102
  },
66
103
  outputModes: standardOutputModes,
67
104
  },
68
105
  {
69
- id: "portfolios.create",
106
+ id: "watchlists.create",
70
107
  kind: "mutation",
71
108
  visibility: publicRuntimeVisibility,
72
- description: "Create a new saved portfolio for the authenticated user.",
109
+ description: "Create a new watchlist for the authenticated user.",
73
110
  http: {
74
111
  method: "POST",
75
- path: "/api/desk/tools/portfolio/create",
112
+ path: "/api/desk/tools/watchlist/create",
76
113
  inputMode: "json_body",
77
114
  schemas: {
78
115
  request: "PortfolioCreateRequest",
@@ -80,36 +117,27 @@ export const portfolioCapabilities = [
80
117
  },
81
118
  },
82
119
  cli: {
83
- group: "portfolios",
120
+ group: "watchlists",
84
121
  command: "create",
85
- summary: "Create a new portfolio.",
86
- positional: [
87
- {
88
- kind: "positional",
89
- name: "name",
90
- type: "string",
91
- required: true,
92
- placeholder: "NOME",
93
- description: "Portfolio name to create.",
94
- },
95
- ],
122
+ summary: "Create a new watchlist.",
123
+ positional: [namePositional],
96
124
  options: [],
97
- examples: ['quantbrasil portfolios create "Dividendos"'],
125
+ examples: ['quantbrasil watchlists create "Dividendos"'],
98
126
  },
99
127
  tool: {
100
- name: "qb_portfolio_create",
101
- title: "Create portfolio",
128
+ name: "qb_watchlist_create",
129
+ title: "Create watchlist",
102
130
  },
103
131
  outputModes: standardOutputModes,
104
132
  },
105
133
  {
106
- id: "portfolios.rename",
134
+ id: "watchlists.rename",
107
135
  kind: "mutation",
108
136
  visibility: publicRuntimeVisibility,
109
- description: "Rename a saved portfolio owned by the authenticated user.",
137
+ description: "Rename a watchlist owned by the authenticated user.",
110
138
  http: {
111
139
  method: "POST",
112
- path: "/api/desk/tools/portfolio/rename",
140
+ path: "/api/desk/tools/watchlist/rename",
113
141
  inputMode: "json_body",
114
142
  schemas: {
115
143
  request: "PortfolioRenameRequest",
@@ -117,44 +145,27 @@ export const portfolioCapabilities = [
117
145
  },
118
146
  },
119
147
  cli: {
120
- group: "portfolios",
148
+ group: "watchlists",
121
149
  command: "rename",
122
- summary: "Rename an existing portfolio.",
123
- positional: [
124
- {
125
- kind: "positional",
126
- name: "portfolio_id",
127
- type: "integer",
128
- required: true,
129
- placeholder: "ID",
130
- description: "Saved portfolio identifier.",
131
- },
132
- {
133
- kind: "positional",
134
- name: "name",
135
- type: "string",
136
- required: true,
137
- placeholder: "NOME",
138
- description: "New portfolio name.",
139
- },
140
- ],
150
+ summary: "Rename an existing watchlist.",
151
+ positional: [portfolioIdPositional, namePositional],
141
152
  options: [],
142
- examples: ['quantbrasil portfolios rename 123 "Longo Prazo"'],
153
+ examples: ['quantbrasil watchlists rename 123 "Longo Prazo"'],
143
154
  },
144
155
  tool: {
145
- name: "qb_portfolio_rename",
146
- title: "Rename portfolio",
156
+ name: "qb_watchlist_rename",
157
+ title: "Rename watchlist",
147
158
  },
148
159
  outputModes: standardOutputModes,
149
160
  },
150
161
  {
151
- id: "portfolios.add-assets",
162
+ id: "watchlists.add-assets",
152
163
  kind: "mutation",
153
164
  visibility: publicRuntimeVisibility,
154
- description: "Add one or more monitored tickers to a saved portfolio.",
165
+ description: "Add one or more monitored tickers to a watchlist.",
155
166
  http: {
156
167
  method: "POST",
157
- path: "/api/desk/tools/portfolio/add_assets",
168
+ path: "/api/desk/tools/watchlist/add_assets",
158
169
  inputMode: "json_body",
159
170
  schemas: {
160
171
  request: "PortfolioAddAssetsRequest",
@@ -162,82 +173,389 @@ export const portfolioCapabilities = [
162
173
  },
163
174
  },
164
175
  cli: {
165
- group: "portfolios",
176
+ group: "watchlists",
166
177
  command: "add-assets",
167
- summary: "Add monitored tickers to an existing portfolio.",
168
- positional: [
178
+ summary: "Add monitored tickers to an existing watchlist.",
179
+ positional: [portfolioIdPositional, symbolsPositional],
180
+ options: [],
181
+ examples: ["quantbrasil watchlists add-assets 123 PETR4 VALE3"],
182
+ },
183
+ tool: {
184
+ name: "qb_watchlist_add_assets",
185
+ title: "Add watchlist assets",
186
+ },
187
+ outputModes: standardOutputModes,
188
+ },
189
+ {
190
+ id: "watchlists.remove-assets",
191
+ kind: "mutation",
192
+ visibility: publicRuntimeVisibility,
193
+ description: "Remove one or more monitored tickers from a watchlist.",
194
+ http: {
195
+ method: "POST",
196
+ path: "/api/desk/tools/watchlist/remove_assets",
197
+ inputMode: "json_body",
198
+ schemas: {
199
+ request: "PortfolioRemoveAssetsRequest",
200
+ response: "PortfolioMutationResponse",
201
+ },
202
+ },
203
+ cli: {
204
+ group: "watchlists",
205
+ command: "remove-assets",
206
+ summary: "Remove monitored tickers from an existing watchlist.",
207
+ positional: [portfolioIdPositional, symbolsPositional],
208
+ options: [],
209
+ examples: ["quantbrasil watchlists remove-assets 123 PETR4"],
210
+ },
211
+ tool: {
212
+ name: "qb_watchlist_remove_assets",
213
+ title: "Remove watchlist assets",
214
+ },
215
+ outputModes: standardOutputModes,
216
+ },
217
+ {
218
+ id: "holdings.list",
219
+ kind: "read",
220
+ visibility: publicRuntimeVisibility,
221
+ description: "List holdings owned by the authenticated user.",
222
+ http: {
223
+ method: "GET",
224
+ path: "/api/desk/tools/holding/list",
225
+ inputMode: "none",
226
+ schemas: {
227
+ request: null,
228
+ response: "PortfolioListResponse",
229
+ },
230
+ },
231
+ cli: {
232
+ group: "holdings",
233
+ command: "list",
234
+ summary: "List holdings for investable metrics.",
235
+ positional: [],
236
+ options: [],
237
+ examples: ["quantbrasil holdings list"],
238
+ },
239
+ tool: {
240
+ name: "qb_holding_list",
241
+ title: "List holdings",
242
+ },
243
+ outputModes: standardOutputModes,
244
+ },
245
+ {
246
+ id: "holdings.get",
247
+ kind: "read",
248
+ visibility: publicRuntimeVisibility,
249
+ description: "Return one holding by id, scoped to the acting user.",
250
+ http: {
251
+ method: "POST",
252
+ path: "/api/desk/tools/holding/get",
253
+ inputMode: "json_body",
254
+ schemas: {
255
+ request: "PortfolioGetRequest",
256
+ response: "PortfolioGetResponse",
257
+ },
258
+ },
259
+ cli: {
260
+ group: "holdings",
261
+ command: "get",
262
+ summary: "Get a holding by id.",
263
+ positional: [portfolioIdPositional],
264
+ options: [],
265
+ examples: ["quantbrasil holdings get 123"],
266
+ },
267
+ tool: {
268
+ name: "qb_holding_get",
269
+ title: "Get holding",
270
+ },
271
+ outputModes: standardOutputModes,
272
+ },
273
+ {
274
+ id: "holdings.create",
275
+ kind: "mutation",
276
+ visibility: publicRuntimeVisibility,
277
+ description: "Create a new holding for the authenticated user.",
278
+ http: {
279
+ method: "POST",
280
+ path: "/api/desk/tools/holding/create",
281
+ inputMode: "json_body",
282
+ schemas: {
283
+ request: "DeskHoldingCreateRequest",
284
+ response: "PortfolioCreateResponse",
285
+ },
286
+ },
287
+ cli: {
288
+ group: "holdings",
289
+ command: "create",
290
+ summary: "Create a new holding.",
291
+ positional: [namePositional],
292
+ options: [
169
293
  {
170
- kind: "positional",
171
- name: "portfolio_id",
172
- type: "integer",
173
- required: true,
174
- placeholder: "ID",
175
- description: "Saved portfolio identifier.",
294
+ kind: "option",
295
+ flag: "--mode",
296
+ name: "default_allocation_input",
297
+ type: "enum",
298
+ required: false,
299
+ placeholder: "target|position",
300
+ defaultValue: "target",
301
+ enumValues: ["target", "position"],
302
+ description: "How the holding is controlled initially: target weights or positions.",
176
303
  },
177
304
  {
178
- kind: "positional",
179
- name: "symbols",
305
+ kind: "option",
306
+ flag: "--target",
307
+ name: "targets",
180
308
  type: "string_array",
181
- required: true,
182
- placeholder: "TICKER",
309
+ required: false,
310
+ placeholder: "TICKER:PESO",
183
311
  multiple: true,
184
- collectionFormat: "space_separated",
185
- description: "One or more monitored ticker symbols to add to the portfolio.",
312
+ collectionFormat: "repeatable",
313
+ description: "Initial target weight in TICKER:WEIGHT_PCT form.",
186
314
  },
187
315
  ],
316
+ examples: [
317
+ 'quantbrasil holdings create "Longo Prazo"',
318
+ 'quantbrasil holdings create "Teórica" --target PRIO3:50 --target VALE3:50',
319
+ 'quantbrasil holdings create "Real" --mode position',
320
+ ],
321
+ },
322
+ tool: {
323
+ name: "qb_holding_create",
324
+ title: "Create holding",
325
+ },
326
+ outputModes: standardOutputModes,
327
+ },
328
+ {
329
+ id: "holdings.rename",
330
+ kind: "mutation",
331
+ visibility: publicRuntimeVisibility,
332
+ description: "Rename a holding owned by the authenticated user.",
333
+ http: {
334
+ method: "POST",
335
+ path: "/api/desk/tools/holding/rename",
336
+ inputMode: "json_body",
337
+ schemas: {
338
+ request: "PortfolioRenameRequest",
339
+ response: "PortfolioMutationResponse",
340
+ },
341
+ },
342
+ cli: {
343
+ group: "holdings",
344
+ command: "rename",
345
+ summary: "Rename an existing holding.",
346
+ positional: [portfolioIdPositional, namePositional],
188
347
  options: [],
189
- examples: ["quantbrasil portfolios add-assets 123 PETR4 VALE3"],
348
+ examples: ['quantbrasil holdings rename 123 "Longo Prazo"'],
190
349
  },
191
350
  tool: {
192
- name: "qb_portfolio_add_assets",
193
- title: "Add portfolio assets",
351
+ name: "qb_holding_rename",
352
+ title: "Rename holding",
194
353
  },
195
354
  outputModes: standardOutputModes,
196
355
  },
197
356
  {
198
- id: "portfolios.remove-assets",
357
+ id: "holdings.set-targets",
199
358
  kind: "mutation",
200
359
  visibility: publicRuntimeVisibility,
201
- description: "Remove one or more monitored tickers from a saved portfolio.",
360
+ description: "Set target weights for a holding owned by the authenticated user.",
202
361
  http: {
203
362
  method: "POST",
204
- path: "/api/desk/tools/portfolio/remove_assets",
363
+ path: "/api/desk/tools/holding/set_targets",
205
364
  inputMode: "json_body",
206
365
  schemas: {
207
- request: "PortfolioRemoveAssetsRequest",
366
+ request: "HoldingSetTargetsRequest",
208
367
  response: "PortfolioMutationResponse",
209
368
  },
210
369
  },
211
370
  cli: {
212
- group: "portfolios",
213
- command: "remove-assets",
214
- summary: "Remove monitored tickers from an existing portfolio.",
215
- positional: [
371
+ group: "holdings",
372
+ command: "set-targets",
373
+ summary: "Set target weights for a holding.",
374
+ positional: [portfolioIdPositional, targetsPositional],
375
+ options: [],
376
+ examples: ["quantbrasil holdings set-targets 123 PRIO3:50 VALE3:50"],
377
+ },
378
+ tool: {
379
+ name: "qb_holding_set_targets",
380
+ title: "Set holding target weights",
381
+ },
382
+ outputModes: standardOutputModes,
383
+ },
384
+ {
385
+ id: "holdings.set-positions",
386
+ kind: "mutation",
387
+ visibility: publicRuntimeVisibility,
388
+ description: "Set position quantities for a holding owned by the authenticated user.",
389
+ http: {
390
+ method: "POST",
391
+ path: "/api/desk/tools/holding/set_positions",
392
+ inputMode: "json_body",
393
+ schemas: {
394
+ request: "HoldingSetPositionsRequest",
395
+ response: "PortfolioMutationResponse",
396
+ },
397
+ },
398
+ cli: {
399
+ group: "holdings",
400
+ command: "set-positions",
401
+ summary: "Set position quantities for a holding.",
402
+ positional: [portfolioIdPositional, positionsPositional],
403
+ options: [],
404
+ examples: [
405
+ "quantbrasil holdings set-positions 123 PRIO3:1600 BTC-USD:0.25",
406
+ ],
407
+ },
408
+ tool: {
409
+ name: "qb_holding_set_positions",
410
+ title: "Set holding position quantities",
411
+ },
412
+ outputModes: standardOutputModes,
413
+ },
414
+ {
415
+ id: "holdings.historical-return",
416
+ kind: "read",
417
+ visibility: publicRuntimeVisibility,
418
+ description: "Calculate historical return for a holding.",
419
+ http: {
420
+ method: "POST",
421
+ path: "/api/desk/tools/holding/historical_return",
422
+ inputMode: "json_body",
423
+ schemas: {
424
+ request: "PortfolioHistoricalReturnRequest",
425
+ response: "HistoricalReturnResponse",
426
+ },
427
+ },
428
+ cli: {
429
+ group: "holdings",
430
+ command: "historical-return",
431
+ summary: "Calculate historical return for a saved holding.",
432
+ positional: [portfolioIdPositional],
433
+ options: [
434
+ {
435
+ kind: "option",
436
+ flag: "--from",
437
+ name: "start_date",
438
+ type: "string",
439
+ required: false,
440
+ placeholder: "AAAA-MM-DD",
441
+ description: "Inclusive start date in ISO format. Use with --to, or use --period.",
442
+ },
443
+ {
444
+ kind: "option",
445
+ flag: "--to",
446
+ name: "end_date",
447
+ type: "string",
448
+ required: false,
449
+ placeholder: "AAAA-MM-DD",
450
+ description: "Inclusive end date in ISO format. Use with --from, or use --period.",
451
+ },
452
+ {
453
+ kind: "option",
454
+ flag: "--period",
455
+ name: "period",
456
+ type: "string",
457
+ required: false,
458
+ placeholder: "PERIODO",
459
+ description: "Lookback period such as 1y, 3y, 5y, or 6m. Mutually exclusive with --from/--to.",
460
+ },
461
+ ],
462
+ examples: [
463
+ "quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01",
464
+ "quantbrasil holdings historical-return 123 --period 1y",
465
+ ],
466
+ },
467
+ tool: {
468
+ name: "qb_holding_historical_return",
469
+ title: "Calculate holding historical return",
470
+ },
471
+ outputModes: standardOutputModes,
472
+ },
473
+ {
474
+ id: "holdings.beta",
475
+ kind: "read",
476
+ visibility: publicRuntimeVisibility,
477
+ description: "Calculate holding beta against IBOV.",
478
+ http: {
479
+ method: "POST",
480
+ path: "/api/desk/tools/holding/beta",
481
+ inputMode: "json_body",
482
+ schemas: {
483
+ request: "PortfolioBetaRequest",
484
+ response: "PortfolioBetaResponse",
485
+ },
486
+ },
487
+ cli: {
488
+ group: "holdings",
489
+ command: "beta",
490
+ summary: "Calculate holding beta against IBOV.",
491
+ positional: [portfolioIdPositional],
492
+ options: [
493
+ {
494
+ kind: "option",
495
+ flag: "--years",
496
+ name: "years",
497
+ type: "enum",
498
+ required: false,
499
+ placeholder: "ANOS",
500
+ defaultValue: 1,
501
+ enumValues: ["1", "3", "5"],
502
+ description: "Historical lookback window in years. Accepted values: 1, 3, or 5.",
503
+ },
504
+ ],
505
+ examples: ["quantbrasil holdings beta 123 --years 3"],
506
+ },
507
+ tool: {
508
+ name: "qb_holding_beta",
509
+ title: "Calculate holding beta",
510
+ },
511
+ outputModes: standardOutputModes,
512
+ },
513
+ {
514
+ id: "holdings.var",
515
+ kind: "read",
516
+ visibility: publicRuntimeVisibility,
517
+ description: "Calculate one-day Value-at-Risk for a holding.",
518
+ http: {
519
+ method: "POST",
520
+ path: "/api/desk/tools/holding/var",
521
+ inputMode: "json_body",
522
+ schemas: {
523
+ request: "PortfolioVaRRequest",
524
+ response: "PortfolioVaRResponse",
525
+ },
526
+ },
527
+ cli: {
528
+ group: "holdings",
529
+ command: "var",
530
+ summary: "Calculate one-day Value-at-Risk for a holding.",
531
+ positional: [portfolioIdPositional],
532
+ options: [
216
533
  {
217
- kind: "positional",
218
- name: "portfolio_id",
534
+ kind: "option",
535
+ flag: "--years",
536
+ name: "years",
219
537
  type: "integer",
220
- required: true,
221
- placeholder: "ID",
222
- description: "Saved portfolio identifier.",
538
+ required: false,
539
+ placeholder: "ANOS",
540
+ defaultValue: 1,
541
+ description: "Historical lookback window in years. The VaR horizon remains one day.",
223
542
  },
224
543
  {
225
- kind: "positional",
226
- name: "symbols",
227
- type: "string_array",
228
- required: true,
229
- placeholder: "TICKER",
230
- multiple: true,
231
- collectionFormat: "space_separated",
232
- description: "One or more monitored ticker symbols to remove from the portfolio.",
544
+ kind: "option",
545
+ flag: "--confidence",
546
+ name: "confidence_pct",
547
+ type: "number",
548
+ required: false,
549
+ placeholder: "PERCENTUAL",
550
+ defaultValue: 95,
551
+ description: "Confidence level in percent, for example 95 or 99.",
233
552
  },
234
553
  ],
235
- options: [],
236
- examples: ["quantbrasil portfolios remove-assets 123 PETR4"],
554
+ examples: ["quantbrasil holdings var 123 --years 1 --confidence 95"],
237
555
  },
238
556
  tool: {
239
- name: "qb_portfolio_remove_assets",
240
- title: "Remove portfolio assets",
557
+ name: "qb_holding_var",
558
+ title: "Calculate holding VaR",
241
559
  },
242
560
  outputModes: standardOutputModes,
243
561
  },