@quantbrasil/cli 0.1.0-beta.1 → 0.1.0-beta.11

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 (77) hide show
  1. package/README.md +64 -11
  2. package/dist/cli/client.js +4 -0
  3. package/dist/cli/index.d.ts +14 -4
  4. package/dist/cli/index.d.ts.map +1 -1
  5. package/dist/cli/index.js +72 -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/cointegration.d.ts +52 -0
  16. package/dist/commands/cointegration.d.ts.map +1 -0
  17. package/dist/commands/cointegration.js +118 -0
  18. package/dist/commands/market.d.ts +1 -0
  19. package/dist/commands/market.d.ts.map +1 -1
  20. package/dist/commands/market.js +17 -1
  21. package/dist/commands/portfolios.d.ts +148 -8
  22. package/dist/commands/portfolios.d.ts.map +1 -1
  23. package/dist/commands/portfolios.js +557 -55
  24. package/dist/commands/rankings.d.ts +82 -0
  25. package/dist/commands/rankings.d.ts.map +1 -0
  26. package/dist/commands/rankings.js +235 -0
  27. package/dist/commands/screening.d.ts +120 -0
  28. package/dist/commands/screening.d.ts.map +1 -0
  29. package/dist/commands/screening.js +361 -0
  30. package/dist/commands/skills.js +7 -7
  31. package/dist/commands/update.d.ts +23 -0
  32. package/dist/commands/update.d.ts.map +1 -0
  33. package/dist/commands/update.js +209 -0
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +3 -1
  37. package/dist/vendor/core/capabilities/cointegration.d.ts +52 -0
  38. package/dist/vendor/core/capabilities/cointegration.d.ts.map +1 -0
  39. package/dist/vendor/core/capabilities/cointegration.js +63 -0
  40. package/dist/vendor/core/capabilities/index.d.ts +3 -1
  41. package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
  42. package/dist/vendor/core/capabilities/index.js +3 -1
  43. package/dist/vendor/core/capabilities/market.d.ts +9 -1
  44. package/dist/vendor/core/capabilities/market.d.ts.map +1 -1
  45. package/dist/vendor/core/capabilities/market.js +10 -0
  46. package/dist/vendor/core/capabilities/portfolios.d.ts +452 -56
  47. package/dist/vendor/core/capabilities/portfolios.d.ts.map +1 -1
  48. package/dist/vendor/core/capabilities/portfolios.js +434 -116
  49. package/dist/vendor/core/capabilities/rankings.d.ts +83 -0
  50. package/dist/vendor/core/capabilities/rankings.d.ts.map +1 -0
  51. package/dist/vendor/core/capabilities/rankings.js +96 -0
  52. package/dist/vendor/core/capabilities/registry.d.ts +1380 -414
  53. package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
  54. package/dist/vendor/core/capabilities/registry.js +6 -2
  55. package/dist/vendor/core/capabilities/screening.d.ts +136 -0
  56. package/dist/vendor/core/capabilities/screening.d.ts.map +1 -0
  57. package/dist/vendor/core/capabilities/screening.js +155 -0
  58. package/dist/vendor/core/capabilities/types.d.ts +1 -1
  59. package/dist/vendor/core/capabilities/types.d.ts.map +1 -1
  60. package/package.json +3 -3
  61. package/skills/quantbrasil/SKILL.md +31 -11
  62. package/skills/quantbrasil/references/cli.md +112 -19
  63. package/skills/quantbrasil/references/cointegration.md +40 -0
  64. package/skills/quantbrasil/references/costs.md +10 -4
  65. package/skills/quantbrasil/references/errors.md +16 -5
  66. package/skills/quantbrasil/references/portfolios.md +114 -0
  67. package/skills/quantbrasil/references/quality-eval-queries.json +147 -0
  68. package/skills/quantbrasil/references/rankings.md +64 -0
  69. package/skills/quantbrasil/references/screening.md +212 -0
  70. package/skills/quantbrasil/references/unsupported.md +9 -2
  71. package/skills/quantbrasil/references/workflows.md +117 -23
  72. package/dist/commands/analytics.d.ts +0 -131
  73. package/dist/commands/analytics.d.ts.map +0 -1
  74. package/dist/commands/analytics.js +0 -291
  75. package/dist/vendor/core/capabilities/analytics.d.ts +0 -187
  76. package/dist/vendor/core/capabilities/analytics.d.ts.map +0 -1
  77. package/dist/vendor/core/capabilities/analytics.js +0 -214
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAErE,eAAO,MAAM,sBAAsB,EAE9B,MAAM,CAAC,YAAY,EAAE,CAAC,OAAO,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjD"}
@@ -1,12 +1,16 @@
1
- import { analyticsCapabilities } from "./analytics.js";
2
1
  import { assetCapabilities } from "./assets.js";
2
+ import { cointegrationCapabilities } from "./cointegration.js";
3
3
  import { marketCapabilities } from "./market.js";
4
4
  import { portfolioCapabilities } from "./portfolios.js";
5
+ import { rankingsCapabilities } from "./rankings.js";
6
+ import { screeningCapabilities } from "./screening.js";
5
7
  export const capabilityRegistry = [
6
8
  ...marketCapabilities,
7
9
  ...assetCapabilities,
10
+ ...rankingsCapabilities,
11
+ ...screeningCapabilities,
8
12
  ...portfolioCapabilities,
9
- ...analyticsCapabilities,
13
+ ...cointegrationCapabilities,
10
14
  ];
11
15
  export const capabilityRegistryById = Object.fromEntries(capabilityRegistry.map(capability => [capability.id, capability]));
12
16
  export function getCapabilityById(id) {
@@ -0,0 +1,136 @@
1
+ export declare const screeningSortValues: readonly ["price", "ticker"];
2
+ export declare const screeningCapabilities: readonly [{
3
+ readonly id: "screening.universes";
4
+ readonly kind: "read";
5
+ readonly visibility: readonly ["cli", "opencode"];
6
+ readonly description: "Lista universos salvos e baseados em portfólios disponíveis para screening de indicadores.";
7
+ readonly http: {
8
+ readonly method: "GET";
9
+ readonly path: "/api/desk/tools/screening/universes";
10
+ readonly inputMode: "none";
11
+ readonly schemas: {
12
+ readonly request: null;
13
+ readonly response: "ScreeningUniversesResponse";
14
+ };
15
+ };
16
+ readonly cli: {
17
+ readonly group: "screening";
18
+ readonly command: "universes";
19
+ readonly summary: "Lista carteiras do sistema, watchlists e carteiras disponíveis para screening.";
20
+ readonly positional: readonly [];
21
+ readonly options: readonly [];
22
+ readonly examples: readonly ["quantbrasil screening universes"];
23
+ };
24
+ readonly tool: {
25
+ readonly name: "qb_screening_universes";
26
+ readonly title: "Listar universos de screening";
27
+ };
28
+ readonly outputModes: readonly ["json", "human"];
29
+ }, {
30
+ readonly id: "screening.indicators";
31
+ readonly kind: "read";
32
+ readonly visibility: readonly ["cli", "opencode"];
33
+ readonly description: "Lista indicadores, parâmetros e operadores disponíveis para screening.";
34
+ readonly http: {
35
+ readonly method: "GET";
36
+ readonly path: "/api/desk/tools/screening/indicators";
37
+ readonly inputMode: "none";
38
+ readonly schemas: {
39
+ readonly request: null;
40
+ readonly response: "ScreeningIndicatorsResponse";
41
+ };
42
+ };
43
+ readonly cli: {
44
+ readonly group: "screening";
45
+ readonly command: "indicators";
46
+ readonly summary: "Lista indicadores, parâmetros e exemplos disponíveis para screening.";
47
+ readonly positional: readonly [];
48
+ readonly options: readonly [];
49
+ readonly examples: readonly ["quantbrasil screening indicators", "quantbrasil screening indicators --json"];
50
+ };
51
+ readonly tool: {
52
+ readonly name: "qb_screening_indicators";
53
+ readonly title: "Listar indicadores de screening";
54
+ };
55
+ readonly outputModes: readonly ["json", "human"];
56
+ }, {
57
+ readonly id: "screening.run";
58
+ readonly kind: "read";
59
+ readonly visibility: readonly ["cli", "opencode"];
60
+ readonly description: "Executa o screener de indicadores existente sobre um universo salvo baseado em portfólio.";
61
+ readonly http: {
62
+ readonly method: "POST";
63
+ readonly path: "/api/desk/tools/screening/run";
64
+ readonly inputMode: "json_body";
65
+ readonly schemas: {
66
+ readonly request: "ScreeningRunRequest";
67
+ readonly response: "ScreeningRunResponse";
68
+ };
69
+ };
70
+ readonly cli: {
71
+ readonly group: "screening";
72
+ readonly command: "run";
73
+ readonly summary: "Executa screening de indicadores a partir de um payload ScreenerRequest JSON.";
74
+ readonly positional: readonly [];
75
+ readonly options: readonly [{
76
+ readonly kind: "option";
77
+ readonly flag: "--system";
78
+ readonly name: "system_slug";
79
+ readonly type: "string";
80
+ readonly required: false;
81
+ readonly placeholder: "SLUG";
82
+ readonly exclusiveGroup: "screening_universe_selector";
83
+ readonly description: "Slug da carteira do sistema retornado por `screening universes`, por exemplo acoes-mais-liquidas.";
84
+ }, {
85
+ readonly kind: "option";
86
+ readonly flag: "--watchlist";
87
+ readonly name: "watchlist_id";
88
+ readonly type: "integer";
89
+ readonly required: false;
90
+ readonly placeholder: "ID";
91
+ readonly exclusiveGroup: "screening_universe_selector";
92
+ readonly description: "ID da watchlist retornado por `watchlists list`.";
93
+ }, {
94
+ readonly kind: "option";
95
+ readonly flag: "--holding";
96
+ readonly name: "holding_id";
97
+ readonly type: "integer";
98
+ readonly required: false;
99
+ readonly placeholder: "ID";
100
+ readonly exclusiveGroup: "screening_universe_selector";
101
+ readonly description: "ID da carteira retornado por `holdings list`.";
102
+ }, {
103
+ readonly kind: "option";
104
+ readonly flag: "--query-file";
105
+ readonly name: "query_file";
106
+ readonly type: "string";
107
+ readonly required: true;
108
+ readonly placeholder: "ARQUIVO|-";
109
+ readonly description: "Caminho para um arquivo ScreenerRequest JSON completo, ou `-` para ler JSON de stdin.";
110
+ }, {
111
+ readonly kind: "option";
112
+ readonly flag: "--limit";
113
+ readonly name: "limit";
114
+ readonly type: "integer";
115
+ readonly required: false;
116
+ readonly placeholder: "N";
117
+ readonly description: "Sobrescreve o limit de topo do ScreenerRequest sem alterar o arquivo da consulta.";
118
+ }, {
119
+ readonly kind: "option";
120
+ readonly flag: "--sort";
121
+ readonly name: "sort";
122
+ readonly type: "enum";
123
+ readonly required: false;
124
+ readonly placeholder: "price|ticker";
125
+ readonly enumValues: readonly ["price", "ticker"];
126
+ readonly description: "Sobrescreve o sort de topo do ScreenerRequest sem alterar o arquivo da consulta.";
127
+ }];
128
+ readonly examples: readonly ["quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening.json", "quantbrasil screening run --watchlist 93 --query-file ./screening.json --limit 25", "cat screening.json | quantbrasil screening run --holding 182 --query-file - --sort ticker"];
129
+ };
130
+ readonly tool: {
131
+ readonly name: "qb_screening_run";
132
+ readonly title: "Executar screening de indicadores";
133
+ };
134
+ readonly outputModes: readonly ["json", "human"];
135
+ }];
136
+ //# sourceMappingURL=screening.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screening.d.ts","sourceRoot":"","sources":["../../src/capabilities/screening.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,8BAA+B,CAAC;AAEhE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiKkB,CAAC"}
@@ -0,0 +1,155 @@
1
+ import { publicRuntimeVisibility, standardOutputModes } from "./shared.js";
2
+ const screeningSelectorExclusiveGroup = "screening_universe_selector";
3
+ export const screeningSortValues = ["price", "ticker"];
4
+ export const screeningCapabilities = [
5
+ {
6
+ id: "screening.universes",
7
+ kind: "read",
8
+ visibility: publicRuntimeVisibility,
9
+ description: "Lista universos salvos e baseados em portfólios disponíveis para screening de indicadores.",
10
+ http: {
11
+ method: "GET",
12
+ path: "/api/desk/tools/screening/universes",
13
+ inputMode: "none",
14
+ schemas: {
15
+ request: null,
16
+ response: "ScreeningUniversesResponse",
17
+ },
18
+ },
19
+ cli: {
20
+ group: "screening",
21
+ command: "universes",
22
+ summary: "Lista carteiras do sistema, watchlists e carteiras disponíveis para screening.",
23
+ positional: [],
24
+ options: [],
25
+ examples: ["quantbrasil screening universes"],
26
+ },
27
+ tool: {
28
+ name: "qb_screening_universes",
29
+ title: "Listar universos de screening",
30
+ },
31
+ outputModes: standardOutputModes,
32
+ },
33
+ {
34
+ id: "screening.indicators",
35
+ kind: "read",
36
+ visibility: publicRuntimeVisibility,
37
+ description: "Lista indicadores, parâmetros e operadores disponíveis para screening.",
38
+ http: {
39
+ method: "GET",
40
+ path: "/api/desk/tools/screening/indicators",
41
+ inputMode: "none",
42
+ schemas: {
43
+ request: null,
44
+ response: "ScreeningIndicatorsResponse",
45
+ },
46
+ },
47
+ cli: {
48
+ group: "screening",
49
+ command: "indicators",
50
+ summary: "Lista indicadores, parâmetros e exemplos disponíveis para screening.",
51
+ positional: [],
52
+ options: [],
53
+ examples: [
54
+ "quantbrasil screening indicators",
55
+ "quantbrasil screening indicators --json",
56
+ ],
57
+ },
58
+ tool: {
59
+ name: "qb_screening_indicators",
60
+ title: "Listar indicadores de screening",
61
+ },
62
+ outputModes: standardOutputModes,
63
+ },
64
+ {
65
+ id: "screening.run",
66
+ kind: "read",
67
+ visibility: publicRuntimeVisibility,
68
+ description: "Executa o screener de indicadores existente sobre um universo salvo baseado em portfólio.",
69
+ http: {
70
+ method: "POST",
71
+ path: "/api/desk/tools/screening/run",
72
+ inputMode: "json_body",
73
+ schemas: {
74
+ request: "ScreeningRunRequest",
75
+ response: "ScreeningRunResponse",
76
+ },
77
+ },
78
+ cli: {
79
+ group: "screening",
80
+ command: "run",
81
+ summary: "Executa screening de indicadores a partir de um payload ScreenerRequest JSON.",
82
+ positional: [],
83
+ options: [
84
+ {
85
+ kind: "option",
86
+ flag: "--system",
87
+ name: "system_slug",
88
+ type: "string",
89
+ required: false,
90
+ placeholder: "SLUG",
91
+ exclusiveGroup: screeningSelectorExclusiveGroup,
92
+ description: "Slug da carteira do sistema retornado por `screening universes`, por exemplo acoes-mais-liquidas.",
93
+ },
94
+ {
95
+ kind: "option",
96
+ flag: "--watchlist",
97
+ name: "watchlist_id",
98
+ type: "integer",
99
+ required: false,
100
+ placeholder: "ID",
101
+ exclusiveGroup: screeningSelectorExclusiveGroup,
102
+ description: "ID da watchlist retornado por `watchlists list`.",
103
+ },
104
+ {
105
+ kind: "option",
106
+ flag: "--holding",
107
+ name: "holding_id",
108
+ type: "integer",
109
+ required: false,
110
+ placeholder: "ID",
111
+ exclusiveGroup: screeningSelectorExclusiveGroup,
112
+ description: "ID da carteira retornado por `holdings list`.",
113
+ },
114
+ {
115
+ kind: "option",
116
+ flag: "--query-file",
117
+ name: "query_file",
118
+ type: "string",
119
+ required: true,
120
+ placeholder: "ARQUIVO|-",
121
+ description: "Caminho para um arquivo ScreenerRequest JSON completo, ou `-` para ler JSON de stdin.",
122
+ },
123
+ {
124
+ kind: "option",
125
+ flag: "--limit",
126
+ name: "limit",
127
+ type: "integer",
128
+ required: false,
129
+ placeholder: "N",
130
+ description: "Sobrescreve o limit de topo do ScreenerRequest sem alterar o arquivo da consulta.",
131
+ },
132
+ {
133
+ kind: "option",
134
+ flag: "--sort",
135
+ name: "sort",
136
+ type: "enum",
137
+ required: false,
138
+ placeholder: "price|ticker",
139
+ enumValues: screeningSortValues,
140
+ description: "Sobrescreve o sort de topo do ScreenerRequest sem alterar o arquivo da consulta.",
141
+ },
142
+ ],
143
+ examples: [
144
+ "quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening.json",
145
+ "quantbrasil screening run --watchlist 93 --query-file ./screening.json --limit 25",
146
+ "cat screening.json | quantbrasil screening run --holding 182 --query-file - --sort ticker",
147
+ ],
148
+ },
149
+ tool: {
150
+ name: "qb_screening_run",
151
+ title: "Executar screening de indicadores",
152
+ },
153
+ outputModes: standardOutputModes,
154
+ },
155
+ ];
@@ -1,6 +1,6 @@
1
1
  export type CapabilityVisibility = "cli" | "opencode";
2
2
  export type CapabilityKind = "read" | "mutation";
3
- export type CapabilityGroup = "market" | "assets" | "portfolios" | "analytics";
3
+ export type CapabilityGroup = "market" | "assets" | "rankings" | "screening" | "watchlists" | "holdings" | "cointegration";
4
4
  export type CapabilityHttpMethod = "GET" | "POST";
5
5
  export type CapabilityInputMode = "none" | "query" | "json_body";
6
6
  export type CapabilityOutputMode = "json" | "human";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,UAAU,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAC/E,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;AACjE,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,MAAM,GACN,cAAc,GACd,YAAY,CAAC;AACjB,MAAM,MAAM,0BAA0B,GAClC,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,CAAC;AACtB,MA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;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,SAAS,gCAAgC,EAAE,CAAC;IACxD,OAAO,EAAE,SAAS,4BAA4B,EAAE,CAAC;IACjD;;;;OAIG;IACH,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,uDAAuD;AACvD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,8EAA8E;AAC9E,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,GAAG,EAAE,qBAAqB,CAAC;IAC3B,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantbrasil/cli",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.11",
4
4
  "type": "module",
5
5
  "description": "Public QuantBrasil CLI for deterministic operations",
6
6
  "repository": {
@@ -40,9 +40,9 @@
40
40
  "eslint": "^9.15.0",
41
41
  "typescript": "^5.3.3",
42
42
  "vitest": "^3.2.4",
43
- "@repo/eslint-config": "0.0.0",
43
+ "@repo/core": "0.0.0",
44
44
  "@repo/typescript-config": "0.0.0",
45
- "@repo/core": "0.0.0"
45
+ "@repo/eslint-config": "0.0.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "pnpm --filter @repo/core build && pnpm run clean && tsc && node scripts/vendor-core.mjs",
@@ -1,29 +1,49 @@
1
1
  ---
2
2
  name: quantbrasil
3
- description: Use QuantBrasil CLI for deterministic market, asset, portfolio, and analytics workflows.
3
+ description: Use this skill when a user asks for QuantBrasil-supported market or investing data/actions through the QuantBrasil CLI, including asset lookup, prices, asset analysis, rankings, watchlists, holdings, screening, cointegration, Long & Short, historical return, beta, and VaR, even if they do not explicitly mention QuantBrasil.
4
4
  ---
5
5
 
6
6
  # QuantBrasil CLI
7
7
 
8
- Use this skill when user needs deterministic QuantBrasil data or analytics through CLI.
8
+ Use this skill when the user asks for market or investing data/actions that QuantBrasil supports, including asset lookup, prices, asset analysis, rankings, watchlists, holdings, screening, cointegration, Long & Short, and holding metrics.
9
9
 
10
10
  ## Routing
11
11
 
12
+ - Use this skill even when the user does not say "QuantBrasil" if the request fits the supported market or investing surface.
13
+ - Most end-user QuantBrasil requests are expected in pt-BR; Portuguese prompts about ativos, rankings, Magic Formula, momentum, ranking fatorial, carteiras, cotações, screening, cointegração, Long & Short, retorno, beta, VaR, watchlists, or Ibovespa should trigger this skill when they map to the supported CLI surface.
14
+ - For QuantBrasil-supported market, asset, ranking, screening, cointegration, watchlist, holding, or holding metric data, use the CLI before generic web or finance search.
15
+ - When the request mentions portfolios, carteiras, watchlists, holdings, target weights, positions, historical return, beta, VaR, screening universes, or saved compositions, load [`references/portfolios.md`](./references/portfolios.md) before choosing commands.
16
+ - When the request asks for Magic Formula, momentum rankings, Low Risk, top ranked assets, ranking fatorial, rankings do usuário, or ordered asset lists, load [`references/rankings.md`](./references/rankings.md) before choosing commands.
17
+ - When the request mentions IFR/RSI filters, sobrevendido, sobrecomprado, indicator screening, technical screening rules, or screening indicators, load [`references/screening.md`](./references/screening.md) before building the request JSON.
18
+ - When the request mentions cointegração, cointegration, Long & Short, long and short, long-short, pair trading, z-score between two assets, p-valor de cointegração, or meia-vida between a pair, load [`references/cointegration.md`](./references/cointegration.md) before choosing commands.
19
+ - Use `quantbrasil` when available on PATH.
20
+ - If `quantbrasil` is not found, report that the CLI binary is not on PATH and ask the user to install it or fix PATH.
12
21
  - Check readiness first: `quantbrasil --status`
22
+ - Identify the authenticated user when needed: `quantbrasil whoami`
13
23
  - Inspect public surface when unsure: `quantbrasil capabilities --json`
14
24
  - Use narrow command first:
15
25
  - asset discovery: `quantbrasil market assets`
16
26
  - price lookup: `quantbrasil market price <ticker>`
17
27
  - richer asset analysis: `quantbrasil assets overview <ticker> --sections ...`
18
- - saved portfolio discovery: `quantbrasil portfolios list`
19
- - saved portfolio details: `quantbrasil portfolios get <id>`
20
- - portfolio analytics: `quantbrasil analytics historical-return|beta|var ...`
28
+ - ranked asset lists: `quantbrasil rankings list|current ...`
29
+ - watchlist details and changes: `quantbrasil watchlists ...`
30
+ - holding details and historical return: `quantbrasil holdings ...`
31
+ - indicator screening over saved universes: `quantbrasil screening universes|indicators|run ...`
32
+ - pair cointegration: `quantbrasil cointegration pair <base_asset> <comparison_asset>`
33
+ - holding metrics: `quantbrasil holdings historical-return|beta|var ...`
21
34
  - Use `--json` when output will be parsed by agent or script
35
+ - Use generic web or finance search only if the CLI is unavailable, the requested data is outside the QuantBrasil-supported surface, or the user explicitly asks for an external source.
36
+ - Do not inspect the local repo, package source, or `~/.config/quantbrasil/config.json` for normal data queries. Use CLI status/errors instead.
22
37
 
23
- ## References
38
+ ## Reference Loading
24
39
 
25
- - CLI surface: [`references/cli.md`](./references/cli.md)
26
- - Common workflows: [`references/workflows.md`](./references/workflows.md)
27
- - Cost-aware behavior: [`references/costs.md`](./references/costs.md)
28
- - Failure handling: [`references/errors.md`](./references/errors.md)
29
- - Unsupported / not-yet-public operations: [`references/unsupported.md`](./references/unsupported.md)
40
+ - Load [`references/workflows.md`](./references/workflows.md) when the user describes an investing task but does not name an exact command, or when a task spans discovery plus a follow-up action.
41
+ - Load [`references/cli.md`](./references/cli.md) when you need exact command syntax, flags, examples, or supported `--sections` values.
42
+ - Load [`references/rankings.md`](./references/rankings.md) when the user asks for Magic Formula, momentum rankings, Low Risk, top ranked assets, ranking fatorial, rankings do usuário, or current ordered lists.
43
+ - Load [`references/portfolios.md`](./references/portfolios.md) when the request mentions portfolios, carteiras, watchlists, holdings, target weights, positions, historical return, beta, VaR, screening universes, or saved compositions.
44
+ - Load [`references/screening.md`](./references/screening.md) when the user asks for IFR/RSI filters, sobrevendido/sobrecomprado assets, indicator screening, technical filter JSON, screening indicators, or examples of `ScreenerRequest`.
45
+ - Load [`references/cointegration.md`](./references/cointegration.md) when the user asks for cointegração, cointegration, Long & Short, long and short, long-short, pair trading, z-score between two assets, p-valor de cointegração, or meia-vida between a pair.
46
+ - Load [`references/costs.md`](./references/costs.md) before chaining heavy reads, choosing between overview/screening/holding metrics, or answering cost-sensitive agent workflow questions.
47
+ - Load [`references/errors.md`](./references/errors.md) when a CLI command fails, auth/config is unclear, or the user asks how to fix a QuantBrasil CLI error.
48
+ - Load [`references/unsupported.md`](./references/unsupported.md) when the user asks for deletion, file export, ad-hoc ticker-list screening, unsupported commands, or a capability that may not be public yet.
49
+ - Use [`references/quality-eval-queries.json`](./references/quality-eval-queries.json) only when evaluating or tuning skill quality and trigger accuracy.
@@ -1,9 +1,13 @@
1
1
  # CLI Reference
2
2
 
3
+ Examples assume the `quantbrasil` binary is available on `PATH`.
4
+
3
5
  ## Readiness and auth
4
6
 
5
7
  ```bash
6
8
  quantbrasil --status
9
+ quantbrasil whoami
10
+ quantbrasil auth whoami
7
11
  quantbrasil auth login --api-key <key>
8
12
  quantbrasil auth logout
9
13
  quantbrasil capabilities --json
@@ -15,6 +19,7 @@ quantbrasil init
15
19
  ```bash
16
20
  quantbrasil market assets
17
21
  quantbrasil market assets --type B3
22
+ quantbrasil market assets --search BTC
18
23
  quantbrasil market assets --json
19
24
 
20
25
  quantbrasil market price PETR4
@@ -41,37 +46,125 @@ Valid `--sections`:
41
46
  - `fundamentals`
42
47
  - `rankings`
43
48
 
44
- ## Portfolios
49
+ ## Rankings
50
+
51
+ ```bash
52
+ quantbrasil rankings list
53
+ quantbrasil rankings list --json
54
+ quantbrasil rankings current --system momentum-90d --top 20
55
+ quantbrasil rankings current --system magic-formula --top 10
56
+ quantbrasil rankings current --system low-risk --top 30
57
+ quantbrasil rankings current --id 123 --top 20
58
+ quantbrasil rankings current --system momentum-90d --top 20 --json
59
+ ```
60
+
61
+ Rules:
62
+
63
+ - use `rankings list` to discover rankings before using ids
64
+ - system rankings use slugs such as `magic-formula`, `momentum-90d`, `dividend-yield`, `low-risk`, and `momentum-double`
65
+ - user rankings use the numeric id returned by `rankings list`
66
+ - use exactly one selector: `--system <slug>` or `--id <id>`
67
+ - `--top` controls how many ranked assets are returned
68
+ - `current` returns the ordered rows and the metric used to order the ranking
69
+ - use `--json` when the result will be parsed by an agent or script
70
+
71
+ ## Watchlists and holdings
72
+
73
+ Watchlists:
45
74
 
46
75
  ```bash
47
- quantbrasil portfolios list
48
- quantbrasil portfolios list --json
76
+ quantbrasil watchlists list
77
+ quantbrasil watchlists get 93
78
+ quantbrasil watchlists create "Dividendos"
79
+ quantbrasil watchlists rename 93 "Longo Prazo"
80
+ quantbrasil watchlists add-assets 93 PETR4 VALE3
81
+ quantbrasil watchlists remove-assets 93 PETR4
82
+ ```
49
83
 
50
- quantbrasil portfolios get 93
51
- quantbrasil portfolios get 93 --json
84
+ Holdings:
52
85
 
53
- quantbrasil portfolios create "Dividendos"
54
- quantbrasil portfolios rename 93 "Longo Prazo"
55
- quantbrasil portfolios add-assets 93 PETR4 VALE3
56
- quantbrasil portfolios remove-assets 93 PETR4
86
+ ```bash
87
+ quantbrasil holdings list
88
+ quantbrasil holdings get 182
89
+ quantbrasil holdings create "Longo Prazo"
90
+ quantbrasil holdings create "Longo Prazo" --target PETR4:50 --target VALE3:50
91
+ quantbrasil holdings create "Carteira Real" --mode position
92
+ quantbrasil holdings rename 182 "Longo Prazo"
93
+ quantbrasil holdings set-targets 182 PETR4:50 VALE3:50
94
+ quantbrasil holdings set-positions 182 PRIO3:1600 BTC-USD:0.25 QQQ:10
95
+ quantbrasil holdings historical-return 182 --from 2025-01-01 --to 2026-01-01
96
+ quantbrasil holdings historical-return 182 --period 1y
97
+ quantbrasil holdings beta 182 --years 1
98
+ quantbrasil holdings var 182 --years 1 --confidence 95
57
99
  ```
58
100
 
59
- ## Analytics
101
+ Use `--json` on any holding metric command when machine parsing needed.
60
102
 
61
- Saved portfolio:
103
+ ## Screening
62
104
 
63
105
  ```bash
64
- quantbrasil analytics historical-return --portfolio 93 --from 2025-01-01 --to 2026-01-01
65
- quantbrasil analytics beta --portfolio 93 --years 1
66
- quantbrasil analytics var --portfolio 93 --years 1 --confidence 95
106
+ quantbrasil screening universes
107
+ quantbrasil screening indicators
108
+ quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening.json
109
+ quantbrasil screening run --watchlist 93 --query-file ./screening.json --limit 25
110
+ quantbrasil screening run --holding 182 --query-file ./screening.json --sort ticker
111
+ cat ./screening.json | quantbrasil screening run --system etfs --query-file -
67
112
  ```
68
113
 
69
- Ad-hoc basket:
114
+ Rules:
115
+
116
+ - use exactly one selector: `--system`, `--watchlist`, or `--holding`
117
+ - `--system` accepts a slug from `screening universes`
118
+ - `--watchlist` and `--holding` accept numeric ids
119
+ - `--query-file` must contain the full backend `ScreenerRequest` JSON shape
120
+ - `--query-file -` reads the same JSON shape from stdin
121
+ - `--limit` and `--sort` override only top-level fields from the query JSON
122
+ - use `screening indicators` to discover supported indicator names, params, examples, timeframes, and operators
123
+
124
+ Example query JSON:
125
+
126
+ ```json
127
+ {
128
+ "query": {
129
+ "comparison": {
130
+ "left": {
131
+ "indicator": {
132
+ "name": "RSI",
133
+ "timeframe": "D1",
134
+ "offset": 0,
135
+ "params": {
136
+ "period": 14
137
+ }
138
+ }
139
+ },
140
+ "operator": "lt",
141
+ "right": {
142
+ "constant": {
143
+ "value": 30
144
+ }
145
+ }
146
+ }
147
+ },
148
+ "limit": 50,
149
+ "sort": "ticker"
150
+ }
151
+ ```
152
+
153
+ Load [`screening.md`](./screening.md) for detailed screening examples, including
154
+ IFR14, IFR2, and logical `AND` JSON payloads.
155
+
156
+ ## Cointegration
70
157
 
71
158
  ```bash
72
- quantbrasil analytics historical-return --asset VALE3:50 --asset PRIO3:50 --from 2025-01-01 --to 2026-01-01
73
- quantbrasil analytics beta --asset VALE3:50 --asset PRIO3:50 --years 3
74
- quantbrasil analytics var --asset VALE3:120 --asset WINFUT:-20 --years 1 --confidence 99
159
+ quantbrasil cointegration pair PETR4 VALE3
160
+ quantbrasil cointegration pair PETR4 VALE3 --window 120
161
+ quantbrasil cointegration pair PETR4 VALE3 --json
75
162
  ```
76
163
 
77
- Use `--json` on any analytics command when machine parsing needed.
164
+ Rules:
165
+
166
+ - use `cointegration pair` when the user asks to run cointegração or Long & Short analysis between two explicit assets
167
+ - both assets must be supported QuantBrasil tickers from the same market bucket: `B3`/`BDR`/`ETF`, `S&P500`/`ETF-US`, `Crypto`, or `Futuro`
168
+ - `--window` is the number of daily candles, defaults to `250`, and accepts `20` to `2000`
169
+ - the response includes beta, ADF, p-value, confidence, half-life, z-score series, and beta series
170
+ - use `--json` when another step needs to parse the series
@@ -0,0 +1,40 @@
1
+ # Cointegration
2
+
3
+ Use cointegration when the user asks for cointegração, cointegration, pair
4
+ trading statistics, Long & Short, long and short, long-short, z-score, p-value,
5
+ confidence, beta, or meia-vida for two explicit assets.
6
+
7
+ For this skill, Long & Short between two explicit tickers maps to pair
8
+ cointegration analysis. The command estimates the relationship and spread
9
+ metrics that support a Long & Short workflow, including beta, z-score, p-value,
10
+ confidence, and half-life. Do not present the command as order execution, a
11
+ profit guarantee, or a complete trade recommendation.
12
+
13
+ ## Command
14
+
15
+ ```bash
16
+ quantbrasil cointegration pair PETR4 VALE3
17
+ quantbrasil cointegration pair PETR4 VALE3 --window 120
18
+ quantbrasil cointegration pair PETR4 VALE3 --json
19
+ ```
20
+
21
+ ## Rules
22
+
23
+ - Require two explicit QuantBrasil-supported tickers.
24
+ - Both tickers must belong to the same market bucket: `B3`/`BDR`/`ETF`,
25
+ `S&P500`/`ETF-US`, `Crypto`, or `Futuro`.
26
+ - Treat Long & Short requests between two explicit tickers as pair cointegration
27
+ analysis.
28
+ - Use `market assets --search <term>` first only when a ticker is ambiguous.
29
+ - Do not run multiple pairs unless the user explicitly asks for them.
30
+ - Use `--window <n>` only when the user gives a period or asks for a specific
31
+ candle count; default is `250`.
32
+ - `--window` accepts daily candle counts from `20` to `2000`.
33
+ - Use `--json` when another step needs the z-score or beta series.
34
+
35
+ ## Unsupported
36
+
37
+ The public CLI does not currently scan a whole universe for cointegrated pairs.
38
+ If the user asks "quais pares cointegrados existem nesse universo?", explain
39
+ that only explicit pair analysis is public now, then ask for two tickers or use
40
+ available discovery commands to help them choose candidates.