@quantbrasil/cli 0.1.0-beta.10 → 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 (30) hide show
  1. package/README.md +1 -0
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +8 -0
  5. package/dist/commands/cointegration.d.ts +52 -0
  6. package/dist/commands/cointegration.d.ts.map +1 -0
  7. package/dist/commands/cointegration.js +118 -0
  8. package/dist/vendor/core/capabilities/cointegration.d.ts +52 -0
  9. package/dist/vendor/core/capabilities/cointegration.d.ts.map +1 -0
  10. package/dist/vendor/core/capabilities/cointegration.js +63 -0
  11. package/dist/vendor/core/capabilities/index.d.ts +1 -0
  12. package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
  13. package/dist/vendor/core/capabilities/index.js +1 -0
  14. package/dist/vendor/core/capabilities/rankings.d.ts +2 -2
  15. package/dist/vendor/core/capabilities/rankings.d.ts.map +1 -1
  16. package/dist/vendor/core/capabilities/rankings.js +2 -1
  17. package/dist/vendor/core/capabilities/registry.d.ts +104 -4
  18. package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
  19. package/dist/vendor/core/capabilities/registry.js +2 -0
  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 +3 -3
  23. package/skills/quantbrasil/SKILL.md +9 -6
  24. package/skills/quantbrasil/references/cli.md +21 -4
  25. package/skills/quantbrasil/references/cointegration.md +40 -0
  26. package/skills/quantbrasil/references/costs.md +2 -1
  27. package/skills/quantbrasil/references/quality-eval-queries.json +20 -0
  28. package/skills/quantbrasil/references/rankings.md +5 -3
  29. package/skills/quantbrasil/references/unsupported.md +2 -0
  30. package/skills/quantbrasil/references/workflows.md +25 -3
package/README.md CHANGED
@@ -76,6 +76,7 @@ quantbrasil holdings var 182 --years 1 --confidence 95
76
76
  quantbrasil rankings list
77
77
  quantbrasil rankings current --system momentum-90d --top 20
78
78
  quantbrasil rankings current --system magic-formula --top 10
79
+ quantbrasil rankings current --system low-risk --top 30
79
80
  quantbrasil rankings current --id 123 --top 20
80
81
  quantbrasil screening universes
81
82
  quantbrasil screening indicators
@@ -1,5 +1,6 @@
1
1
  import { Command } from "commander";
2
2
  import { type CapabilitiesCommandIO, runCapabilitiesCommand } from "../commands/capabilities.js";
3
+ import { runCointegrationPairCommand } from "../commands/cointegration.js";
3
4
  import { runMarketAssetsCommand, runMarketPriceCommand } from "../commands/market.js";
4
5
  import { runInitCommand } from "../commands/init.js";
5
6
  import { runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand } from "../commands/portfolios.js";
@@ -31,6 +32,7 @@ export { runCapabilitiesCommand, runStatusCommand };
31
32
  export { runInitCommand };
32
33
  export { runMarketAssetsCommand, runMarketPriceCommand };
33
34
  export { runRankingsCurrentCommand, runRankingsListCommand };
35
+ export { runCointegrationPairCommand };
34
36
  export { runScreeningIndicatorsCommand, runScreeningRunCommand, runScreeningUniversesCommand, };
35
37
  export { runHoldingBetaCommand, runHoldingCreateCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, };
36
38
  export { runSkillsInstallCommand };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"A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E,mBAAmB,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAsFzE;AAeD,wBAAsB,GAAG,CACvB,IAAI,WAAe,EACnB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAoCD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,CAAC;AACvC,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,GAC7B,CAAC;AACF,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,yBAAyB,GAC1B,CAAC;AACF,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
package/dist/cli/index.js CHANGED
@@ -3,6 +3,7 @@ import { Command } from "commander";
3
3
  import { registerAssetsCommands, } from "../commands/assets.js";
4
4
  import { registerAuthCommands, runAuthWhoamiCommand, } from "../commands/auth.js";
5
5
  import { registerCapabilitiesCommand, runCapabilitiesCommand, } from "../commands/capabilities.js";
6
+ import { registerCointegrationCommands, runCointegrationPairCommand, } from "../commands/cointegration.js";
6
7
  import { registerMarketCommands, runMarketAssetsCommand, runMarketPriceCommand, } from "../commands/market.js";
7
8
  import { registerInitCommand, runInitCommand, } from "../commands/init.js";
8
9
  import { registerPortfoliosCommands, runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, } from "../commands/portfolios.js";
@@ -50,6 +51,11 @@ export function createCliProgram(options = {}) {
50
51
  env: options.env,
51
52
  fetch: options.fetch,
52
53
  };
54
+ const cointegrationContext = {
55
+ io: options.io,
56
+ env: options.env,
57
+ fetch: options.fetch,
58
+ };
53
59
  const screeningContext = {
54
60
  io: options.io,
55
61
  env: options.env,
@@ -87,6 +93,7 @@ export function createCliProgram(options = {}) {
87
93
  registerMarketCommands(program, marketContext);
88
94
  registerPortfoliosCommands(program, portfoliosContext);
89
95
  registerRankingsCommands(program, rankingsContext);
96
+ registerCointegrationCommands(program, cointegrationContext);
90
97
  registerScreeningCommands(program, screeningContext);
91
98
  registerSkillsCommands(program, skillsContext);
92
99
  registerUpdateCommand(program, updateContext);
@@ -156,6 +163,7 @@ export { runCapabilitiesCommand, runStatusCommand };
156
163
  export { runInitCommand };
157
164
  export { runMarketAssetsCommand, runMarketPriceCommand };
158
165
  export { runRankingsCurrentCommand, runRankingsListCommand };
166
+ export { runCointegrationPairCommand };
159
167
  export { runScreeningIndicatorsCommand, runScreeningRunCommand, runScreeningUniversesCommand, };
160
168
  export { runHoldingBetaCommand, runHoldingCreateCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, };
161
169
  export { runSkillsInstallCommand };
@@ -0,0 +1,52 @@
1
+ import { Command } from "commander";
2
+ import type { JsonValue } from "../vendor/core/index.js";
3
+ import { type CliInvokeContext } from "../cli/client.js";
4
+ import { type TerminalWriter } from "../cli/terminal.js";
5
+ export interface CointegrationCommandIO {
6
+ stdout: TerminalWriter;
7
+ }
8
+ export interface CointegrationPairCommandOptions {
9
+ window?: string;
10
+ json?: boolean;
11
+ }
12
+ export interface CointegrationZScorePoint {
13
+ [key: string]: JsonValue;
14
+ date: string;
15
+ zscore: number | null;
16
+ }
17
+ export interface CointegrationBetaPoint {
18
+ [key: string]: JsonValue;
19
+ date: string;
20
+ slope: number | null;
21
+ }
22
+ export interface CointegrationPairResponse {
23
+ [key: string]: JsonValue;
24
+ ok: boolean;
25
+ summary_markdown: string;
26
+ base_asset: string;
27
+ comparison_asset: string;
28
+ window: number;
29
+ beta: number | null;
30
+ beta_std: number | null;
31
+ beta_mean: number | null;
32
+ beta_volatility: number | null;
33
+ adf: number | null;
34
+ p_value: number | null;
35
+ confidence: number | null;
36
+ halflife: number | null;
37
+ critical_values: Record<string, number>;
38
+ zscore_series: CointegrationZScorePoint[];
39
+ beta_series: CointegrationBetaPoint[];
40
+ }
41
+ export interface CointegrationCommandContext extends CliInvokeContext {
42
+ io?: CointegrationCommandIO;
43
+ }
44
+ type JsonRecord = {
45
+ [key: string]: JsonValue;
46
+ };
47
+ export declare function registerCointegrationCommands(program: Command, context?: CointegrationCommandContext): void;
48
+ export declare function runCointegrationPairCommand(baseAsset: string, comparisonAsset: string, options: CointegrationPairCommandOptions, context?: CointegrationCommandContext): Promise<void>;
49
+ export declare function buildCointegrationPairInput(baseAsset: string, comparisonAsset: string, options: CointegrationPairCommandOptions): JsonRecord;
50
+ export declare function formatCointegrationPairHuman(data: CointegrationPairResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
51
+ export {};
52
+ //# sourceMappingURL=cointegration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cointegration.d.ts","sourceRoot":"","sources":["../../src/commands/cointegration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,aAAa,EAAE,wBAAwB,EAAE,CAAC;IAC1C,WAAW,EAAE,sBAAsB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,2BAA4B,SAAQ,gBAAgB;IACnE,EAAE,CAAC,EAAE,sBAAsB,CAAC;CAC7B;AAED,KAAK,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE/C,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,2BAAgC,GACxC,IAAI,CA6BN;AAED,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,+BAA+B,EACxC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,+BAA+B,GACvC,UAAU,CAkBZ;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,yBAAyB,EAC/B,KAAK,6CAAsC,GAC1C,MAAM,CAiDR"}
@@ -0,0 +1,118 @@
1
+ import { invokeCliCapability } from "../cli/client.js";
2
+ import { createCliValidationError } from "../cli/errors.js";
3
+ import { createTerminalTheme } from "../cli/terminal.js";
4
+ export function registerCointegrationCommands(program, context = {}) {
5
+ const cointegrationCommand = program
6
+ .command("cointegration")
7
+ .description("Calcula cointegração para análise de Long & Short");
8
+ cointegrationCommand
9
+ .command("pair")
10
+ .description("Calcula cointegração para análise de Long & Short")
11
+ .argument("<base_asset>", "Ticker do ativo base, por exemplo PETR4")
12
+ .argument("<comparison_asset>", "Ticker do ativo de comparação, por exemplo VALE3")
13
+ .option("--window <n>", "Janela de candles (padrão 250)")
14
+ .option("--json", "Exibe saída JSON")
15
+ .action(async (baseAsset, comparisonAsset, options) => {
16
+ await runCointegrationPairCommand(baseAsset, comparisonAsset, options, context);
17
+ });
18
+ }
19
+ export async function runCointegrationPairCommand(baseAsset, comparisonAsset, options, context = {}) {
20
+ const stdout = context.io?.stdout ?? process.stdout;
21
+ const theme = createTerminalTheme(stdout, context.env ?? process.env);
22
+ const response = await invokeCliCapability({
23
+ capability: "cointegration.pair",
24
+ input: buildCointegrationPairInput(baseAsset, comparisonAsset, options),
25
+ env: context.env,
26
+ fetch: context.fetch,
27
+ });
28
+ if (options.json) {
29
+ stdout.write(`${JSON.stringify(response.data, null, 2)}\n`);
30
+ return;
31
+ }
32
+ stdout.write(`${formatCointegrationPairHuman(response.data, theme)}\n`);
33
+ }
34
+ export function buildCointegrationPairInput(baseAsset, comparisonAsset, options) {
35
+ const normalizedBase = normalizeTicker(baseAsset, "base_asset");
36
+ const normalizedComparison = normalizeTicker(comparisonAsset, "comparison_asset");
37
+ if (normalizedBase === normalizedComparison) {
38
+ throw createCliValidationError("Os ativos base e de comparação devem ser diferentes.");
39
+ }
40
+ return {
41
+ base_asset: normalizedBase,
42
+ comparison_asset: normalizedComparison,
43
+ window: parseWindowOption(options.window),
44
+ };
45
+ }
46
+ export function formatCointegrationPairHuman(data, theme = createTerminalTheme(process.stdout)) {
47
+ const lines = [
48
+ theme.label("Cointegração / Long & Short entre ativos"),
49
+ "",
50
+ theme.bold(`${data.base_asset} x ${data.comparison_asset}`),
51
+ `${theme.label("Janela:")} ${formatInteger(data.window)} candles`,
52
+ "",
53
+ ];
54
+ lines.push(`${theme.label("Beta:")} ${formatOptionalNumber(data.beta)}`);
55
+ if (data.beta_mean !== null) {
56
+ lines.push(`${theme.label("Beta médio:")} ${formatNumber(data.beta_mean)}`);
57
+ }
58
+ if (data.beta_std !== null) {
59
+ lines.push(`${theme.label("Beta std:")} ${formatNumber(data.beta_std)}`);
60
+ }
61
+ if (data.beta_volatility !== null) {
62
+ lines.push(`${theme.label("Volatilidade beta:")} ${formatNumber(data.beta_volatility)}`);
63
+ }
64
+ lines.push(`${theme.label("ADF:")} ${formatOptionalNumber(data.adf)}`);
65
+ lines.push(`${theme.label("P-valor:")} ${formatOptionalNumber(data.p_value)}`);
66
+ lines.push(`${theme.label("Confiança:")} ${data.confidence === null ? "n/d" : formatPercent(data.confidence * 100)}`);
67
+ lines.push(`${theme.label("Meia-vida:")} ${formatOptionalNumber(data.halflife)}`);
68
+ const latest = data.zscore_series[data.zscore_series.length - 1];
69
+ if (latest && latest.zscore !== null) {
70
+ lines.push(`${theme.label("Z-score atual:")} ${formatNumber(latest.zscore)} ${theme.dim(`(${latest.date})`)}`);
71
+ }
72
+ lines.push(`${theme.label("Pontos da série de z-score:")} ${formatInteger(data.zscore_series.length)}`);
73
+ lines.push(`${theme.label("Pontos da série de beta:")} ${formatInteger(data.beta_series.length)}`);
74
+ return lines.join("\n");
75
+ }
76
+ function normalizeTicker(rawTicker, label) {
77
+ const normalized = rawTicker.trim().toUpperCase();
78
+ if (!normalized) {
79
+ throw createCliValidationError(`${label} é obrigatório.`);
80
+ }
81
+ return normalized;
82
+ }
83
+ function parseWindowOption(rawWindow) {
84
+ if (rawWindow === undefined) {
85
+ return 250;
86
+ }
87
+ const trimmed = rawWindow.trim();
88
+ if (!trimmed) {
89
+ throw createCliValidationError("--window não pode ser vazio.");
90
+ }
91
+ const parsed = Number.parseInt(trimmed, 10);
92
+ if (!Number.isInteger(parsed) || parsed <= 0 || String(parsed) !== trimmed) {
93
+ throw createCliValidationError("--window deve ser um inteiro positivo.");
94
+ }
95
+ if (parsed < 20 || parsed > 2000) {
96
+ throw createCliValidationError("--window deve estar entre 20 e 2000 candles.");
97
+ }
98
+ return parsed;
99
+ }
100
+ function formatInteger(value) {
101
+ return new Intl.NumberFormat("pt-BR", {
102
+ maximumFractionDigits: 0,
103
+ }).format(value);
104
+ }
105
+ function formatNumber(value) {
106
+ return new Intl.NumberFormat("pt-BR", {
107
+ maximumFractionDigits: 4,
108
+ }).format(value);
109
+ }
110
+ function formatOptionalNumber(value) {
111
+ return value === null ? "n/d" : formatNumber(value);
112
+ }
113
+ function formatPercent(value) {
114
+ return `${new Intl.NumberFormat("pt-BR", {
115
+ maximumFractionDigits: 2,
116
+ minimumFractionDigits: 2,
117
+ }).format(value)}%`;
118
+ }
@@ -0,0 +1,52 @@
1
+ export declare const cointegrationCapabilities: readonly [{
2
+ readonly id: "cointegration.pair";
3
+ readonly kind: "read";
4
+ readonly visibility: readonly ["cli", "opencode"];
5
+ readonly description: "Calcula cointegração para análise de Long & Short entre dois ativos: z-score, beta, p-valor, meia-vida e intervalos de confiança.";
6
+ readonly http: {
7
+ readonly method: "POST";
8
+ readonly path: "/api/desk/tools/cointegration/pair";
9
+ readonly inputMode: "json_body";
10
+ readonly schemas: {
11
+ readonly request: "CointegrationPairRequest";
12
+ readonly response: "CointegrationPairResponse";
13
+ };
14
+ };
15
+ readonly cli: {
16
+ readonly group: "cointegration";
17
+ readonly command: "pair";
18
+ readonly summary: "Calcula cointegração para análise de Long & Short.";
19
+ readonly positional: readonly [{
20
+ readonly kind: "positional";
21
+ readonly name: "base_asset";
22
+ readonly type: "string";
23
+ readonly required: true;
24
+ readonly placeholder: "TICKER";
25
+ readonly description: "Ticker do ativo base, por exemplo PETR4.";
26
+ }, {
27
+ readonly kind: "positional";
28
+ readonly name: "comparison_asset";
29
+ readonly type: "string";
30
+ readonly required: true;
31
+ readonly placeholder: "TICKER";
32
+ readonly description: "Ticker do ativo de comparação, por exemplo VALE3.";
33
+ }];
34
+ readonly options: readonly [{
35
+ readonly kind: "option";
36
+ readonly flag: "--window";
37
+ readonly name: "window";
38
+ readonly type: "integer";
39
+ readonly required: false;
40
+ readonly placeholder: "N";
41
+ readonly defaultValue: 250;
42
+ readonly description: "Janela de candles para a regressão. Padrão 250 dias úteis.";
43
+ }];
44
+ readonly examples: readonly ["quantbrasil cointegration pair PETR4 VALE3", "quantbrasil cointegration pair PETR4 VALE3 --window 120", "quantbrasil cointegration pair PETR4 VALE3 --json"];
45
+ };
46
+ readonly tool: {
47
+ readonly name: "qb_cointegration_pair";
48
+ readonly title: "Calcular cointegração para Long & Short";
49
+ };
50
+ readonly outputModes: readonly ["json", "human"];
51
+ }];
52
+ //# sourceMappingURL=cointegration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cointegration.d.ts","sourceRoot":"","sources":["../../src/capabilities/cointegration.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+Dc,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { publicRuntimeVisibility, standardOutputModes } from "./shared.js";
2
+ export const cointegrationCapabilities = [
3
+ {
4
+ id: "cointegration.pair",
5
+ kind: "read",
6
+ visibility: publicRuntimeVisibility,
7
+ description: "Calcula cointegração para análise de Long & Short entre dois ativos: z-score, beta, p-valor, meia-vida e intervalos de confiança.",
8
+ http: {
9
+ method: "POST",
10
+ path: "/api/desk/tools/cointegration/pair",
11
+ inputMode: "json_body",
12
+ schemas: {
13
+ request: "CointegrationPairRequest",
14
+ response: "CointegrationPairResponse",
15
+ },
16
+ },
17
+ cli: {
18
+ group: "cointegration",
19
+ command: "pair",
20
+ summary: "Calcula cointegração para análise de Long & Short.",
21
+ positional: [
22
+ {
23
+ kind: "positional",
24
+ name: "base_asset",
25
+ type: "string",
26
+ required: true,
27
+ placeholder: "TICKER",
28
+ description: "Ticker do ativo base, por exemplo PETR4.",
29
+ },
30
+ {
31
+ kind: "positional",
32
+ name: "comparison_asset",
33
+ type: "string",
34
+ required: true,
35
+ placeholder: "TICKER",
36
+ description: "Ticker do ativo de comparação, por exemplo VALE3.",
37
+ },
38
+ ],
39
+ options: [
40
+ {
41
+ kind: "option",
42
+ flag: "--window",
43
+ name: "window",
44
+ type: "integer",
45
+ required: false,
46
+ placeholder: "N",
47
+ defaultValue: 250,
48
+ description: "Janela de candles para a regressão. Padrão 250 dias úteis.",
49
+ },
50
+ ],
51
+ examples: [
52
+ "quantbrasil cointegration pair PETR4 VALE3",
53
+ "quantbrasil cointegration pair PETR4 VALE3 --window 120",
54
+ "quantbrasil cointegration pair PETR4 VALE3 --json",
55
+ ],
56
+ },
57
+ tool: {
58
+ name: "qb_cointegration_pair",
59
+ title: "Calcular cointegração para Long & Short",
60
+ },
61
+ outputModes: standardOutputModes,
62
+ },
63
+ ];
@@ -5,5 +5,6 @@ export * from "./assets.js";
5
5
  export * from "./rankings.js";
6
6
  export * from "./screening.js";
7
7
  export * from "./portfolios.js";
8
+ export * from "./cointegration.js";
8
9
  export * from "./registry.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
@@ -5,4 +5,5 @@ export * from "./assets.js";
5
5
  export * from "./rankings.js";
6
6
  export * from "./screening.js";
7
7
  export * from "./portfolios.js";
8
+ export * from "./cointegration.js";
8
9
  export * from "./registry.js";
@@ -52,7 +52,7 @@ export declare const rankingsCapabilities: readonly [{
52
52
  readonly required: false;
53
53
  readonly placeholder: "SLUG";
54
54
  readonly exclusiveGroup: "ranking_selector";
55
- readonly description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d.";
55
+ readonly description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d ou low-risk.";
56
56
  }, {
57
57
  readonly kind: "option";
58
58
  readonly flag: "--id";
@@ -72,7 +72,7 @@ export declare const rankingsCapabilities: readonly [{
72
72
  readonly defaultValue: 20;
73
73
  readonly description: "Número de ativos do topo do ranking a retornar.";
74
74
  }];
75
- readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --id 123 --top 20"];
75
+ readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --system low-risk --top 30", "quantbrasil rankings current --id 123 --top 20"];
76
76
  };
77
77
  readonly tool: {
78
78
  readonly name: "qb_rankings_current";
@@ -1 +1 @@
1
- {"version":3,"file":"rankings.d.ts","sourceRoot":"","sources":["../../src/capabilities/rankings.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgGmB,CAAC"}
1
+ {"version":3,"file":"rankings.d.ts","sourceRoot":"","sources":["../../src/capabilities/rankings.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiGmB,CAAC"}
@@ -57,7 +57,7 @@ export const rankingsCapabilities = [
57
57
  required: false,
58
58
  placeholder: "SLUG",
59
59
  exclusiveGroup: rankingSelectorExclusiveGroup,
60
- description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d.",
60
+ description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d ou low-risk.",
61
61
  },
62
62
  {
63
63
  kind: "option",
@@ -83,6 +83,7 @@ export const rankingsCapabilities = [
83
83
  examples: [
84
84
  "quantbrasil rankings current --system momentum-90d --top 20",
85
85
  "quantbrasil rankings current --system magic-formula --top 10",
86
+ "quantbrasil rankings current --system low-risk --top 30",
86
87
  "quantbrasil rankings current --id 123 --top 20",
87
88
  ],
88
89
  },
@@ -192,7 +192,7 @@ export declare const capabilityRegistry: readonly [{
192
192
  readonly required: false;
193
193
  readonly placeholder: "SLUG";
194
194
  readonly exclusiveGroup: "ranking_selector";
195
- readonly description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d.";
195
+ readonly description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d ou low-risk.";
196
196
  }, {
197
197
  readonly kind: "option";
198
198
  readonly flag: "--id";
@@ -212,7 +212,7 @@ export declare const capabilityRegistry: readonly [{
212
212
  readonly defaultValue: 20;
213
213
  readonly description: "Número de ativos do topo do ranking a retornar.";
214
214
  }];
215
- readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --id 123 --top 20"];
215
+ readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --system low-risk --top 30", "quantbrasil rankings current --id 123 --top 20"];
216
216
  };
217
217
  readonly tool: {
218
218
  readonly name: "qb_rankings_current";
@@ -970,6 +970,56 @@ export declare const capabilityRegistry: readonly [{
970
970
  readonly title: "Calculate holding VaR";
971
971
  };
972
972
  readonly outputModes: readonly ["json", "human"];
973
+ }, {
974
+ readonly id: "cointegration.pair";
975
+ readonly kind: "read";
976
+ readonly visibility: readonly ["cli", "opencode"];
977
+ readonly description: "Calcula cointegração para análise de Long & Short entre dois ativos: z-score, beta, p-valor, meia-vida e intervalos de confiança.";
978
+ readonly http: {
979
+ readonly method: "POST";
980
+ readonly path: "/api/desk/tools/cointegration/pair";
981
+ readonly inputMode: "json_body";
982
+ readonly schemas: {
983
+ readonly request: "CointegrationPairRequest";
984
+ readonly response: "CointegrationPairResponse";
985
+ };
986
+ };
987
+ readonly cli: {
988
+ readonly group: "cointegration";
989
+ readonly command: "pair";
990
+ readonly summary: "Calcula cointegração para análise de Long & Short.";
991
+ readonly positional: readonly [{
992
+ readonly kind: "positional";
993
+ readonly name: "base_asset";
994
+ readonly type: "string";
995
+ readonly required: true;
996
+ readonly placeholder: "TICKER";
997
+ readonly description: "Ticker do ativo base, por exemplo PETR4.";
998
+ }, {
999
+ readonly kind: "positional";
1000
+ readonly name: "comparison_asset";
1001
+ readonly type: "string";
1002
+ readonly required: true;
1003
+ readonly placeholder: "TICKER";
1004
+ readonly description: "Ticker do ativo de comparação, por exemplo VALE3.";
1005
+ }];
1006
+ readonly options: readonly [{
1007
+ readonly kind: "option";
1008
+ readonly flag: "--window";
1009
+ readonly name: "window";
1010
+ readonly type: "integer";
1011
+ readonly required: false;
1012
+ readonly placeholder: "N";
1013
+ readonly defaultValue: 250;
1014
+ readonly description: "Janela de candles para a regressão. Padrão 250 dias úteis.";
1015
+ }];
1016
+ readonly examples: readonly ["quantbrasil cointegration pair PETR4 VALE3", "quantbrasil cointegration pair PETR4 VALE3 --window 120", "quantbrasil cointegration pair PETR4 VALE3 --json"];
1017
+ };
1018
+ readonly tool: {
1019
+ readonly name: "qb_cointegration_pair";
1020
+ readonly title: "Calcular cointegração para Long & Short";
1021
+ };
1022
+ readonly outputModes: readonly ["json", "human"];
973
1023
  }];
974
1024
  export type CapabilityId = (typeof capabilityRegistry)[number]["id"];
975
1025
  export declare const capabilityRegistryById: Record<CapabilityId, (typeof capabilityRegistry)[number]>;
@@ -1167,7 +1217,7 @@ export declare function getCapabilityById(id: CapabilityId): {
1167
1217
  readonly required: false;
1168
1218
  readonly placeholder: "SLUG";
1169
1219
  readonly exclusiveGroup: "ranking_selector";
1170
- readonly description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d.";
1220
+ readonly description: "Slug de ranking do sistema retornado por `rankings list`, por exemplo momentum-90d ou low-risk.";
1171
1221
  }, {
1172
1222
  readonly kind: "option";
1173
1223
  readonly flag: "--id";
@@ -1187,7 +1237,7 @@ export declare function getCapabilityById(id: CapabilityId): {
1187
1237
  readonly defaultValue: 20;
1188
1238
  readonly description: "Número de ativos do topo do ranking a retornar.";
1189
1239
  }];
1190
- readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --id 123 --top 20"];
1240
+ readonly examples: readonly ["quantbrasil rankings current --system momentum-90d --top 20", "quantbrasil rankings current --system magic-formula --top 10", "quantbrasil rankings current --system low-risk --top 30", "quantbrasil rankings current --id 123 --top 20"];
1191
1241
  };
1192
1242
  readonly tool: {
1193
1243
  readonly name: "qb_rankings_current";
@@ -1945,5 +1995,55 @@ export declare function getCapabilityById(id: CapabilityId): {
1945
1995
  readonly title: "Calculate holding VaR";
1946
1996
  };
1947
1997
  readonly outputModes: readonly ["json", "human"];
1998
+ } | {
1999
+ readonly id: "cointegration.pair";
2000
+ readonly kind: "read";
2001
+ readonly visibility: readonly ["cli", "opencode"];
2002
+ readonly description: "Calcula cointegração para análise de Long & Short entre dois ativos: z-score, beta, p-valor, meia-vida e intervalos de confiança.";
2003
+ readonly http: {
2004
+ readonly method: "POST";
2005
+ readonly path: "/api/desk/tools/cointegration/pair";
2006
+ readonly inputMode: "json_body";
2007
+ readonly schemas: {
2008
+ readonly request: "CointegrationPairRequest";
2009
+ readonly response: "CointegrationPairResponse";
2010
+ };
2011
+ };
2012
+ readonly cli: {
2013
+ readonly group: "cointegration";
2014
+ readonly command: "pair";
2015
+ readonly summary: "Calcula cointegração para análise de Long & Short.";
2016
+ readonly positional: readonly [{
2017
+ readonly kind: "positional";
2018
+ readonly name: "base_asset";
2019
+ readonly type: "string";
2020
+ readonly required: true;
2021
+ readonly placeholder: "TICKER";
2022
+ readonly description: "Ticker do ativo base, por exemplo PETR4.";
2023
+ }, {
2024
+ readonly kind: "positional";
2025
+ readonly name: "comparison_asset";
2026
+ readonly type: "string";
2027
+ readonly required: true;
2028
+ readonly placeholder: "TICKER";
2029
+ readonly description: "Ticker do ativo de comparação, por exemplo VALE3.";
2030
+ }];
2031
+ readonly options: readonly [{
2032
+ readonly kind: "option";
2033
+ readonly flag: "--window";
2034
+ readonly name: "window";
2035
+ readonly type: "integer";
2036
+ readonly required: false;
2037
+ readonly placeholder: "N";
2038
+ readonly defaultValue: 250;
2039
+ readonly description: "Janela de candles para a regressão. Padrão 250 dias úteis.";
2040
+ }];
2041
+ readonly examples: readonly ["quantbrasil cointegration pair PETR4 VALE3", "quantbrasil cointegration pair PETR4 VALE3 --window 120", "quantbrasil cointegration pair PETR4 VALE3 --json"];
2042
+ };
2043
+ readonly tool: {
2044
+ readonly name: "qb_cointegration_pair";
2045
+ readonly title: "Calcular cointegração para Long & Short";
2046
+ };
2047
+ readonly outputModes: readonly ["json", "human"];
1948
2048
  };
1949
2049
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjD"}
@@ -1,4 +1,5 @@
1
1
  import { assetCapabilities } from "./assets.js";
2
+ import { cointegrationCapabilities } from "./cointegration.js";
2
3
  import { marketCapabilities } from "./market.js";
3
4
  import { portfolioCapabilities } from "./portfolios.js";
4
5
  import { rankingsCapabilities } from "./rankings.js";
@@ -9,6 +10,7 @@ export const capabilityRegistry = [
9
10
  ...rankingsCapabilities,
10
11
  ...screeningCapabilities,
11
12
  ...portfolioCapabilities,
13
+ ...cointegrationCapabilities,
12
14
  ];
13
15
  export const capabilityRegistryById = Object.fromEntries(capabilityRegistry.map(capability => [capability.id, capability]));
14
16
  export function getCapabilityById(id) {
@@ -1,6 +1,6 @@
1
1
  export type CapabilityVisibility = "cli" | "opencode";
2
2
  export type CapabilityKind = "read" | "mutation";
3
- export type CapabilityGroup = "market" | "assets" | "rankings" | "screening" | "watchlists" | "holdings";
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,GACvB,QA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CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gCACf,SAAQ,0BAA0B;IAClC,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,WAAW,4BACf,SAAQ,0BAA0B;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,MAAM,sBAAsB,GAC9B,gCAAgC,GAChC,4BAA4B,CAAC;AAEjC,wDAAwD;AACxD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,eAAe,CAAC;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.10",
3
+ "version": "0.1.0-beta.11",
4
4
  "type": "module",
5
5
  "description": "Public QuantBrasil CLI for deterministic operations",
6
6
  "repository": {
@@ -41,8 +41,8 @@
41
41
  "typescript": "^5.3.3",
42
42
  "vitest": "^3.2.4",
43
43
  "@repo/core": "0.0.0",
44
- "@repo/eslint-config": "0.0.0",
45
- "@repo/typescript-config": "0.0.0"
44
+ "@repo/typescript-config": "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,20 +1,21 @@
1
1
  ---
2
2
  name: quantbrasil
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, historical return, beta, and VaR, even if they do not explicitly mention QuantBrasil.
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 the user asks for market or investing data/actions that QuantBrasil supports, including asset lookup, prices, asset analysis, rankings, watchlists, holdings, screening, and holding metrics.
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
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, 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, watchlist, holding, or holding metric data, use the CLI before generic web or finance search.
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
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, top ranked assets, ranking fatorial, rankings do usuário, or ordered asset lists, load [`references/rankings.md`](./references/rankings.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
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.
18
19
  - Use `quantbrasil` when available on PATH.
19
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.
20
21
  - Check readiness first: `quantbrasil --status`
@@ -28,6 +29,7 @@ Use this skill when the user asks for market or investing data/actions that Quan
28
29
  - watchlist details and changes: `quantbrasil watchlists ...`
29
30
  - holding details and historical return: `quantbrasil holdings ...`
30
31
  - indicator screening over saved universes: `quantbrasil screening universes|indicators|run ...`
32
+ - pair cointegration: `quantbrasil cointegration pair <base_asset> <comparison_asset>`
31
33
  - holding metrics: `quantbrasil holdings historical-return|beta|var ...`
32
34
  - Use `--json` when output will be parsed by agent or script
33
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.
@@ -37,9 +39,10 @@ Use this skill when the user asks for market or investing data/actions that Quan
37
39
 
38
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.
39
41
  - Load [`references/cli.md`](./references/cli.md) when you need exact command syntax, flags, examples, or supported `--sections` values.
40
- - Load [`references/rankings.md`](./references/rankings.md) when the user asks for Magic Formula, momentum rankings, top ranked assets, ranking fatorial, rankings do usuário, or current ordered lists.
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.
41
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.
42
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.
43
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.
44
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.
45
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.
@@ -53,6 +53,7 @@ quantbrasil rankings list
53
53
  quantbrasil rankings list --json
54
54
  quantbrasil rankings current --system momentum-90d --top 20
55
55
  quantbrasil rankings current --system magic-formula --top 10
56
+ quantbrasil rankings current --system low-risk --top 30
56
57
  quantbrasil rankings current --id 123 --top 20
57
58
  quantbrasil rankings current --system momentum-90d --top 20 --json
58
59
  ```
@@ -60,7 +61,7 @@ quantbrasil rankings current --system momentum-90d --top 20 --json
60
61
  Rules:
61
62
 
62
63
  - use `rankings list` to discover rankings before using ids
63
- - system rankings use slugs such as `magic-formula`, `momentum-90d`, `dividend-yield`, and `momentum-double`
64
+ - system rankings use slugs such as `magic-formula`, `momentum-90d`, `dividend-yield`, `low-risk`, and `momentum-double`
64
65
  - user rankings use the numeric id returned by `rankings list`
65
66
  - use exactly one selector: `--system <slug>` or `--id <id>`
66
67
  - `--top` controls how many ranked assets are returned
@@ -120,9 +121,6 @@ Rules:
120
121
  - `--limit` and `--sort` override only top-level fields from the query JSON
121
122
  - use `screening indicators` to discover supported indicator names, params, examples, timeframes, and operators
122
123
 
123
- Load [`screening.md`](./screening.md) for detailed screening examples, including
124
- IFR14, IFR2, and logical `AND` JSON payloads.
125
-
126
124
  Example query JSON:
127
125
 
128
126
  ```json
@@ -151,3 +149,22 @@ Example query JSON:
151
149
  "sort": "ticker"
152
150
  }
153
151
  ```
152
+
153
+ Load [`screening.md`](./screening.md) for detailed screening examples, including
154
+ IFR14, IFR2, and logical `AND` JSON payloads.
155
+
156
+ ## Cointegration
157
+
158
+ ```bash
159
+ quantbrasil cointegration pair PETR4 VALE3
160
+ quantbrasil cointegration pair PETR4 VALE3 --window 120
161
+ quantbrasil cointegration pair PETR4 VALE3 --json
162
+ ```
163
+
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.
@@ -16,6 +16,7 @@ Current guidance uses backend qualitative classes only:
16
16
  - `screening universes` is a discovery path for saved screening universes
17
17
  - `screening indicators` is a discovery path for supported screening JSON
18
18
  - `screening run` is a heavy read and should be targeted to one selected universe
19
+ - `cointegration pair` is a heavy read and should be targeted to one explicit pair
19
20
  - holding metrics (`historical-return`, `beta`, `var`) are heaviest current public reads
20
21
 
21
22
  ## Agent rules
@@ -25,7 +26,7 @@ Current guidance uses backend qualitative classes only:
25
26
  - run `screening universes` before `screening run` when the universe selector is not known
26
27
  - run `screening indicators` before `screening run` when the indicator JSON is not known
27
28
  - prefer one holding metric call targeted to actual question
28
- - do not chain multiple heavy holding metric or screening calls unless user asked for them
29
+ - do not chain multiple heavy holding metric, screening, or cointegration calls unless user asked for them
29
30
  - use `--json` only when structured output needed
30
31
 
31
32
  ## Safe defaults
@@ -54,6 +54,21 @@
54
54
  "should_trigger": true,
55
55
  "expected_behavior": "Use screening run with one explicit --system selector and a ScreenerRequest JSON payload."
56
56
  },
57
+ {
58
+ "query": "Rode cointegração entre PETR4 e VALE3.",
59
+ "should_trigger": true,
60
+ "expected_behavior": "Load cointegration guidance and use quantbrasil cointegration pair PETR4 VALE3."
61
+ },
62
+ {
63
+ "query": "Quero fazer Long & Short entre PETR4 e VALE3.",
64
+ "should_trigger": true,
65
+ "expected_behavior": "Load cointegration guidance and use quantbrasil cointegration pair PETR4 VALE3 as the Long & Short pair analysis surface."
66
+ },
67
+ {
68
+ "query": "Quais pares cointegrados existem nesse universo?",
69
+ "should_trigger": true,
70
+ "expected_behavior": "Load unsupported guidance; explain that public CLI supports explicit pair cointegration but not universe-wide pair scans."
71
+ },
57
72
  {
58
73
  "query": "A CLI retornou auth_failed quando tentei buscar PETR4.",
59
74
  "should_trigger": true,
@@ -99,6 +114,11 @@
99
114
  "should_trigger": true,
100
115
  "expected_behavior": "Load unsupported guidance; do not invent ad-hoc ticker-list screening."
101
116
  },
117
+ {
118
+ "query": "Run a long and short analysis between PETR4 and VALE3.",
119
+ "should_trigger": true,
120
+ "expected_behavior": "Load cointegration guidance and use quantbrasil cointegration pair PETR4 VALE3 as the long and short pair analysis surface."
121
+ },
102
122
  {
103
123
  "query": "Implemente um novo comando na CLI dentro do repositório do QuantBrasil.",
104
124
  "should_trigger": false,
@@ -1,8 +1,8 @@
1
1
  # Rankings
2
2
 
3
3
  Use rankings for order-first questions: Magic Formula, momentum leaders,
4
- dividend-yield leaders, Momentum Double, or saved user rankings. A ranking
5
- returns an ordered asset list plus the metric used to order it.
4
+ dividend-yield leaders, Low Risk, Momentum Double, or saved user rankings. A
5
+ ranking returns an ordered asset list plus the metric used to order it.
6
6
 
7
7
  ## Discovery
8
8
 
@@ -25,6 +25,7 @@ System ranking:
25
25
  ```bash
26
26
  quantbrasil rankings current --system momentum-90d --top 20
27
27
  quantbrasil rankings current --system magic-formula --top 10
28
+ quantbrasil rankings current --system low-risk --top 30
28
29
  ```
29
30
 
30
31
  User ranking:
@@ -36,7 +37,7 @@ quantbrasil rankings current --id 123 --top 20
36
37
  Rules:
37
38
 
38
39
  - use exactly one selector: `--system` for system rankings or `--id` for user rankings
39
- - system rankings use slugs such as `momentum-90d` or `magic-formula`
40
+ - system rankings use slugs such as `momentum-90d`, `magic-formula`, or `low-risk`
40
41
  - user rankings use the numeric id shown under "Meus rankings"
41
42
  - `--top` is the number of ranked assets to return
42
43
  - use `--json` when another step needs to parse tickers, rank, score, or metric values
@@ -48,6 +49,7 @@ Use rankings when the user starts from an ordered list:
48
49
 
49
50
  - "top 20 do momentum"
50
51
  - "top 10 Magic Formula"
52
+ - "top 30 Low Risk"
51
53
  - "meu ranking de qualidade"
52
54
  - "ativos com maior dividend yield"
53
55
 
@@ -6,6 +6,7 @@ Unsupported in the public CLI:
6
6
  - deleting watchlists or holdings
7
7
  - value-based position input for traded assets
8
8
  - ad-hoc ticker-list screening
9
+ - scanning all cointegrated pairs in a universe
9
10
 
10
11
  Not a supported pattern:
11
12
 
@@ -20,6 +21,7 @@ Use the public surface only:
20
21
  - `capabilities`
21
22
  - `market`
22
23
  - `assets`
24
+ - `cointegration`
23
25
  - `screening`
24
26
  - `watchlists`
25
27
  - `holdings`
@@ -5,11 +5,12 @@
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
+ - current ordered asset lists such as Magic Formula, momentum, Low Risk, or user rankings → `rankings list`, then `rankings current`
9
9
  - watchlist details or changes → `watchlists ...`
10
10
  - holding details or changes → `holdings ...`
11
11
  - holding return, beta, risk, VaR, or comparison → `holdings historical-return|beta|var`
12
12
  - indicator screening over saved asset sets → `screening universes`, `screening indicators` when needed, then `screening run`
13
+ - cointegration or Long & Short between two explicit assets → `cointegration pair`
13
14
 
14
15
  ## Find supported ticker, then get price
15
16
 
@@ -66,13 +67,14 @@ Avoid asking for every section unless user clearly wants full report.
66
67
  ## Get current ranked assets
67
68
 
68
69
  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.
70
+ momentum leaders, dividend-yield leaders, Low Risk, Momentum Double, or a saved
71
+ user ranking.
71
72
 
72
73
  ```bash
73
74
  quantbrasil rankings list
74
75
  quantbrasil rankings current --system momentum-90d --top 20
75
76
  quantbrasil rankings current --system magic-formula --top 10
77
+ quantbrasil rankings current --system low-risk --top 30
76
78
  quantbrasil rankings current --id 123 --top 20
77
79
  ```
78
80
 
@@ -123,6 +125,26 @@ Rules:
123
125
  - load `references/screening.md` for IFR/RSI examples and full JSON payloads
124
126
  - use `--json` when the result will be parsed by an agent or script
125
127
 
128
+ ## Run pair cointegration / Long & Short
129
+
130
+ Use this when the user asks to run cointegração, cointegration, Long & Short,
131
+ long and short, long-short, pair trading statistics, z-score, p-value, or
132
+ half-life for two explicit assets.
133
+
134
+ ```bash
135
+ quantbrasil cointegration pair PETR4 VALE3
136
+ quantbrasil cointegration pair PETR4 VALE3 --window 120
137
+ quantbrasil cointegration pair PETR4 VALE3 --json
138
+ ```
139
+
140
+ Rules:
141
+
142
+ - require two explicit tickers
143
+ - frame Long & Short phrasing as pair analysis, not order execution or a guaranteed trade recommendation
144
+ - use `market assets --search` first only if a ticker is ambiguous
145
+ - do not invent a universe scan command for "quais pares cointegrados"; the public CLI currently supports explicit pairs
146
+ - use `--json` if the z-score or beta series will feed another calculation
147
+
126
148
  ## Analyze a theoretical composition
127
149
 
128
150
  Create a holding with target weights, then run holding metrics on its id.