@quantbrasil/cli 0.1.0-beta.2 → 0.1.0-beta.4

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