@quantbrasil/cli 0.1.0-beta.4 → 0.1.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/cli/client.js +4 -0
- package/dist/cli/index.d.ts +4 -3
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +15 -4
- package/dist/commands/auth.d.ts +18 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +49 -0
- package/dist/commands/market.d.ts +1 -0
- package/dist/commands/market.d.ts.map +1 -1
- package/dist/commands/market.js +17 -1
- package/dist/commands/portfolios.d.ts +17 -2
- package/dist/commands/portfolios.d.ts.map +1 -1
- package/dist/commands/portfolios.js +127 -4
- package/dist/vendor/core/capabilities/market.d.ts +9 -1
- package/dist/vendor/core/capabilities/market.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/market.js +10 -0
- package/dist/vendor/core/capabilities/portfolios.d.ts +56 -5
- package/dist/vendor/core/capabilities/portfolios.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/portfolios.js +54 -4
- package/dist/vendor/core/capabilities/registry.d.ts +130 -12
- package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/quantbrasil/SKILL.md +1 -0
- package/skills/quantbrasil/references/cli.md +5 -0
- package/skills/quantbrasil/references/portfolios.md +12 -1
- package/skills/quantbrasil/references/unsupported.md +3 -0
- package/skills/quantbrasil/references/workflows.md +7 -2
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ that file only exists inside this package.
|
|
|
29
29
|
```bash
|
|
30
30
|
# from monorepo/packages/cli
|
|
31
31
|
node ./bin/quantbrasil.js auth login --api-key qb_live_<id>.<secret>
|
|
32
|
+
node ./bin/quantbrasil.js whoami
|
|
32
33
|
node ./bin/quantbrasil.js skills install --all
|
|
33
34
|
node ./bin/quantbrasil.js --status
|
|
34
35
|
node ./bin/quantbrasil.js auth logout
|
|
@@ -48,6 +49,7 @@ compatible local or staging backend.
|
|
|
48
49
|
```bash
|
|
49
50
|
quantbrasil market assets
|
|
50
51
|
quantbrasil market assets --type B3
|
|
52
|
+
quantbrasil market assets --search BTC
|
|
51
53
|
quantbrasil market assets --json
|
|
52
54
|
quantbrasil market price PETR4
|
|
53
55
|
quantbrasil market price PETR4 --date 2026-04-10
|
|
@@ -65,7 +67,9 @@ quantbrasil holdings create "Longo Prazo"
|
|
|
65
67
|
quantbrasil holdings create "Longo Prazo" --target PETR4:50 --target VALE3:50
|
|
66
68
|
quantbrasil holdings create "Carteira Real" --mode position
|
|
67
69
|
quantbrasil holdings set-targets 182 PETR4:50 VALE3:50
|
|
70
|
+
quantbrasil holdings set-positions 182 PRIO3:1600 BTC-USD:0.25 QQQ:10
|
|
68
71
|
quantbrasil holdings historical-return 182 --from 2025-01-01 --to 2026-01-01
|
|
72
|
+
quantbrasil holdings historical-return 182 --period 1y
|
|
69
73
|
quantbrasil holdings beta 182 --years 3
|
|
70
74
|
quantbrasil holdings var 182 --years 1 --confidence 95
|
|
71
75
|
```
|
package/dist/cli/client.js
CHANGED
|
@@ -80,6 +80,7 @@ function resolveErrorDetail(payload) {
|
|
|
80
80
|
}
|
|
81
81
|
const detail = payload.detail;
|
|
82
82
|
const message = payload.message;
|
|
83
|
+
const error = payload.error;
|
|
83
84
|
if (typeof detail === "string" && detail.trim()) {
|
|
84
85
|
return detail;
|
|
85
86
|
}
|
|
@@ -94,6 +95,9 @@ function resolveErrorDetail(payload) {
|
|
|
94
95
|
if (typeof message === "string" && message.trim()) {
|
|
95
96
|
return message;
|
|
96
97
|
}
|
|
98
|
+
if (typeof error === "string" && error.trim()) {
|
|
99
|
+
return error;
|
|
100
|
+
}
|
|
97
101
|
return null;
|
|
98
102
|
}
|
|
99
103
|
function formatValidationDetail(value) {
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Command } from "commander";
|
|
|
2
2
|
import { type CapabilitiesCommandIO, runCapabilitiesCommand } from "../commands/capabilities.js";
|
|
3
3
|
import { runMarketAssetsCommand, runMarketPriceCommand } from "../commands/market.js";
|
|
4
4
|
import { runInitCommand } from "../commands/init.js";
|
|
5
|
-
import { runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand } from "../commands/portfolios.js";
|
|
5
|
+
import { runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand } from "../commands/portfolios.js";
|
|
6
6
|
import { runSkillsInstallCommand } from "../commands/skills.js";
|
|
7
7
|
import { runStatusCommand } from "../commands/status.js";
|
|
8
8
|
import { type TerminalWriter } from "./terminal.js";
|
|
@@ -11,6 +11,7 @@ export interface CliProgramOptions {
|
|
|
11
11
|
env?: NodeJS.ProcessEnv;
|
|
12
12
|
fetch?: typeof fetch;
|
|
13
13
|
prompt?: (promptLabel: string) => Promise<string>;
|
|
14
|
+
now?: Date;
|
|
14
15
|
stderr?: TerminalWriter;
|
|
15
16
|
suppressCommanderErrors?: boolean;
|
|
16
17
|
}
|
|
@@ -19,11 +20,11 @@ export interface CliRunOptions extends CliProgramOptions {
|
|
|
19
20
|
}
|
|
20
21
|
export declare function createCliProgram(options?: CliProgramOptions): Command;
|
|
21
22
|
export declare function run(argv?: string[], options?: CliRunOptions): Promise<void>;
|
|
22
|
-
export { runAuthLoginCommand, runAuthLogoutCommand } from "../commands/auth.js";
|
|
23
|
+
export { runAuthLoginCommand, runAuthLogoutCommand, runAuthWhoamiCommand, } from "../commands/auth.js";
|
|
23
24
|
export { runAssetOverviewCommand } from "../commands/assets.js";
|
|
24
25
|
export { runCapabilitiesCommand, runStatusCommand };
|
|
25
26
|
export { runInitCommand };
|
|
26
27
|
export { runMarketAssetsCommand, runMarketPriceCommand };
|
|
27
|
-
export { runHoldingBetaCommand, runHoldingCreateCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, };
|
|
28
|
+
export { runHoldingBetaCommand, runHoldingCreateCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, };
|
|
28
29
|
export { runSkillsInstallCommand };
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,OAAO,EACL,KAAK,qBAAqB,EAE1B,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,cAAc,E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AgB,EAAE,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;AACzD,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"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { registerAssetsCommands, } from "../commands/assets.js";
|
|
4
|
-
import { registerAuthCommands, } from "../commands/auth.js";
|
|
4
|
+
import { registerAuthCommands, runAuthWhoamiCommand, } from "../commands/auth.js";
|
|
5
5
|
import { registerCapabilitiesCommand, runCapabilitiesCommand, } from "../commands/capabilities.js";
|
|
6
6
|
import { registerMarketCommands, runMarketAssetsCommand, runMarketPriceCommand, } from "../commands/market.js";
|
|
7
7
|
import { registerInitCommand, runInitCommand, } from "../commands/init.js";
|
|
8
|
-
import { registerPortfoliosCommands, runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, } from "../commands/portfolios.js";
|
|
8
|
+
import { registerPortfoliosCommands, runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, } from "../commands/portfolios.js";
|
|
9
9
|
import { registerSkillsCommands, runSkillsInstallCommand, } from "../commands/skills.js";
|
|
10
10
|
import { registerStatusFlag, runStatusCommand, } from "../commands/status.js";
|
|
11
11
|
import { buildCliErrorPayload, formatCliErrorMessage, normalizeCliError, shouldEmitJsonError, } from "./errors.js";
|
|
@@ -40,6 +40,7 @@ export function createCliProgram(options = {}) {
|
|
|
40
40
|
io: options.io,
|
|
41
41
|
env: options.env,
|
|
42
42
|
fetch: options.fetch,
|
|
43
|
+
now: options.now,
|
|
43
44
|
};
|
|
44
45
|
const skillsContext = {
|
|
45
46
|
io: options.io,
|
|
@@ -59,6 +60,7 @@ export function createCliProgram(options = {}) {
|
|
|
59
60
|
configureCommanderOutput(program, options);
|
|
60
61
|
registerCapabilitiesCommand(program, options.io);
|
|
61
62
|
registerAuthCommands(program, authContext);
|
|
63
|
+
registerWhoamiCommand(program, authContext);
|
|
62
64
|
registerAssetsCommands(program, assetsContext);
|
|
63
65
|
registerInitCommand(program, initContext);
|
|
64
66
|
registerMarketCommands(program, marketContext);
|
|
@@ -67,6 +69,15 @@ export function createCliProgram(options = {}) {
|
|
|
67
69
|
registerStatusFlag(program, statusContext);
|
|
68
70
|
return program;
|
|
69
71
|
}
|
|
72
|
+
function registerWhoamiCommand(program, context) {
|
|
73
|
+
program
|
|
74
|
+
.command("whoami")
|
|
75
|
+
.description("Show the authenticated QuantBrasil user")
|
|
76
|
+
.option("--json", "Show JSON output")
|
|
77
|
+
.action(async (options) => {
|
|
78
|
+
await runAuthWhoamiCommand(options, context);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
70
81
|
export async function run(argv = process.argv, options = {}) {
|
|
71
82
|
const emitJsonError = shouldEmitJsonError(argv);
|
|
72
83
|
const program = createCliProgram({
|
|
@@ -115,10 +126,10 @@ function isCommanderDisplayExit(error) {
|
|
|
115
126
|
return (error.code === "commander.helpDisplayed" ||
|
|
116
127
|
error.code === "commander.version");
|
|
117
128
|
}
|
|
118
|
-
export { runAuthLoginCommand, runAuthLogoutCommand } from "../commands/auth.js";
|
|
129
|
+
export { runAuthLoginCommand, runAuthLogoutCommand, runAuthWhoamiCommand, } from "../commands/auth.js";
|
|
119
130
|
export { runAssetOverviewCommand } from "../commands/assets.js";
|
|
120
131
|
export { runCapabilitiesCommand, runStatusCommand };
|
|
121
132
|
export { runInitCommand };
|
|
122
133
|
export { runMarketAssetsCommand, runMarketPriceCommand };
|
|
123
|
-
export { runHoldingBetaCommand, runHoldingCreateCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, };
|
|
134
|
+
export { runHoldingBetaCommand, runHoldingCreateCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, };
|
|
124
135
|
export { runSkillsInstallCommand };
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -11,7 +11,25 @@ export interface AuthCommandContext {
|
|
|
11
11
|
export interface AuthLoginCommandOptions {
|
|
12
12
|
apiKey: string;
|
|
13
13
|
}
|
|
14
|
+
export interface AuthWhoamiCommandOptions {
|
|
15
|
+
json?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface AuthWhoamiOutput {
|
|
18
|
+
ok: true;
|
|
19
|
+
user_id: number;
|
|
20
|
+
email: string;
|
|
21
|
+
name: string;
|
|
22
|
+
is_premium: boolean;
|
|
23
|
+
auth_source: "env" | "config";
|
|
24
|
+
api_key: {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
key_prefix: string;
|
|
28
|
+
scopes: string[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
14
31
|
export declare function registerAuthCommands(program: Command, context?: AuthCommandContext): void;
|
|
15
32
|
export declare function runAuthLoginCommand(options: AuthLoginCommandOptions, context?: AuthCommandContext): Promise<void>;
|
|
16
33
|
export declare function runAuthLogoutCommand(context?: AuthCommandContext): Promise<void>;
|
|
34
|
+
export declare function runAuthWhoamiCommand(options?: AuthWhoamiCommandOptions, context?: AuthCommandContext): Promise<void>;
|
|
17
35
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC9B,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,kBAAuB,GAC/B,IAAI,CA2BN;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,uBAAuB,EAChC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,wBAA6B,EACtC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { verifyCliApiKey } from "../cli/auth.js";
|
|
2
|
+
import { resolveRequiredCliAuth } from "../cli/client.js";
|
|
2
3
|
import { clearCliStoredAuth, saveCliApiKey } from "../cli/config.js";
|
|
3
4
|
import { createTerminalTheme } from "../cli/terminal.js";
|
|
4
5
|
export function registerAuthCommands(program, context = {}) {
|
|
@@ -18,6 +19,13 @@ export function registerAuthCommands(program, context = {}) {
|
|
|
18
19
|
.action(async () => {
|
|
19
20
|
await runAuthLogoutCommand(context);
|
|
20
21
|
});
|
|
22
|
+
authCommand
|
|
23
|
+
.command("whoami")
|
|
24
|
+
.description("Show the authenticated QuantBrasil user")
|
|
25
|
+
.option("--json", "Show JSON output")
|
|
26
|
+
.action(async (options) => {
|
|
27
|
+
await runAuthWhoamiCommand(options, context);
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
30
|
export async function runAuthLoginCommand(options, context = {}) {
|
|
23
31
|
const stdout = getStdout(context);
|
|
@@ -43,6 +51,47 @@ export async function runAuthLogoutCommand(context = {}) {
|
|
|
43
51
|
}
|
|
44
52
|
stdout.write(`${theme.dim(`No local API key was stored at ${configPath}.`)}\n`);
|
|
45
53
|
}
|
|
54
|
+
export async function runAuthWhoamiCommand(options = {}, context = {}) {
|
|
55
|
+
const stdout = getStdout(context);
|
|
56
|
+
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
57
|
+
const auth = await resolveRequiredCliAuth(context.env ?? process.env);
|
|
58
|
+
const verifiedAuth = await verifyCliApiKey(auth.apiKey, {
|
|
59
|
+
env: context.env,
|
|
60
|
+
fetch: context.fetch,
|
|
61
|
+
});
|
|
62
|
+
const output = {
|
|
63
|
+
ok: true,
|
|
64
|
+
user_id: verifiedAuth.userId,
|
|
65
|
+
email: verifiedAuth.email,
|
|
66
|
+
name: verifiedAuth.name,
|
|
67
|
+
is_premium: verifiedAuth.isPremium,
|
|
68
|
+
auth_source: auth.source,
|
|
69
|
+
api_key: {
|
|
70
|
+
id: verifiedAuth.apiKey.id,
|
|
71
|
+
name: verifiedAuth.apiKey.name,
|
|
72
|
+
key_prefix: verifiedAuth.apiKey.keyPrefix,
|
|
73
|
+
scopes: verifiedAuth.apiKey.scopes,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
if (options.json) {
|
|
77
|
+
stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
stdout.write(`${formatAuthWhoamiHuman(output, theme)}\n`);
|
|
81
|
+
}
|
|
82
|
+
function formatAuthWhoamiHuman(data, theme) {
|
|
83
|
+
const source = data.auth_source === "env" ? "QUANTBRASIL_API_KEY" : "local config";
|
|
84
|
+
return [
|
|
85
|
+
theme.label("QuantBrasil user"),
|
|
86
|
+
"",
|
|
87
|
+
`${theme.label("Email:")} ${theme.bold(data.email)}`,
|
|
88
|
+
`${theme.label("Name:")} ${data.name}`,
|
|
89
|
+
`${theme.label("User ID:")} ${data.user_id}`,
|
|
90
|
+
`${theme.label("Premium:")} ${data.is_premium ? "yes" : "no"}`,
|
|
91
|
+
`${theme.label("API key:")} ${data.api_key.name} ${theme.dim(`(${data.api_key.key_prefix})`)}`,
|
|
92
|
+
`${theme.label("Auth source:")} ${source}`,
|
|
93
|
+
].join("\n");
|
|
94
|
+
}
|
|
46
95
|
function getStdout(context) {
|
|
47
96
|
return context.io?.stdout ?? process.stdout;
|
|
48
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/commands/market.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,CAAC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wBAAgB,sBAAsB,CACpC,IAAI,EAAE,mBAAmB,EACzB,KAAK,6CAAsC,GAC1C,MAAM,CAoCR"}
|
package/dist/commands/market.js
CHANGED
|
@@ -10,6 +10,7 @@ export function registerMarketCommands(program, context = {}) {
|
|
|
10
10
|
.command("assets")
|
|
11
11
|
.description("List the monitored QuantBrasil asset universe")
|
|
12
12
|
.option("--type <type>", `Filter by exact asset type (${monitoredAssetTypes.join(", ")})`)
|
|
13
|
+
.option("--search <text>", "Filter monitored tickers by text")
|
|
13
14
|
.option("--json", "Show JSON output")
|
|
14
15
|
.action(async (options) => {
|
|
15
16
|
await runMarketAssetsCommand(options, context);
|
|
@@ -29,9 +30,17 @@ export async function runMarketAssetsCommand(options, context = {}) {
|
|
|
29
30
|
const stdout = context.io?.stdout ?? process.stdout;
|
|
30
31
|
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
31
32
|
const assetType = normalizeMarketAssetType(options.type);
|
|
33
|
+
const search = normalizeMarketAssetSearch(options.search);
|
|
34
|
+
const input = {};
|
|
35
|
+
if (assetType) {
|
|
36
|
+
input.type = assetType;
|
|
37
|
+
}
|
|
38
|
+
if (search) {
|
|
39
|
+
input.search = search;
|
|
40
|
+
}
|
|
32
41
|
const response = await invokeCliCapability({
|
|
33
42
|
capability: "market.assets",
|
|
34
|
-
input
|
|
43
|
+
input,
|
|
35
44
|
env: context.env,
|
|
36
45
|
fetch: context.fetch,
|
|
37
46
|
});
|
|
@@ -69,6 +78,13 @@ function normalizeMarketAssetType(rawType) {
|
|
|
69
78
|
}
|
|
70
79
|
return normalized;
|
|
71
80
|
}
|
|
81
|
+
function normalizeMarketAssetSearch(rawSearch) {
|
|
82
|
+
if (!rawSearch) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const normalized = rawSearch.trim();
|
|
86
|
+
return normalized || undefined;
|
|
87
|
+
}
|
|
72
88
|
function buildMarketPriceInput(ticker, options) {
|
|
73
89
|
const payload = {
|
|
74
90
|
ticker,
|
|
@@ -22,9 +22,13 @@ export interface HoldingCreateCommandOptions {
|
|
|
22
22
|
export interface HoldingSetTargetsCommandOptions {
|
|
23
23
|
json?: boolean;
|
|
24
24
|
}
|
|
25
|
+
export interface HoldingSetPositionsCommandOptions {
|
|
26
|
+
json?: boolean;
|
|
27
|
+
}
|
|
25
28
|
export interface HoldingHistoricalReturnCommandOptions {
|
|
26
|
-
from
|
|
27
|
-
to
|
|
29
|
+
from?: string;
|
|
30
|
+
to?: string;
|
|
31
|
+
period?: string;
|
|
28
32
|
json?: boolean;
|
|
29
33
|
}
|
|
30
34
|
export interface HoldingBetaCommandOptions {
|
|
@@ -41,6 +45,11 @@ export interface HoldingTargetInput {
|
|
|
41
45
|
ticker: string;
|
|
42
46
|
weight_pct: number;
|
|
43
47
|
}
|
|
48
|
+
export interface HoldingPositionInput {
|
|
49
|
+
[key: string]: JsonValue;
|
|
50
|
+
ticker: string;
|
|
51
|
+
quantity: number;
|
|
52
|
+
}
|
|
44
53
|
export interface PortfolioOut {
|
|
45
54
|
[key: string]: JsonValue;
|
|
46
55
|
id: number;
|
|
@@ -160,6 +169,7 @@ export interface VarResponse {
|
|
|
160
169
|
}
|
|
161
170
|
export interface PortfoliosCommandContext extends CliInvokeContext {
|
|
162
171
|
io?: PortfoliosCommandIO;
|
|
172
|
+
now?: Date;
|
|
163
173
|
}
|
|
164
174
|
export declare function registerPortfoliosCommands(program: Command, context?: PortfoliosCommandContext): void;
|
|
165
175
|
export declare function runWatchlistListCommand(options: PortfolioListCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
@@ -169,6 +179,7 @@ export declare function runHoldingGetCommand(portfolioId: number, options: Portf
|
|
|
169
179
|
export declare function runWatchlistCreateCommand(name: string, options: PortfolioMutationCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
170
180
|
export declare function runHoldingCreateCommand(name: string, options: HoldingCreateCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
171
181
|
export declare function runHoldingSetTargetsCommand(portfolioId: number, targets: string[], options: HoldingSetTargetsCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
182
|
+
export declare function runHoldingSetPositionsCommand(portfolioId: number, positions: string[], options: HoldingSetPositionsCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
172
183
|
export declare function runWatchlistRenameCommand(portfolioId: number, name: string, options: PortfolioMutationCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
173
184
|
export declare function runHoldingRenameCommand(portfolioId: number, name: string, options: PortfolioMutationCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
174
185
|
export declare function runWatchlistAddAssetsCommand(portfolioId: number, symbols: string[], options: PortfolioMutationCommandOptions, context?: PortfoliosCommandContext): Promise<void>;
|
|
@@ -179,6 +190,10 @@ export declare function runHoldingVarCommand(portfolioId: number, options: Holdi
|
|
|
179
190
|
export declare function formatPortfolioListHuman(data: PortfolioListResponse, theme?: import("../cli/terminal.js").TerminalTheme, title?: string): string;
|
|
180
191
|
export declare function formatPortfolioGetHuman(data: PortfolioGetResponse, theme?: import("../cli/terminal.js").TerminalTheme, title?: string): string;
|
|
181
192
|
export declare function formatPortfolioMutationHuman(data: PortfolioCreateResponse | PortfolioMutationResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
193
|
+
export declare function resolveHistoricalReturnDateRange(options: HoldingHistoricalReturnCommandOptions, now?: Date): {
|
|
194
|
+
start_date: string;
|
|
195
|
+
end_date: string;
|
|
196
|
+
};
|
|
182
197
|
export declare function formatHistoricalReturnHuman(data: HistoricalReturnResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
183
198
|
export declare function formatBetaHuman(data: BetaResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
184
199
|
export declare function formatVarHuman(data: VarResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../../src/commands/portfolios.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;AAK9E,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,qCAAqC;IACpD,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../../src/commands/portfolios.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;AAK9E,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,M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;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,oBAAoB,EAC1B,KAAK,6CAAsC,EAC3C,KAAK,SAAe,GACnB,MAAM,CA+BR;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,uBAAuB,GAAG,yBAAyB,EACzD,KAAK,6CAAsC,GAC1C,MAAM,CAwBR;AAkND,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,qCAAqC,EAC9C,GAAG,GAAE,IAAiB,GACrB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA0B1C;AA2ID,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,wBAAwB,EAC9B,KAAK,6CAAsC,GAC1C,MAAM,CA8BR;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,YAAY,EAClB,KAAK,6CAAsC,GAC1C,MAAM,CA0BR;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,KAAK,6CAAsC,GAC1C,MAAM,CA0BR"}
|
|
@@ -101,12 +101,22 @@ export function registerPortfoliosCommands(program, context = {}) {
|
|
|
101
101
|
.action(async (portfolioId, targets, options) => {
|
|
102
102
|
await runHoldingSetTargetsCommand(portfolioId, targets, options, context);
|
|
103
103
|
});
|
|
104
|
+
holdingsCommand
|
|
105
|
+
.command("set-positions")
|
|
106
|
+
.description("Set position quantities for a holding")
|
|
107
|
+
.argument("<holding-id>", "Holding id", parsePortfolioIdArgument)
|
|
108
|
+
.argument("<position...>", "One or more position quantities in TICKER:QUANTITY form")
|
|
109
|
+
.option("--json", "Show JSON output")
|
|
110
|
+
.action(async (portfolioId, positions, options) => {
|
|
111
|
+
await runHoldingSetPositionsCommand(portfolioId, positions, options, context);
|
|
112
|
+
});
|
|
104
113
|
holdingsCommand
|
|
105
114
|
.command("historical-return")
|
|
106
115
|
.description("Calculate historical return for a saved holding")
|
|
107
116
|
.argument("<holding-id>", "Holding id", parsePortfolioIdArgument)
|
|
108
|
-
.
|
|
109
|
-
.
|
|
117
|
+
.option("--from <date>", "Inclusive start date in ISO format")
|
|
118
|
+
.option("--to <date>", "Inclusive end date in ISO format")
|
|
119
|
+
.option("--period <period>", "Lookback period such as 1y, 3y, 5y, or 6m")
|
|
110
120
|
.option("--json", "Show JSON output")
|
|
111
121
|
.action(async (portfolioId, options) => {
|
|
112
122
|
await runHoldingHistoricalReturnCommand(portfolioId, options, context);
|
|
@@ -221,6 +231,20 @@ export async function runHoldingSetTargetsCommand(portfolioId, targets, options,
|
|
|
221
231
|
});
|
|
222
232
|
writeMutationResponse(response.data, options.json, stdout, theme);
|
|
223
233
|
}
|
|
234
|
+
export async function runHoldingSetPositionsCommand(portfolioId, positions, options, context = {}) {
|
|
235
|
+
const stdout = context.io?.stdout ?? process.stdout;
|
|
236
|
+
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
237
|
+
const response = await invokeCliCapability({
|
|
238
|
+
capability: "holdings.set-positions",
|
|
239
|
+
input: {
|
|
240
|
+
portfolio_id: portfolioId,
|
|
241
|
+
positions: parsePositionArguments(positions),
|
|
242
|
+
},
|
|
243
|
+
env: context.env,
|
|
244
|
+
fetch: context.fetch,
|
|
245
|
+
});
|
|
246
|
+
writeMutationResponse(response.data, options.json, stdout, theme);
|
|
247
|
+
}
|
|
224
248
|
export async function runWatchlistRenameCommand(portfolioId, name, options, context = {}) {
|
|
225
249
|
const stdout = context.io?.stdout ?? process.stdout;
|
|
226
250
|
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
@@ -280,12 +304,13 @@ export async function runWatchlistRemoveAssetsCommand(portfolioId, symbols, opti
|
|
|
280
304
|
export async function runHoldingHistoricalReturnCommand(portfolioId, options, context = {}) {
|
|
281
305
|
const stdout = context.io?.stdout ?? process.stdout;
|
|
282
306
|
const theme = createTerminalTheme(stdout, context.env ?? process.env);
|
|
307
|
+
const dateRange = resolveHistoricalReturnDateRange(options, context.now ?? new Date());
|
|
283
308
|
const response = await invokeCliCapability({
|
|
284
309
|
capability: "holdings.historical-return",
|
|
285
310
|
input: {
|
|
286
311
|
portfolio_id: portfolioId,
|
|
287
|
-
start_date:
|
|
288
|
-
end_date:
|
|
312
|
+
start_date: dateRange.start_date,
|
|
313
|
+
end_date: dateRange.end_date,
|
|
289
314
|
},
|
|
290
315
|
env: context.env,
|
|
291
316
|
fetch: context.fetch,
|
|
@@ -472,6 +497,50 @@ function parseTargetArgument(value) {
|
|
|
472
497
|
}
|
|
473
498
|
return { ticker, weight_pct };
|
|
474
499
|
}
|
|
500
|
+
function parsePositionArguments(values) {
|
|
501
|
+
if (values.length === 0) {
|
|
502
|
+
return [];
|
|
503
|
+
}
|
|
504
|
+
const positions = values.map(parsePositionArgument);
|
|
505
|
+
const tickers = positions.map(position => position.ticker);
|
|
506
|
+
if (new Set(tickers).size !== tickers.length) {
|
|
507
|
+
throw createCliValidationError("Do not send duplicated tickers.");
|
|
508
|
+
}
|
|
509
|
+
return positions;
|
|
510
|
+
}
|
|
511
|
+
function parsePositionArgument(value) {
|
|
512
|
+
const normalized = value.trim();
|
|
513
|
+
if (!normalized) {
|
|
514
|
+
throw createCliValidationError("Position input cannot be empty.");
|
|
515
|
+
}
|
|
516
|
+
const parts = normalized.split(":");
|
|
517
|
+
if (parts.length !== 2 && parts.length !== 3) {
|
|
518
|
+
throw createCliValidationError(`Invalid position input "${value}". Use TICKER:QUANTITY.`);
|
|
519
|
+
}
|
|
520
|
+
const rawTicker = parts[0];
|
|
521
|
+
const rawQuantity = parts.length === 2
|
|
522
|
+
? parts[1]
|
|
523
|
+
: parsePositionMode(value, parts[1], parts[2]);
|
|
524
|
+
const ticker = rawTicker?.trim().toUpperCase();
|
|
525
|
+
if (!ticker) {
|
|
526
|
+
throw createCliValidationError(`Invalid position input "${value}". Use TICKER:QUANTITY.`);
|
|
527
|
+
}
|
|
528
|
+
const quantity = Number(rawQuantity?.trim());
|
|
529
|
+
if (!Number.isFinite(quantity) || quantity <= 0) {
|
|
530
|
+
throw createCliValidationError(`Invalid position quantity in "${value}". Use a number greater than 0.`);
|
|
531
|
+
}
|
|
532
|
+
return { ticker, quantity };
|
|
533
|
+
}
|
|
534
|
+
function parsePositionMode(originalValue, rawMode, rawQuantity) {
|
|
535
|
+
const mode = rawMode?.trim().toLowerCase();
|
|
536
|
+
if (mode === "qty" || mode === "quantity") {
|
|
537
|
+
return rawQuantity;
|
|
538
|
+
}
|
|
539
|
+
if (mode === "value" || mode === "amount") {
|
|
540
|
+
throw createCliValidationError("Position values are not supported in the public CLI. Use TICKER:QUANTITY.");
|
|
541
|
+
}
|
|
542
|
+
throw createCliValidationError(`Invalid position input "${originalValue}". Use TICKER:QUANTITY.`);
|
|
543
|
+
}
|
|
475
544
|
function parseSymbolArguments(values) {
|
|
476
545
|
const symbols = values.map(symbol => symbol.trim().toUpperCase());
|
|
477
546
|
if (symbols.length === 0 || symbols.some(symbol => symbol.length === 0)) {
|
|
@@ -509,6 +578,60 @@ function parseYearsOption(value) {
|
|
|
509
578
|
}
|
|
510
579
|
return parsed;
|
|
511
580
|
}
|
|
581
|
+
export function resolveHistoricalReturnDateRange(options, now = new Date()) {
|
|
582
|
+
const from = options.from?.trim();
|
|
583
|
+
const to = options.to?.trim();
|
|
584
|
+
const period = options.period?.trim().toLowerCase();
|
|
585
|
+
const hasExplicitRange = Boolean(from || to);
|
|
586
|
+
if (period && hasExplicitRange) {
|
|
587
|
+
throw createCliValidationError("Use either --period or both --from and --to, not both.");
|
|
588
|
+
}
|
|
589
|
+
if (period) {
|
|
590
|
+
return resolvePeriodDateRange(period, now);
|
|
591
|
+
}
|
|
592
|
+
if (from && to) {
|
|
593
|
+
return {
|
|
594
|
+
start_date: from,
|
|
595
|
+
end_date: to,
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
throw createCliValidationError("Use --period, or provide both --from and --to.");
|
|
599
|
+
}
|
|
600
|
+
function resolvePeriodDateRange(period, now) {
|
|
601
|
+
const match = /^(\d+)([my])$/.exec(period);
|
|
602
|
+
if (!match) {
|
|
603
|
+
throw createCliValidationError("Period must use the form <number>m or <number>y, for example 6m or 1y.");
|
|
604
|
+
}
|
|
605
|
+
const amount = Number(match[1]);
|
|
606
|
+
const unit = match[2];
|
|
607
|
+
if (!Number.isSafeInteger(amount) || amount <= 0) {
|
|
608
|
+
throw createCliValidationError("Period amount must be a positive integer.");
|
|
609
|
+
}
|
|
610
|
+
const endDate = toLocalCalendarDate(now);
|
|
611
|
+
const startDate = subtractUtcCalendarPeriod(endDate, amount, unit);
|
|
612
|
+
return {
|
|
613
|
+
start_date: formatIsoDate(startDate),
|
|
614
|
+
end_date: formatIsoDate(endDate),
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function subtractUtcCalendarPeriod(endDate, amount, unit) {
|
|
618
|
+
const targetYear = unit === "y" ? endDate.getUTCFullYear() - amount : endDate.getUTCFullYear();
|
|
619
|
+
const targetMonth = unit === "m" ? endDate.getUTCMonth() - amount : endDate.getUTCMonth();
|
|
620
|
+
return createClampedUtcDate(targetYear, targetMonth, endDate.getUTCDate());
|
|
621
|
+
}
|
|
622
|
+
function createClampedUtcDate(year, monthIndex, day) {
|
|
623
|
+
const firstOfTargetMonth = new Date(Date.UTC(year, monthIndex, 1));
|
|
624
|
+
const normalizedYear = firstOfTargetMonth.getUTCFullYear();
|
|
625
|
+
const normalizedMonth = firstOfTargetMonth.getUTCMonth();
|
|
626
|
+
const lastDayOfTargetMonth = new Date(Date.UTC(normalizedYear, normalizedMonth + 1, 0)).getUTCDate();
|
|
627
|
+
return new Date(Date.UTC(normalizedYear, normalizedMonth, Math.min(day, lastDayOfTargetMonth)));
|
|
628
|
+
}
|
|
629
|
+
function toLocalCalendarDate(value) {
|
|
630
|
+
return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate()));
|
|
631
|
+
}
|
|
632
|
+
function formatIsoDate(value) {
|
|
633
|
+
return value.toISOString().slice(0, 10);
|
|
634
|
+
}
|
|
512
635
|
function parseNumberOption(value, fieldName) {
|
|
513
636
|
const parsed = Number(value.trim());
|
|
514
637
|
if (!Number.isFinite(parsed)) {
|
|
@@ -27,8 +27,16 @@ export declare const marketCapabilities: readonly [{
|
|
|
27
27
|
readonly placeholder: "TIPO";
|
|
28
28
|
readonly enumValues: readonly ["B3", "ETF", "ETF-US", "BDR", "Futuro", "Crypto", "S&P500"];
|
|
29
29
|
readonly description: "Filter by the exact monitored asset type.";
|
|
30
|
+
}, {
|
|
31
|
+
readonly kind: "option";
|
|
32
|
+
readonly flag: "--search";
|
|
33
|
+
readonly name: "search";
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly required: false;
|
|
36
|
+
readonly placeholder: "TEXTO";
|
|
37
|
+
readonly description: "Filter monitored tickers by case-insensitive text.";
|
|
30
38
|
}];
|
|
31
|
-
readonly examples: readonly ["quantbrasil market assets", "quantbrasil market assets --type B3"];
|
|
39
|
+
readonly examples: readonly ["quantbrasil market assets", "quantbrasil market assets --type B3", "quantbrasil market assets --search BTC"];
|
|
32
40
|
};
|
|
33
41
|
readonly tool: {
|
|
34
42
|
readonly name: "qb_market_assets";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/capabilities/market.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,uEAQtB,CAAC;AAEX,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/capabilities/market.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,uEAQtB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoHqB,CAAC"}
|
|
@@ -39,10 +39,20 @@ export const marketCapabilities = [
|
|
|
39
39
|
enumValues: monitoredAssetTypes,
|
|
40
40
|
description: "Filter by the exact monitored asset type.",
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
kind: "option",
|
|
44
|
+
flag: "--search",
|
|
45
|
+
name: "search",
|
|
46
|
+
type: "string",
|
|
47
|
+
required: false,
|
|
48
|
+
placeholder: "TEXTO",
|
|
49
|
+
description: "Filter monitored tickers by case-insensitive text.",
|
|
50
|
+
},
|
|
42
51
|
],
|
|
43
52
|
examples: [
|
|
44
53
|
"quantbrasil market assets",
|
|
45
54
|
"quantbrasil market assets --type B3",
|
|
55
|
+
"quantbrasil market assets --search BTC",
|
|
46
56
|
],
|
|
47
57
|
},
|
|
48
58
|
tool: {
|
|
@@ -419,6 +419,49 @@ export declare const portfolioCapabilities: readonly [{
|
|
|
419
419
|
readonly title: "Set holding target weights";
|
|
420
420
|
};
|
|
421
421
|
readonly outputModes: readonly ["json", "human"];
|
|
422
|
+
}, {
|
|
423
|
+
readonly id: "holdings.set-positions";
|
|
424
|
+
readonly kind: "mutation";
|
|
425
|
+
readonly visibility: readonly ["cli", "opencode"];
|
|
426
|
+
readonly description: "Set position quantities for a holding owned by the authenticated user.";
|
|
427
|
+
readonly http: {
|
|
428
|
+
readonly method: "POST";
|
|
429
|
+
readonly path: "/api/desk/tools/holding/set_positions";
|
|
430
|
+
readonly inputMode: "json_body";
|
|
431
|
+
readonly schemas: {
|
|
432
|
+
readonly request: "HoldingSetPositionsRequest";
|
|
433
|
+
readonly response: "PortfolioMutationResponse";
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
readonly cli: {
|
|
437
|
+
readonly group: "holdings";
|
|
438
|
+
readonly command: "set-positions";
|
|
439
|
+
readonly summary: "Set position quantities for a holding.";
|
|
440
|
+
readonly positional: readonly [{
|
|
441
|
+
readonly kind: "positional";
|
|
442
|
+
readonly name: "portfolio_id";
|
|
443
|
+
readonly type: "integer";
|
|
444
|
+
readonly required: true;
|
|
445
|
+
readonly placeholder: "ID";
|
|
446
|
+
readonly description: "Stable saved object identifier.";
|
|
447
|
+
}, {
|
|
448
|
+
readonly kind: "positional";
|
|
449
|
+
readonly name: "positions";
|
|
450
|
+
readonly type: "string_array";
|
|
451
|
+
readonly required: true;
|
|
452
|
+
readonly placeholder: "TICKER:QUANTIDADE";
|
|
453
|
+
readonly multiple: true;
|
|
454
|
+
readonly collectionFormat: "space_separated";
|
|
455
|
+
readonly description: "One or more position quantities in TICKER:QUANTITY form.";
|
|
456
|
+
}];
|
|
457
|
+
readonly options: readonly [];
|
|
458
|
+
readonly examples: readonly ["quantbrasil holdings set-positions 123 PRIO3:1600 BTC-USD:0.25"];
|
|
459
|
+
};
|
|
460
|
+
readonly tool: {
|
|
461
|
+
readonly name: "qb_holding_set_positions";
|
|
462
|
+
readonly title: "Set holding position quantities";
|
|
463
|
+
};
|
|
464
|
+
readonly outputModes: readonly ["json", "human"];
|
|
422
465
|
}, {
|
|
423
466
|
readonly id: "holdings.historical-return";
|
|
424
467
|
readonly kind: "read";
|
|
@@ -450,19 +493,27 @@ export declare const portfolioCapabilities: readonly [{
|
|
|
450
493
|
readonly flag: "--from";
|
|
451
494
|
readonly name: "start_date";
|
|
452
495
|
readonly type: "string";
|
|
453
|
-
readonly required:
|
|
496
|
+
readonly required: false;
|
|
454
497
|
readonly placeholder: "AAAA-MM-DD";
|
|
455
|
-
readonly description: "Inclusive start date in ISO format.";
|
|
498
|
+
readonly description: "Inclusive start date in ISO format. Use with --to, or use --period.";
|
|
456
499
|
}, {
|
|
457
500
|
readonly kind: "option";
|
|
458
501
|
readonly flag: "--to";
|
|
459
502
|
readonly name: "end_date";
|
|
460
503
|
readonly type: "string";
|
|
461
|
-
readonly required:
|
|
504
|
+
readonly required: false;
|
|
462
505
|
readonly placeholder: "AAAA-MM-DD";
|
|
463
|
-
readonly description: "Inclusive end date in ISO format.";
|
|
506
|
+
readonly description: "Inclusive end date in ISO format. Use with --from, or use --period.";
|
|
507
|
+
}, {
|
|
508
|
+
readonly kind: "option";
|
|
509
|
+
readonly flag: "--period";
|
|
510
|
+
readonly name: "period";
|
|
511
|
+
readonly type: "string";
|
|
512
|
+
readonly required: false;
|
|
513
|
+
readonly placeholder: "PERIODO";
|
|
514
|
+
readonly description: "Lookback period such as 1y, 3y, 5y, or 6m. Mutually exclusive with --from/--to.";
|
|
464
515
|
}];
|
|
465
|
-
readonly examples: readonly ["quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01"];
|
|
516
|
+
readonly examples: readonly ["quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01", "quantbrasil holdings historical-return 123 --period 1y"];
|
|
466
517
|
};
|
|
467
518
|
readonly tool: {
|
|
468
519
|
readonly name: "qb_holding_historical_return";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../../src/capabilities/portfolios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../../src/capabilities/portfolios.ts"],"names":[],"mappings":"AAsDA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0gBkB,CAAC"}
|
|
@@ -35,6 +35,16 @@ const targetsPositional = {
|
|
|
35
35
|
collectionFormat: "space_separated",
|
|
36
36
|
description: "One or more target weights in TICKER:WEIGHT_PCT form.",
|
|
37
37
|
};
|
|
38
|
+
const positionsPositional = {
|
|
39
|
+
kind: "positional",
|
|
40
|
+
name: "positions",
|
|
41
|
+
type: "string_array",
|
|
42
|
+
required: true,
|
|
43
|
+
placeholder: "TICKER:QUANTIDADE",
|
|
44
|
+
multiple: true,
|
|
45
|
+
collectionFormat: "space_separated",
|
|
46
|
+
description: "One or more position quantities in TICKER:QUANTITY form.",
|
|
47
|
+
};
|
|
38
48
|
export const portfolioCapabilities = [
|
|
39
49
|
{
|
|
40
50
|
id: "watchlists.list",
|
|
@@ -371,6 +381,36 @@ export const portfolioCapabilities = [
|
|
|
371
381
|
},
|
|
372
382
|
outputModes: standardOutputModes,
|
|
373
383
|
},
|
|
384
|
+
{
|
|
385
|
+
id: "holdings.set-positions",
|
|
386
|
+
kind: "mutation",
|
|
387
|
+
visibility: publicRuntimeVisibility,
|
|
388
|
+
description: "Set position quantities for a holding owned by the authenticated user.",
|
|
389
|
+
http: {
|
|
390
|
+
method: "POST",
|
|
391
|
+
path: "/api/desk/tools/holding/set_positions",
|
|
392
|
+
inputMode: "json_body",
|
|
393
|
+
schemas: {
|
|
394
|
+
request: "HoldingSetPositionsRequest",
|
|
395
|
+
response: "PortfolioMutationResponse",
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
cli: {
|
|
399
|
+
group: "holdings",
|
|
400
|
+
command: "set-positions",
|
|
401
|
+
summary: "Set position quantities for a holding.",
|
|
402
|
+
positional: [portfolioIdPositional, positionsPositional],
|
|
403
|
+
options: [],
|
|
404
|
+
examples: [
|
|
405
|
+
"quantbrasil holdings set-positions 123 PRIO3:1600 BTC-USD:0.25",
|
|
406
|
+
],
|
|
407
|
+
},
|
|
408
|
+
tool: {
|
|
409
|
+
name: "qb_holding_set_positions",
|
|
410
|
+
title: "Set holding position quantities",
|
|
411
|
+
},
|
|
412
|
+
outputModes: standardOutputModes,
|
|
413
|
+
},
|
|
374
414
|
{
|
|
375
415
|
id: "holdings.historical-return",
|
|
376
416
|
kind: "read",
|
|
@@ -396,22 +436,32 @@ export const portfolioCapabilities = [
|
|
|
396
436
|
flag: "--from",
|
|
397
437
|
name: "start_date",
|
|
398
438
|
type: "string",
|
|
399
|
-
required:
|
|
439
|
+
required: false,
|
|
400
440
|
placeholder: "AAAA-MM-DD",
|
|
401
|
-
description: "Inclusive start date in ISO format.",
|
|
441
|
+
description: "Inclusive start date in ISO format. Use with --to, or use --period.",
|
|
402
442
|
},
|
|
403
443
|
{
|
|
404
444
|
kind: "option",
|
|
405
445
|
flag: "--to",
|
|
406
446
|
name: "end_date",
|
|
407
447
|
type: "string",
|
|
408
|
-
required:
|
|
448
|
+
required: false,
|
|
409
449
|
placeholder: "AAAA-MM-DD",
|
|
410
|
-
description: "Inclusive end date in ISO format.",
|
|
450
|
+
description: "Inclusive end date in ISO format. Use with --from, or use --period.",
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
kind: "option",
|
|
454
|
+
flag: "--period",
|
|
455
|
+
name: "period",
|
|
456
|
+
type: "string",
|
|
457
|
+
required: false,
|
|
458
|
+
placeholder: "PERIODO",
|
|
459
|
+
description: "Lookback period such as 1y, 3y, 5y, or 6m. Mutually exclusive with --from/--to.",
|
|
411
460
|
},
|
|
412
461
|
],
|
|
413
462
|
examples: [
|
|
414
463
|
"quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01",
|
|
464
|
+
"quantbrasil holdings historical-return 123 --period 1y",
|
|
415
465
|
],
|
|
416
466
|
},
|
|
417
467
|
tool: {
|
|
@@ -26,8 +26,16 @@ export declare const capabilityRegistry: readonly [{
|
|
|
26
26
|
readonly placeholder: "TIPO";
|
|
27
27
|
readonly enumValues: readonly ["B3", "ETF", "ETF-US", "BDR", "Futuro", "Crypto", "S&P500"];
|
|
28
28
|
readonly description: "Filter by the exact monitored asset type.";
|
|
29
|
+
}, {
|
|
30
|
+
readonly kind: "option";
|
|
31
|
+
readonly flag: "--search";
|
|
32
|
+
readonly name: "search";
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly required: false;
|
|
35
|
+
readonly placeholder: "TEXTO";
|
|
36
|
+
readonly description: "Filter monitored tickers by case-insensitive text.";
|
|
29
37
|
}];
|
|
30
|
-
readonly examples: readonly ["quantbrasil market assets", "quantbrasil market assets --type B3"];
|
|
38
|
+
readonly examples: readonly ["quantbrasil market assets", "quantbrasil market assets --type B3", "quantbrasil market assets --search BTC"];
|
|
31
39
|
};
|
|
32
40
|
readonly tool: {
|
|
33
41
|
readonly name: "qb_market_assets";
|
|
@@ -551,6 +559,49 @@ export declare const capabilityRegistry: readonly [{
|
|
|
551
559
|
readonly title: "Set holding target weights";
|
|
552
560
|
};
|
|
553
561
|
readonly outputModes: readonly ["json", "human"];
|
|
562
|
+
}, {
|
|
563
|
+
readonly id: "holdings.set-positions";
|
|
564
|
+
readonly kind: "mutation";
|
|
565
|
+
readonly visibility: readonly ["cli", "opencode"];
|
|
566
|
+
readonly description: "Set position quantities for a holding owned by the authenticated user.";
|
|
567
|
+
readonly http: {
|
|
568
|
+
readonly method: "POST";
|
|
569
|
+
readonly path: "/api/desk/tools/holding/set_positions";
|
|
570
|
+
readonly inputMode: "json_body";
|
|
571
|
+
readonly schemas: {
|
|
572
|
+
readonly request: "HoldingSetPositionsRequest";
|
|
573
|
+
readonly response: "PortfolioMutationResponse";
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
readonly cli: {
|
|
577
|
+
readonly group: "holdings";
|
|
578
|
+
readonly command: "set-positions";
|
|
579
|
+
readonly summary: "Set position quantities for a holding.";
|
|
580
|
+
readonly positional: readonly [{
|
|
581
|
+
readonly kind: "positional";
|
|
582
|
+
readonly name: "portfolio_id";
|
|
583
|
+
readonly type: "integer";
|
|
584
|
+
readonly required: true;
|
|
585
|
+
readonly placeholder: "ID";
|
|
586
|
+
readonly description: "Stable saved object identifier.";
|
|
587
|
+
}, {
|
|
588
|
+
readonly kind: "positional";
|
|
589
|
+
readonly name: "positions";
|
|
590
|
+
readonly type: "string_array";
|
|
591
|
+
readonly required: true;
|
|
592
|
+
readonly placeholder: "TICKER:QUANTIDADE";
|
|
593
|
+
readonly multiple: true;
|
|
594
|
+
readonly collectionFormat: "space_separated";
|
|
595
|
+
readonly description: "One or more position quantities in TICKER:QUANTITY form.";
|
|
596
|
+
}];
|
|
597
|
+
readonly options: readonly [];
|
|
598
|
+
readonly examples: readonly ["quantbrasil holdings set-positions 123 PRIO3:1600 BTC-USD:0.25"];
|
|
599
|
+
};
|
|
600
|
+
readonly tool: {
|
|
601
|
+
readonly name: "qb_holding_set_positions";
|
|
602
|
+
readonly title: "Set holding position quantities";
|
|
603
|
+
};
|
|
604
|
+
readonly outputModes: readonly ["json", "human"];
|
|
554
605
|
}, {
|
|
555
606
|
readonly id: "holdings.historical-return";
|
|
556
607
|
readonly kind: "read";
|
|
@@ -582,19 +633,27 @@ export declare const capabilityRegistry: readonly [{
|
|
|
582
633
|
readonly flag: "--from";
|
|
583
634
|
readonly name: "start_date";
|
|
584
635
|
readonly type: "string";
|
|
585
|
-
readonly required:
|
|
636
|
+
readonly required: false;
|
|
586
637
|
readonly placeholder: "AAAA-MM-DD";
|
|
587
|
-
readonly description: "Inclusive start date in ISO format.";
|
|
638
|
+
readonly description: "Inclusive start date in ISO format. Use with --to, or use --period.";
|
|
588
639
|
}, {
|
|
589
640
|
readonly kind: "option";
|
|
590
641
|
readonly flag: "--to";
|
|
591
642
|
readonly name: "end_date";
|
|
592
643
|
readonly type: "string";
|
|
593
|
-
readonly required:
|
|
644
|
+
readonly required: false;
|
|
594
645
|
readonly placeholder: "AAAA-MM-DD";
|
|
595
|
-
readonly description: "Inclusive end date in ISO format.";
|
|
646
|
+
readonly description: "Inclusive end date in ISO format. Use with --from, or use --period.";
|
|
647
|
+
}, {
|
|
648
|
+
readonly kind: "option";
|
|
649
|
+
readonly flag: "--period";
|
|
650
|
+
readonly name: "period";
|
|
651
|
+
readonly type: "string";
|
|
652
|
+
readonly required: false;
|
|
653
|
+
readonly placeholder: "PERIODO";
|
|
654
|
+
readonly description: "Lookback period such as 1y, 3y, 5y, or 6m. Mutually exclusive with --from/--to.";
|
|
596
655
|
}];
|
|
597
|
-
readonly examples: readonly ["quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01"];
|
|
656
|
+
readonly examples: readonly ["quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01", "quantbrasil holdings historical-return 123 --period 1y"];
|
|
598
657
|
};
|
|
599
658
|
readonly tool: {
|
|
600
659
|
readonly name: "qb_holding_historical_return";
|
|
@@ -728,8 +787,16 @@ export declare function getCapabilityById(id: CapabilityId): {
|
|
|
728
787
|
readonly placeholder: "TIPO";
|
|
729
788
|
readonly enumValues: readonly ["B3", "ETF", "ETF-US", "BDR", "Futuro", "Crypto", "S&P500"];
|
|
730
789
|
readonly description: "Filter by the exact monitored asset type.";
|
|
790
|
+
}, {
|
|
791
|
+
readonly kind: "option";
|
|
792
|
+
readonly flag: "--search";
|
|
793
|
+
readonly name: "search";
|
|
794
|
+
readonly type: "string";
|
|
795
|
+
readonly required: false;
|
|
796
|
+
readonly placeholder: "TEXTO";
|
|
797
|
+
readonly description: "Filter monitored tickers by case-insensitive text.";
|
|
731
798
|
}];
|
|
732
|
-
readonly examples: readonly ["quantbrasil market assets", "quantbrasil market assets --type B3"];
|
|
799
|
+
readonly examples: readonly ["quantbrasil market assets", "quantbrasil market assets --type B3", "quantbrasil market assets --search BTC"];
|
|
733
800
|
};
|
|
734
801
|
readonly tool: {
|
|
735
802
|
readonly name: "qb_market_assets";
|
|
@@ -1253,6 +1320,49 @@ export declare function getCapabilityById(id: CapabilityId): {
|
|
|
1253
1320
|
readonly title: "Set holding target weights";
|
|
1254
1321
|
};
|
|
1255
1322
|
readonly outputModes: readonly ["json", "human"];
|
|
1323
|
+
} | {
|
|
1324
|
+
readonly id: "holdings.set-positions";
|
|
1325
|
+
readonly kind: "mutation";
|
|
1326
|
+
readonly visibility: readonly ["cli", "opencode"];
|
|
1327
|
+
readonly description: "Set position quantities for a holding owned by the authenticated user.";
|
|
1328
|
+
readonly http: {
|
|
1329
|
+
readonly method: "POST";
|
|
1330
|
+
readonly path: "/api/desk/tools/holding/set_positions";
|
|
1331
|
+
readonly inputMode: "json_body";
|
|
1332
|
+
readonly schemas: {
|
|
1333
|
+
readonly request: "HoldingSetPositionsRequest";
|
|
1334
|
+
readonly response: "PortfolioMutationResponse";
|
|
1335
|
+
};
|
|
1336
|
+
};
|
|
1337
|
+
readonly cli: {
|
|
1338
|
+
readonly group: "holdings";
|
|
1339
|
+
readonly command: "set-positions";
|
|
1340
|
+
readonly summary: "Set position quantities for a holding.";
|
|
1341
|
+
readonly positional: readonly [{
|
|
1342
|
+
readonly kind: "positional";
|
|
1343
|
+
readonly name: "portfolio_id";
|
|
1344
|
+
readonly type: "integer";
|
|
1345
|
+
readonly required: true;
|
|
1346
|
+
readonly placeholder: "ID";
|
|
1347
|
+
readonly description: "Stable saved object identifier.";
|
|
1348
|
+
}, {
|
|
1349
|
+
readonly kind: "positional";
|
|
1350
|
+
readonly name: "positions";
|
|
1351
|
+
readonly type: "string_array";
|
|
1352
|
+
readonly required: true;
|
|
1353
|
+
readonly placeholder: "TICKER:QUANTIDADE";
|
|
1354
|
+
readonly multiple: true;
|
|
1355
|
+
readonly collectionFormat: "space_separated";
|
|
1356
|
+
readonly description: "One or more position quantities in TICKER:QUANTITY form.";
|
|
1357
|
+
}];
|
|
1358
|
+
readonly options: readonly [];
|
|
1359
|
+
readonly examples: readonly ["quantbrasil holdings set-positions 123 PRIO3:1600 BTC-USD:0.25"];
|
|
1360
|
+
};
|
|
1361
|
+
readonly tool: {
|
|
1362
|
+
readonly name: "qb_holding_set_positions";
|
|
1363
|
+
readonly title: "Set holding position quantities";
|
|
1364
|
+
};
|
|
1365
|
+
readonly outputModes: readonly ["json", "human"];
|
|
1256
1366
|
} | {
|
|
1257
1367
|
readonly id: "holdings.historical-return";
|
|
1258
1368
|
readonly kind: "read";
|
|
@@ -1284,19 +1394,27 @@ export declare function getCapabilityById(id: CapabilityId): {
|
|
|
1284
1394
|
readonly flag: "--from";
|
|
1285
1395
|
readonly name: "start_date";
|
|
1286
1396
|
readonly type: "string";
|
|
1287
|
-
readonly required:
|
|
1397
|
+
readonly required: false;
|
|
1288
1398
|
readonly placeholder: "AAAA-MM-DD";
|
|
1289
|
-
readonly description: "Inclusive start date in ISO format.";
|
|
1399
|
+
readonly description: "Inclusive start date in ISO format. Use with --to, or use --period.";
|
|
1290
1400
|
}, {
|
|
1291
1401
|
readonly kind: "option";
|
|
1292
1402
|
readonly flag: "--to";
|
|
1293
1403
|
readonly name: "end_date";
|
|
1294
1404
|
readonly type: "string";
|
|
1295
|
-
readonly required:
|
|
1405
|
+
readonly required: false;
|
|
1296
1406
|
readonly placeholder: "AAAA-MM-DD";
|
|
1297
|
-
readonly description: "Inclusive end date in ISO format.";
|
|
1407
|
+
readonly description: "Inclusive end date in ISO format. Use with --from, or use --period.";
|
|
1408
|
+
}, {
|
|
1409
|
+
readonly kind: "option";
|
|
1410
|
+
readonly flag: "--period";
|
|
1411
|
+
readonly name: "period";
|
|
1412
|
+
readonly type: "string";
|
|
1413
|
+
readonly required: false;
|
|
1414
|
+
readonly placeholder: "PERIODO";
|
|
1415
|
+
readonly description: "Lookback period such as 1y, 3y, 5y, or 6m. Mutually exclusive with --from/--to.";
|
|
1298
1416
|
}];
|
|
1299
|
-
readonly examples: readonly ["quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01"];
|
|
1417
|
+
readonly examples: readonly ["quantbrasil holdings historical-return 123 --from 2024-01-01 --to 2025-01-01", "quantbrasil holdings historical-return 123 --period 1y"];
|
|
1300
1418
|
};
|
|
1301
1419
|
readonly tool: {
|
|
1302
1420
|
readonly name: "qb_holding_historical_return";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ Use this skill when the user asks for market or investing data/actions that Quan
|
|
|
15
15
|
- Use `quantbrasil` when available on PATH.
|
|
16
16
|
- If `quantbrasil` is not found, report that the CLI binary is not on PATH and ask the user to install it or fix PATH.
|
|
17
17
|
- Check readiness first: `quantbrasil --status`
|
|
18
|
+
- Identify the authenticated user when needed: `quantbrasil whoami`
|
|
18
19
|
- Inspect public surface when unsure: `quantbrasil capabilities --json`
|
|
19
20
|
- Use narrow command first:
|
|
20
21
|
- asset discovery: `quantbrasil market assets`
|
|
@@ -6,6 +6,8 @@ Examples assume the `quantbrasil` binary is available on `PATH`.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
quantbrasil --status
|
|
9
|
+
quantbrasil whoami
|
|
10
|
+
quantbrasil auth whoami
|
|
9
11
|
quantbrasil auth login --api-key <key>
|
|
10
12
|
quantbrasil auth logout
|
|
11
13
|
quantbrasil capabilities --json
|
|
@@ -17,6 +19,7 @@ quantbrasil init
|
|
|
17
19
|
```bash
|
|
18
20
|
quantbrasil market assets
|
|
19
21
|
quantbrasil market assets --type B3
|
|
22
|
+
quantbrasil market assets --search BTC
|
|
20
23
|
quantbrasil market assets --json
|
|
21
24
|
|
|
22
25
|
quantbrasil market price PETR4
|
|
@@ -66,7 +69,9 @@ quantbrasil holdings create "Longo Prazo" --target PETR4:50 --target VALE3:50
|
|
|
66
69
|
quantbrasil holdings create "Carteira Real" --mode position
|
|
67
70
|
quantbrasil holdings rename 182 "Longo Prazo"
|
|
68
71
|
quantbrasil holdings set-targets 182 PETR4:50 VALE3:50
|
|
72
|
+
quantbrasil holdings set-positions 182 PRIO3:1600 BTC-USD:0.25 QQQ:10
|
|
69
73
|
quantbrasil holdings historical-return 182 --from 2025-01-01 --to 2026-01-01
|
|
74
|
+
quantbrasil holdings historical-return 182 --period 1y
|
|
70
75
|
quantbrasil holdings beta 182 --years 1
|
|
71
76
|
quantbrasil holdings var 182 --years 1 --confidence 95
|
|
72
77
|
```
|
|
@@ -13,6 +13,10 @@ saved composition.
|
|
|
13
13
|
target weights or positions.
|
|
14
14
|
- A theoretical portfolio is a holding with target weights. Save it first, then
|
|
15
15
|
run metrics on the returned holding id.
|
|
16
|
+
- Target weights and positions are independent: target weights describe intended
|
|
17
|
+
allocation, while positions describe actual ownership.
|
|
18
|
+
- Position quantities are shares, units, or coin amounts. Do not pass monetary
|
|
19
|
+
values as positions in the public CLI.
|
|
16
20
|
|
|
17
21
|
## Command routing
|
|
18
22
|
|
|
@@ -57,8 +61,13 @@ holding.
|
|
|
57
61
|
|
|
58
62
|
```bash
|
|
59
63
|
quantbrasil holdings create "Carteira Real" --mode position
|
|
64
|
+
quantbrasil holdings set-positions 93 PRIO3:1600 BTC-USD:0.25 QQQ:10
|
|
60
65
|
```
|
|
61
66
|
|
|
67
|
+
`set-positions` is a partial quantity upsert: it changes only the mentioned
|
|
68
|
+
tickers and leaves unmentioned positions unchanged. It does not clear or replace
|
|
69
|
+
target weights.
|
|
70
|
+
|
|
62
71
|
## Watchlists
|
|
63
72
|
|
|
64
73
|
Use watchlists for saved sets of assets that the user wants to monitor, screen,
|
|
@@ -80,13 +89,15 @@ Holding metrics always run through `holdings`.
|
|
|
80
89
|
|
|
81
90
|
```bash
|
|
82
91
|
quantbrasil holdings historical-return 93 --from 2025-01-01 --to 2026-01-01
|
|
92
|
+
quantbrasil holdings historical-return 93 --period 1y
|
|
83
93
|
quantbrasil holdings beta 93 --years 1
|
|
84
94
|
quantbrasil holdings var 93 --years 1 --confidence 95
|
|
85
95
|
```
|
|
86
96
|
|
|
87
97
|
Rules:
|
|
88
98
|
|
|
89
|
-
- `historical-return`
|
|
99
|
+
- `historical-return` accepts either absolute ISO dates with `--from`/`--to` or
|
|
100
|
+
a shorthand lookback with `--period`, such as `1y` or `6m`.
|
|
90
101
|
- `beta` accepts `--years 1|3|5`.
|
|
91
102
|
- `var --confidence` takes percentages such as `95` or `99`.
|
|
92
103
|
- Use `--json` for machine parsing.
|
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
Unsupported in the public CLI:
|
|
4
4
|
|
|
5
5
|
- `--output <file>` response export
|
|
6
|
+
- deleting watchlists or holdings
|
|
7
|
+
- value-based position input for traded assets
|
|
6
8
|
|
|
7
9
|
Not a supported pattern:
|
|
8
10
|
|
|
9
11
|
- inventing commands not shown in `quantbrasil --help`
|
|
10
12
|
- assuming hidden flags exist
|
|
11
13
|
- treating backend internals as public CLI contract
|
|
14
|
+
- treating a watchlist as an investable composition for metrics
|
|
12
15
|
|
|
13
16
|
Use the public surface only:
|
|
14
17
|
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
Use this when user gives company theme, partial name, or market universe question.
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
quantbrasil market assets --
|
|
17
|
+
quantbrasil market assets --search PETR
|
|
18
18
|
quantbrasil market price PETR4
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
If exact ticker already known, skip discovery and go straight to `market price`.
|
|
22
|
+
Use `--type` when the user asks for a whole supported universe.
|
|
22
23
|
|
|
23
24
|
## Get price on specific date
|
|
24
25
|
|
|
@@ -69,7 +70,7 @@ Avoid asking for every section unless user clearly wants full report.
|
|
|
69
70
|
```bash
|
|
70
71
|
quantbrasil holdings list
|
|
71
72
|
quantbrasil holdings get 93
|
|
72
|
-
quantbrasil holdings historical-return 93 --
|
|
73
|
+
quantbrasil holdings historical-return 93 --period 1y
|
|
73
74
|
quantbrasil holdings beta 93 --years 1
|
|
74
75
|
quantbrasil holdings var 93 --years 1 --confidence 95
|
|
75
76
|
```
|
|
@@ -82,6 +83,7 @@ Rules:
|
|
|
82
83
|
|
|
83
84
|
- `holdings create` returns the holding id
|
|
84
85
|
- use `holdings set-targets` to replace target weights later
|
|
86
|
+
- use `holdings set-positions` for actual share/unit/coin quantities
|
|
85
87
|
- `beta` only accepts `--years 1|3|5`
|
|
86
88
|
- `var --confidence` takes percent like `95` or `99`
|
|
87
89
|
|
|
@@ -109,10 +111,13 @@ quantbrasil holdings create "Longo Prazo" --target PETR4:50 --target VALE3:50
|
|
|
109
111
|
quantbrasil holdings create "Carteira Real" --mode position
|
|
110
112
|
quantbrasil holdings rename 182 "Carteira Real"
|
|
111
113
|
quantbrasil holdings set-targets 182 PETR4:50 VALE3:50
|
|
114
|
+
quantbrasil holdings set-positions 182 PRIO3:1600 BTC-USD:0.25 QQQ:10
|
|
112
115
|
```
|
|
113
116
|
|
|
114
117
|
Rules:
|
|
115
118
|
|
|
116
119
|
- use `watchlists list` or `holdings list` first if the user names a saved object instead of giving id
|
|
117
120
|
- confirm destructive intent before removing assets when user request is ambiguous
|
|
121
|
+
- positions are quantity-only in the public CLI; do not pass monetary values as positions
|
|
122
|
+
- target weights and positions are independent; updating positions does not clear target weights
|
|
118
123
|
- use `--json` only when structured output is needed
|