gangtise-openapi-cli 0.10.0 → 0.10.2
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 +1 -0
- package/dist/src/cli.js +40 -15
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -348,3 +348,4 @@ gangtise raw call insight.opinion.list --body '{"from":0,"size":120}'
|
|
|
348
348
|
| `999997` | 未开通接口权限 |
|
|
349
349
|
| `999999` | Gangtise 系统错误,请稍后重试 |
|
|
350
350
|
| `433007` | 不支持该数据源(`knowledge-resource-download` 需正确的 `resourceType + sourceId` 组合) |
|
|
351
|
+
| `430007` | 行情查询超出限制(日K线/分钟K线不传 `--security` 返回全市场,数据量过大;请指定证券代码或缩短日期范围) |
|
package/dist/src/cli.js
CHANGED
|
@@ -390,9 +390,11 @@ fundamental.command("valuation-analysis").requiredOption("--security-code <code>
|
|
|
390
390
|
const client = await createClient();
|
|
391
391
|
await printData(await client.call("fundamental.valuation-analysis", { securityCode: options.securityCode, indicator: options.indicator, startDate: options.startDate, endDate: options.endDate, limit: options.limit ? Number(options.limit) : undefined, fieldList: maybeArray(options.field) }), parseFormat(options.format), options.output);
|
|
392
392
|
});
|
|
393
|
-
fundamental.command("earning-forecast").requiredOption("--security-code <code>").option("--start-date <date>").option("--end-date <date>").option("--consensus <name>", "Consensus indicator: netIncome/netIncomeYoy/eps/pe/bps/pb/peg/roe/ps", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
|
|
393
|
+
fundamental.command("earning-forecast").requiredOption("--security-code <code>").option("--start-date <date>", "Start date (default: 1 year before end-date)").option("--end-date <date>", "End date (default: today)").option("--consensus <name>", "Consensus indicator: netIncome/netIncomeYoy/eps/pe/bps/pb/peg/roe/ps", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
|
|
394
394
|
const client = await createClient();
|
|
395
|
-
|
|
395
|
+
const endDate = options.endDate ?? new Date().toISOString().slice(0, 10);
|
|
396
|
+
const startDate = options.startDate ?? new Date(Date.now() - 365 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
397
|
+
await printData(await client.call("fundamental.earning-forecast", { securityCode: options.securityCode, startDate, endDate, consensusList: maybeArray(options.consensus) }), parseFormat(options.format), options.output);
|
|
396
398
|
});
|
|
397
399
|
program.addCommand(fundamental);
|
|
398
400
|
const ai = new Command("ai").description("AI APIs");
|
|
@@ -443,10 +445,17 @@ ai.command("earnings-review").requiredOption("--security-code <code>").requiredO
|
|
|
443
445
|
const delayMs = 15_000;
|
|
444
446
|
while (attempts < maxAttempts) {
|
|
445
447
|
attempts++;
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
try {
|
|
449
|
+
const contentResult = await client.call("ai.earnings-review.get-content", { dataId });
|
|
450
|
+
if (contentResult?.data?.content) {
|
|
451
|
+
await printData(contentResult.data, parseFormat(options.format), options.output);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
catch (error) {
|
|
456
|
+
if (!(error instanceof ApiError && (error.code === "410110" || error.message?.includes("生成中")))) {
|
|
457
|
+
throw error;
|
|
458
|
+
}
|
|
450
459
|
}
|
|
451
460
|
if (attempts < maxAttempts) {
|
|
452
461
|
process.stderr.write(`Attempt ${attempts}/${maxAttempts}: content not ready, retrying in 15s...\n`);
|
|
@@ -535,10 +544,17 @@ ai.command("viewpoint-debate").requiredOption("--viewpoint <text>", "Viewpoint t
|
|
|
535
544
|
const delayMs = 15_000;
|
|
536
545
|
while (attempts < maxAttempts) {
|
|
537
546
|
attempts++;
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
547
|
+
try {
|
|
548
|
+
const contentResult = await client.call("ai.viewpoint-debate.get-content", { dataId });
|
|
549
|
+
if (contentResult?.data?.content) {
|
|
550
|
+
await printData(contentResult.data, parseFormat(options.format), options.output);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
if (!(error instanceof ApiError && (error.code === "410110" || error.message?.includes("生成中")))) {
|
|
556
|
+
throw error;
|
|
557
|
+
}
|
|
542
558
|
}
|
|
543
559
|
if (attempts < maxAttempts) {
|
|
544
560
|
process.stderr.write(`Attempt ${attempts}/${maxAttempts}: content not ready, retrying in 15s...\n`);
|
|
@@ -550,12 +566,21 @@ ai.command("viewpoint-debate").requiredOption("--viewpoint <text>", "Viewpoint t
|
|
|
550
566
|
});
|
|
551
567
|
ai.command("viewpoint-debate-check").requiredOption("--data-id <id>", "dataId from viewpoint-debate").option("--format <format>", "Output format", "json").option("--output <path>").action(async (options) => {
|
|
552
568
|
const client = await createClient();
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
569
|
+
try {
|
|
570
|
+
const contentResult = await client.call("ai.viewpoint-debate.get-content", { dataId: options.dataId });
|
|
571
|
+
if (contentResult?.data?.content) {
|
|
572
|
+
await printData(contentResult.data, parseFormat(options.format), options.output);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
process.stdout.write(`${JSON.stringify({ dataId: options.dataId, status: "pending", hint: "Content not ready yet, retry in ~2 minutes" })}\n`);
|
|
576
|
+
}
|
|
577
|
+
catch (error) {
|
|
578
|
+
if (error instanceof ApiError && (error.code === "410110" || error.message?.includes("生成中"))) {
|
|
579
|
+
process.stdout.write(`${JSON.stringify({ dataId: options.dataId, status: "pending", hint: "Content not ready yet, retry in ~2 minutes" })}\n`);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
throw error;
|
|
557
583
|
}
|
|
558
|
-
process.stdout.write(`${JSON.stringify({ dataId: options.dataId, status: "pending", hint: "Content not ready yet, retry in ~2 minutes" })}\n`);
|
|
559
584
|
});
|
|
560
585
|
const vault = new Command("vault").description("Vault APIs");
|
|
561
586
|
vault.command("drive-list").option("--from <number>", "Starting offset", "0").option("--size <number>", "Total rows to return; omit to fetch all").option("--start-time <datetime>").option("--end-time <datetime>").option("--keyword <text>").option("--file-type <number>", "File type", collectNumberList, []).option("--space-type <number>", "Space type", collectNumberList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated — DO NOT EDIT
|
|
2
|
-
export const CLI_VERSION = "0.10.
|
|
2
|
+
export const CLI_VERSION = "0.10.2";
|