@oomol-lab/open-connector 1.6.2 → 1.6.3
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 +27 -0
- package/assets/open-connector/catalog/apps/assured_platform.json +218 -0
- package/assets/open-connector/catalog/apps/baixiao.json +1080 -0
- package/assets/open-connector/catalog/apps/benchmarkone.json +956 -0
- package/assets/open-connector/catalog/apps/bing_webmaster.json +3097 -0
- package/assets/open-connector/catalog/apps/buzzsprout.json +1979 -0
- package/assets/open-connector/catalog/apps/feishu.json +13 -19
- package/assets/open-connector/catalog/apps/feishu_app_bot.json +10 -17
- package/assets/open-connector/catalog/apps/linkfox.json +836 -0
- package/assets/open-connector/catalog/apps/metatraderapi.json +1077 -0
- package/assets/open-connector/catalog/apps/mktindex.json +2411 -0
- package/assets/open-connector/catalog/apps/mojo_helpdesk.json +660 -0
- package/assets/open-connector/catalog/apps/mumble.json +446 -0
- package/assets/open-connector/catalog/apps/notion.json +112 -3
- package/assets/open-connector/catalog/apps/omise.json +438 -0
- package/assets/open-connector/catalog/apps/panjiva.json +2858 -0
- package/assets/open-connector/catalog/apps/papertrail.json +449 -0
- package/assets/open-connector/catalog/apps/peec.json +747 -0
- package/assets/open-connector/catalog/apps/polygon_io.json +5156 -584
- package/assets/open-connector/catalog/apps/quant_data.json +1928 -0
- package/assets/open-connector/catalog/apps/riddle_quiz_maker.json +621 -0
- package/assets/open-connector/catalog/apps/slack.json +327 -4
- package/assets/open-connector/catalog/apps/slackbot.json +280 -3
- package/assets/open-connector/catalog/apps/templatedocs.json +438 -0
- package/assets/open-connector/catalog/apps/terminus_app.json +510 -0
- package/assets/open-connector/catalog/apps/ticket_tailor.json +584 -0
- package/assets/open-connector/catalog/apps/tongdaxin.json +2612 -79
- package/assets/open-connector/catalog/apps/veremark.json +514 -0
- package/assets/open-connector/catalog/apps/walletap.json +549 -0
- package/assets/open-connector/catalog/apps/xiaohongshu_store.json +955 -39
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/package.json +5 -1
- package/src/connection-service.d.ts +2 -0
- package/src/connection-service.js +8 -1
- package/src/core/provider-id.d.ts +5 -0
- package/src/core/provider-id.js +12 -0
- package/src/oauth/oauth-credential-refresh-service.js +2 -0
- package/src/oauth/oauth-flow-service.js +2 -0
- package/src/providers/action-contracts.generated.d.ts +27 -7
- package/src/providers/assured_platform/executors.d.ts +4 -0
- package/src/providers/assured_platform/executors.js +18 -0
- package/src/providers/assured_platform/runtime.d.ts +7 -0
- package/src/providers/assured_platform/runtime.js +108 -0
- package/src/providers/baixiao/actions.d.ts +2 -0
- package/src/providers/baixiao/actions.js +377 -0
- package/src/providers/baixiao/executors.d.ts +4 -0
- package/src/providers/baixiao/executors.js +106 -0
- package/src/providers/benchmarkone/executors.d.ts +4 -0
- package/src/providers/benchmarkone/executors.js +26 -0
- package/src/providers/benchmarkone/runtime.d.ts +12 -0
- package/src/providers/benchmarkone/runtime.js +113 -0
- package/src/providers/bing_webmaster/actions.d.ts +2 -0
- package/src/providers/bing_webmaster/actions.js +113 -0
- package/src/providers/bing_webmaster/executors.d.ts +4 -0
- package/src/providers/bing_webmaster/executors.js +104 -0
- package/src/providers/bing_webmaster/management-actions.d.ts +2 -0
- package/src/providers/bing_webmaster/management-actions.js +241 -0
- package/src/providers/bing_webmaster/reporting-actions.d.ts +2 -0
- package/src/providers/bing_webmaster/reporting-actions.js +300 -0
- package/src/providers/bing_webmaster/schemas.d.ts +33 -0
- package/src/providers/bing_webmaster/schemas.js +313 -0
- package/src/providers/buzzsprout/executors.d.ts +4 -0
- package/src/providers/buzzsprout/executors.js +21 -0
- package/src/providers/buzzsprout/runtime.d.ts +12 -0
- package/src/providers/buzzsprout/runtime.js +237 -0
- package/src/providers/feishu/shared/drive-actions.d.ts +1 -0
- package/src/providers/feishu/shared/drive-actions.js +13 -9
- package/src/providers/feishu/shared/drive-runtime.js +15 -3
- package/src/providers/feishu/shared/wiki-actions.js +4 -2
- package/src/providers/hithink_finance/runtime.js +39 -60
- package/src/providers/linkfox/actions.js +2 -0
- package/src/providers/linkfox/runtime.js +70 -1
- package/src/providers/linkfox/sif-actions.d.ts +10 -0
- package/src/providers/linkfox/sif-actions.js +193 -0
- package/src/providers/metatraderapi/executors.d.ts +4 -0
- package/src/providers/metatraderapi/executors.js +18 -0
- package/src/providers/metatraderapi/runtime.d.ts +7 -0
- package/src/providers/metatraderapi/runtime.js +216 -0
- package/src/providers/mktindex/actions-mmi.d.ts +2 -0
- package/src/providers/mktindex/actions-mmi.js +510 -0
- package/src/providers/mktindex/actions.d.ts +2 -0
- package/src/providers/mktindex/actions.js +2 -0
- package/src/providers/mktindex/executors.d.ts +4 -0
- package/src/providers/mktindex/executors.js +27 -0
- package/src/providers/mktindex/request.d.ts +17 -0
- package/src/providers/mktindex/request.js +48 -0
- package/src/providers/mktindex/runtime.d.ts +9 -0
- package/src/providers/mktindex/runtime.js +492 -0
- package/src/providers/mojo_helpdesk/executors.d.ts +4 -0
- package/src/providers/mojo_helpdesk/executors.js +18 -0
- package/src/providers/mojo_helpdesk/runtime.d.ts +7 -0
- package/src/providers/mojo_helpdesk/runtime.js +173 -0
- package/src/providers/mumble/executors.d.ts +4 -0
- package/src/providers/mumble/executors.js +99 -0
- package/src/providers/notion/executors.d.ts +9 -0
- package/src/providers/notion/executors.js +161 -6
- package/src/providers/omise/executors.d.ts +4 -0
- package/src/providers/omise/executors.js +120 -0
- package/src/providers/panjiva/actions.d.ts +14 -0
- package/src/providers/panjiva/actions.js +389 -0
- package/src/providers/panjiva/executors.d.ts +4 -0
- package/src/providers/panjiva/executors.js +136 -0
- package/src/providers/papertrail/executors.d.ts +4 -0
- package/src/providers/papertrail/executors.js +15 -0
- package/src/providers/papertrail/runtime.d.ts +7 -0
- package/src/providers/papertrail/runtime.js +167 -0
- package/src/providers/peec/executors.d.ts +4 -0
- package/src/providers/peec/executors.js +15 -0
- package/src/providers/peec/runtime.d.ts +7 -0
- package/src/providers/peec/runtime.js +128 -0
- package/src/providers/polygon_io/actions.d.ts +2 -0
- package/src/providers/polygon_io/actions.js +282 -0
- package/src/providers/polygon_io/expanded-actions.d.ts +2 -0
- package/src/providers/polygon_io/expanded-actions.js +375 -0
- package/src/providers/polygon_io/expanded-runtime.d.ts +16 -0
- package/src/providers/polygon_io/expanded-runtime.js +277 -0
- package/src/providers/polygon_io/runtime.js +21 -2
- package/src/providers/quant_data/executors.d.ts +4 -0
- package/src/providers/quant_data/executors.js +15 -0
- package/src/providers/quant_data/runtime.d.ts +7 -0
- package/src/providers/quant_data/runtime.js +118 -0
- package/src/providers/registry.generated.js +20 -0
- package/src/providers/riddle_quiz_maker/executors.d.ts +4 -0
- package/src/providers/riddle_quiz_maker/executors.js +15 -0
- package/src/providers/riddle_quiz_maker/runtime.d.ts +7 -0
- package/src/providers/riddle_quiz_maker/runtime.js +145 -0
- package/src/providers/slack/actions.js +106 -3
- package/src/providers/slack/runtime.js +260 -36
- package/src/providers/slackbot/actions.js +1 -1
- package/src/providers/templatedocs/executors.d.ts +4 -0
- package/src/providers/templatedocs/executors.js +18 -0
- package/src/providers/templatedocs/runtime.d.ts +13 -0
- package/src/providers/templatedocs/runtime.js +151 -0
- package/src/providers/terminus_app/executors.d.ts +4 -0
- package/src/providers/terminus_app/executors.js +15 -0
- package/src/providers/terminus_app/runtime.d.ts +7 -0
- package/src/providers/terminus_app/runtime.js +172 -0
- package/src/providers/ticket_tailor/executors.d.ts +4 -0
- package/src/providers/ticket_tailor/executors.js +15 -0
- package/src/providers/ticket_tailor/runtime.d.ts +7 -0
- package/src/providers/ticket_tailor/runtime.js +152 -0
- package/src/providers/tongdaxin/actions.d.ts +1 -0
- package/src/providers/tongdaxin/actions.js +6 -3
- package/src/providers/tongdaxin/executors.js +51 -10
- package/src/providers/tongdaxin/named-action-output.d.ts +1 -0
- package/src/providers/tongdaxin/named-action-output.js +149 -0
- package/src/providers/tongdaxin/named-action-routing.d.ts +9 -0
- package/src/providers/tongdaxin/named-action-routing.js +417 -0
- package/src/providers/tongdaxin/named-actions.d.ts +2 -0
- package/src/providers/tongdaxin/named-actions.js +378 -0
- package/src/providers/veremark/executors.d.ts +4 -0
- package/src/providers/veremark/executors.js +129 -0
- package/src/providers/walletap/executors.d.ts +4 -0
- package/src/providers/walletap/executors.js +15 -0
- package/src/providers/walletap/runtime.d.ts +7 -0
- package/src/providers/walletap/runtime.js +147 -0
- package/src/providers/weixin_official_account/access-token.js +31 -7
- package/src/providers/weixin_store/access-token.js +33 -7
- package/src/providers/xiaohongshu_store/executors.js +152 -3
- package/src/server/api/openapi.js +3 -0
- package/src/server/connector-assets.d.ts +4 -0
- package/src/server/connector-assets.js +12 -0
- package/src/server/connector-build.d.ts +33 -0
- package/src/server/connector-build.js +73 -0
- package/src/server/connector-runtime.d.ts +1 -2
- package/src/server/connector-runtime.js +2 -8
- package/src/server/server-assets.d.ts +0 -28
- package/src/server/server-assets.js +0 -50
|
@@ -3,7 +3,9 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { optionalRecord } from "../../core/cast.js";
|
|
4
4
|
import { withMcpClient } from "../mcp-client.js";
|
|
5
5
|
import { defineApiKeyProviderExecutors, providerUserAgent, ProviderRequestError, requiredInputString, } from "../provider-runtime.js";
|
|
6
|
-
import { tongdaxinReadOnlyToolNames } from "./actions.js";
|
|
6
|
+
import { tongdaxinActions, tongdaxinReadOnlyToolNames } from "./actions.js";
|
|
7
|
+
import { normalizeTongdaxinNamedActionOutput } from "./named-action-output.js";
|
|
8
|
+
import { isTongdaxinNamedActionName, resolveTongdaxinNamedToolCall } from "./named-action-routing.js";
|
|
7
9
|
const service = "tongdaxin";
|
|
8
10
|
const endpoint = new URL("https://txmcp.tdx.com.cn:3001/txmcp");
|
|
9
11
|
const requestTimeoutMs = 60_000;
|
|
@@ -17,10 +19,7 @@ const handlers = {
|
|
|
17
19
|
const argumentsValue = input.arguments === undefined ? {} : optionalRecord(input.arguments);
|
|
18
20
|
if (!argumentsValue)
|
|
19
21
|
throw new ProviderRequestError(400, "arguments must be a JSON object");
|
|
20
|
-
|
|
21
|
-
if (!tools.some((tool) => tool.name === toolName)) {
|
|
22
|
-
throw new ProviderRequestError(403, "The selected Tongdaxin tool is not available as read-only");
|
|
23
|
-
}
|
|
22
|
+
assertToolArgumentsSize(argumentsValue);
|
|
24
23
|
const result = await withTongdaxinClient(context, "execute", (client) => client.callTool({ name: toolName, arguments: argumentsValue }, { timeout: requestTimeoutMs, signal: context.signal }));
|
|
25
24
|
if (!("toolResult" in result) && result.isError) {
|
|
26
25
|
throw new ProviderRequestError(502, `Tongdaxin MCP tool ${toolName} returned an error`, result);
|
|
@@ -32,6 +31,31 @@ const handlers = {
|
|
|
32
31
|
return { result: text?.type === "text" ? text.text : result.content };
|
|
33
32
|
},
|
|
34
33
|
};
|
|
34
|
+
for (const actionName of Object.keys(resolveNamedHandlers())) {
|
|
35
|
+
handlers[actionName] = async (input, context) => {
|
|
36
|
+
if (!isTongdaxinNamedActionName(actionName))
|
|
37
|
+
throw new ProviderRequestError(400, `Unknown action: ${actionName}`);
|
|
38
|
+
const toolCall = resolveTongdaxinNamedToolCall(actionName, input);
|
|
39
|
+
assertToolArgumentsSize(toolCall.arguments);
|
|
40
|
+
const tools = await discoverSupportedTools(context, "execute");
|
|
41
|
+
const tool = tools.find((candidate) => candidate.name === toolCall.toolName);
|
|
42
|
+
if (!tool && toolCall.toolName !== "wenda_macro_query") {
|
|
43
|
+
throw new ProviderRequestError(409, `Tongdaxin action ${actionName} is unavailable because this connection does not expose ${toolCall.toolName}`);
|
|
44
|
+
}
|
|
45
|
+
if (tool &&
|
|
46
|
+
(!supportedToolNames.has(tool.name) ||
|
|
47
|
+
tool.annotations?.readOnlyHint !== true ||
|
|
48
|
+
tool.annotations.destructiveHint === true)) {
|
|
49
|
+
throw new ProviderRequestError(403, `Tongdaxin MCP does not currently affirm ${tool.name} as a non-destructive read-only tool`);
|
|
50
|
+
}
|
|
51
|
+
const result = await withTongdaxinClient(context, "execute", (client) => client.callTool({ name: toolCall.toolName, arguments: toolCall.arguments }, { timeout: requestTimeoutMs, signal: context.signal }));
|
|
52
|
+
if (!("toolResult" in result) && result.isError) {
|
|
53
|
+
throw new ProviderRequestError(502, `Tongdaxin MCP tool ${toolCall.toolName} returned an error`, result);
|
|
54
|
+
}
|
|
55
|
+
const normalized = "toolResult" in result ? result : (result.structuredContent ?? extractTextContent(result.content));
|
|
56
|
+
return normalizeTongdaxinNamedActionOutput(actionName, normalized);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
35
59
|
export const executors = defineApiKeyProviderExecutors(service, handlers, {
|
|
36
60
|
skipDnsValidation: true,
|
|
37
61
|
});
|
|
@@ -55,11 +79,7 @@ export const credentialValidators = {
|
|
|
55
79
|
};
|
|
56
80
|
async function discoverSupportedTools(context, phase) {
|
|
57
81
|
const result = await withTongdaxinClient(context, phase, (client) => client.listTools({}, { timeout: requestTimeoutMs, signal: context.signal }));
|
|
58
|
-
return result.tools
|
|
59
|
-
.filter((tool) => supportedToolNames.has(tool.name) &&
|
|
60
|
-
tool.annotations?.readOnlyHint === true &&
|
|
61
|
-
tool.annotations.destructiveHint !== true)
|
|
62
|
-
.map((tool) => ({
|
|
82
|
+
return result.tools.map((tool) => ({
|
|
63
83
|
name: tool.name,
|
|
64
84
|
description: tool.description,
|
|
65
85
|
annotations: tool.annotations,
|
|
@@ -98,3 +118,24 @@ function mapTongdaxinError(error, phase) {
|
|
|
98
118
|
}
|
|
99
119
|
return new ProviderRequestError(502, error instanceof Error ? `Tongdaxin MCP request failed: ${error.message}` : "Tongdaxin MCP request failed", error);
|
|
100
120
|
}
|
|
121
|
+
function resolveNamedHandlers() {
|
|
122
|
+
return Object.fromEntries(tongdaxinActions
|
|
123
|
+
.filter((action) => action.name !== "list_tools" && action.name !== "call_tool")
|
|
124
|
+
.map((action) => [action.name, true]));
|
|
125
|
+
}
|
|
126
|
+
function assertToolArgumentsSize(argumentsValue) {
|
|
127
|
+
if (new TextEncoder().encode(JSON.stringify(argumentsValue)).byteLength > 64 * 1024) {
|
|
128
|
+
throw new ProviderRequestError(400, "arguments must not exceed 65536 JSON bytes");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function extractTextContent(content) {
|
|
132
|
+
const text = content.find((item) => item.type === "text")?.text;
|
|
133
|
+
if (text === undefined)
|
|
134
|
+
return content;
|
|
135
|
+
try {
|
|
136
|
+
return JSON.parse(text);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return text;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeTongdaxinNamedActionOutput(actionName: string, result: unknown): unknown;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { optionalBoolean, optionalRecord, optionalString, optionalStringOrNull, recordOrEmpty, } from "../../core/cast.js";
|
|
2
|
+
import { providerResponseError, requiredResponseRecord } from "../provider-runtime.js";
|
|
3
|
+
export function normalizeTongdaxinNamedActionOutput(actionName, result) {
|
|
4
|
+
const resultObject = requiredResponseRecord(result, "Tongdaxin named action result");
|
|
5
|
+
throwNamedActionFailure(resultObject);
|
|
6
|
+
switch (actionName) {
|
|
7
|
+
case "lookup_security":
|
|
8
|
+
return {
|
|
9
|
+
matches: normalizeLookupMatches(resultObject.data),
|
|
10
|
+
result,
|
|
11
|
+
};
|
|
12
|
+
case "get_quotes":
|
|
13
|
+
return normalizeQuotes(resultObject, result);
|
|
14
|
+
case "get_kline":
|
|
15
|
+
return normalizeKline(resultObject, result);
|
|
16
|
+
case "query_indicators":
|
|
17
|
+
return {
|
|
18
|
+
data: requireResponseArray(resultObject.data, "Tongdaxin indicator data"),
|
|
19
|
+
result,
|
|
20
|
+
};
|
|
21
|
+
case "screen_stocks":
|
|
22
|
+
case "screen_hk_stocks":
|
|
23
|
+
case "screen_funds":
|
|
24
|
+
case "screen_indices":
|
|
25
|
+
case "screen_fund_managers":
|
|
26
|
+
return normalizeScreening(resultObject, result);
|
|
27
|
+
case "search_news":
|
|
28
|
+
case "search_announcements":
|
|
29
|
+
case "search_reports":
|
|
30
|
+
case "query_macro_data":
|
|
31
|
+
return normalizeSearch(resultObject, result);
|
|
32
|
+
case "get_financial_statements":
|
|
33
|
+
case "get_company_profile":
|
|
34
|
+
case "get_shareholder_research":
|
|
35
|
+
case "get_institutional_holdings":
|
|
36
|
+
case "get_capital_and_trading_data":
|
|
37
|
+
case "get_dividends_and_financing":
|
|
38
|
+
case "get_share_capital":
|
|
39
|
+
case "get_valuation_and_ranking":
|
|
40
|
+
case "get_board_and_industry_data":
|
|
41
|
+
case "get_hot_topics":
|
|
42
|
+
case "get_hk_financials":
|
|
43
|
+
return normalizeF10(resultObject, result);
|
|
44
|
+
default:
|
|
45
|
+
return assertNever(actionName);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function normalizeLookupMatches(value) {
|
|
49
|
+
return requireResponseObjectArray(value, "Tongdaxin lookup data").map((match) => {
|
|
50
|
+
const marketCode = match.setcode;
|
|
51
|
+
if (typeof marketCode !== "string" && typeof marketCode !== "number") {
|
|
52
|
+
throw providerResponseError("Tongdaxin lookup setcode is required");
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...match,
|
|
56
|
+
code: requireResponseString(match.code, "Tongdaxin lookup code"),
|
|
57
|
+
marketCode: String(marketCode),
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function normalizeQuotes(resultObject, result) {
|
|
62
|
+
return {
|
|
63
|
+
baseInformation: requiredResponseRecord(resultObject.BaseInfo, "Tongdaxin quote BaseInfo"),
|
|
64
|
+
quote: requiredResponseRecord(resultObject.HQInfo, "Tongdaxin quote HQInfo"),
|
|
65
|
+
extendedInformation: requiredResponseRecord(resultObject.ExtInfo, "Tongdaxin quote ExtInfo"),
|
|
66
|
+
orderBook: resultObject.BspInfo == null ? [] : requireResponseObjectArray(resultObject.BspInfo, "Tongdaxin quote BspInfo"),
|
|
67
|
+
professionalInformation: resultObject.ProInfo == null ? {} : requiredResponseRecord(resultObject.ProInfo, "Tongdaxin quote ProInfo"),
|
|
68
|
+
financialInformation: resultObject.CwInfo == null ? {} : requiredResponseRecord(resultObject.CwInfo, "Tongdaxin quote CwInfo"),
|
|
69
|
+
statistics: resultObject.StatInfo == null ? {} : requiredResponseRecord(resultObject.StatInfo, "Tongdaxin quote StatInfo"),
|
|
70
|
+
result,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function normalizeKline(resultObject, result) {
|
|
74
|
+
const period = resultObject.Period;
|
|
75
|
+
if (typeof period !== "string" && typeof period !== "number") {
|
|
76
|
+
throw providerResponseError("Tongdaxin K-line Period is required");
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
code: requireResponseString(resultObject.Code, "Tongdaxin K-line Code"),
|
|
80
|
+
period,
|
|
81
|
+
rows: requireResponseObjectArray(resultObject.Rows, "Tongdaxin K-line Rows"),
|
|
82
|
+
statistics: requiredResponseRecord(resultObject.Stats, "Tongdaxin K-line Stats"),
|
|
83
|
+
result,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function normalizeScreening(resultObject, result) {
|
|
87
|
+
return {
|
|
88
|
+
summary: asStringOrNull(resultObject.summary),
|
|
89
|
+
metadata: requiredResponseRecord(resultObject.meta, "Tongdaxin screening meta"),
|
|
90
|
+
headers: requireResponseStringArray(resultObject.headers, "Tongdaxin screening headers"),
|
|
91
|
+
data: requireResponseObjectArray(resultObject.data, "Tongdaxin screening data"),
|
|
92
|
+
result,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function normalizeSearch(resultObject, result) {
|
|
96
|
+
if (!Object.hasOwn(resultObject, "data")) {
|
|
97
|
+
throw providerResponseError("Tongdaxin search data is required");
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
ok: optionalBoolean(resultObject.ok) ?? null,
|
|
101
|
+
query: asStringOrNull(resultObject.query),
|
|
102
|
+
data: resultObject.data ?? null,
|
|
103
|
+
result,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function normalizeF10(resultObject, result) {
|
|
107
|
+
const response = requiredResponseRecord(resultObject.response, "Tongdaxin F10 response");
|
|
108
|
+
const transformed = requiredResponseRecord(response.transformed, "Tongdaxin F10 transformed data");
|
|
109
|
+
return {
|
|
110
|
+
ok: optionalBoolean(resultObject.ok) ?? optionalBoolean(response.ok) ?? null,
|
|
111
|
+
summary: asStringOrNull(transformed.summary ?? resultObject.summary),
|
|
112
|
+
tables: requireResponseObjectArray(transformed.tables, "Tongdaxin F10 tables"),
|
|
113
|
+
result,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function assertNever(value) {
|
|
117
|
+
throw providerResponseError(`unhandled Tongdaxin action output: ${value}`);
|
|
118
|
+
}
|
|
119
|
+
function throwNamedActionFailure(result) {
|
|
120
|
+
const response = asObjectOrEmpty(result.response);
|
|
121
|
+
if (optionalBoolean(result.ok) !== false && optionalBoolean(response.ok) !== false) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
throw providerResponseError("Tongdaxin returned an unsuccessful tool result");
|
|
125
|
+
}
|
|
126
|
+
function requireResponseArray(value, label) {
|
|
127
|
+
if (!Array.isArray(value))
|
|
128
|
+
throw providerResponseError(`${label} must be an array`);
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
function requireResponseObjectArray(value, label) {
|
|
132
|
+
return requireResponseArray(value, label).map((item) => {
|
|
133
|
+
const record = optionalRecord(item);
|
|
134
|
+
if (!record)
|
|
135
|
+
throw providerResponseError(`${label} must contain objects`);
|
|
136
|
+
return record;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function requireResponseString(value, label) {
|
|
140
|
+
const string = optionalString(value);
|
|
141
|
+
if (string === undefined)
|
|
142
|
+
throw providerResponseError(`${label} must be a string`);
|
|
143
|
+
return string;
|
|
144
|
+
}
|
|
145
|
+
function requireResponseStringArray(value, label) {
|
|
146
|
+
return requireResponseArray(value, label).map((item) => requireResponseString(item, label));
|
|
147
|
+
}
|
|
148
|
+
const asObjectOrEmpty = recordOrEmpty;
|
|
149
|
+
const asStringOrNull = optionalStringOrNull;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TongdaxinReadOnlyToolName } from "./actions.ts";
|
|
2
|
+
export interface TongdaxinNamedToolCall {
|
|
3
|
+
toolName: TongdaxinReadOnlyToolName;
|
|
4
|
+
arguments: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
type NamedActionInput = Record<string, unknown>;
|
|
7
|
+
export declare function isTongdaxinNamedActionName(value: string): boolean;
|
|
8
|
+
export declare function resolveTongdaxinNamedToolCall(actionName: string, input: NamedActionInput): TongdaxinNamedToolCall;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { compactObject } from "../../core/cast.js";
|
|
2
|
+
import { providerInputError } from "../provider-runtime.js";
|
|
3
|
+
const lookupRanges = {
|
|
4
|
+
A_SHARE: "AG",
|
|
5
|
+
HK_STOCK: "HK-GP",
|
|
6
|
+
HK_FUND: "HK-JJ",
|
|
7
|
+
FUND: "JJ",
|
|
8
|
+
US_STOCK: "MG-GP",
|
|
9
|
+
INDEX: "ZS",
|
|
10
|
+
FUTURES: "QH",
|
|
11
|
+
OPTION: "QQ",
|
|
12
|
+
};
|
|
13
|
+
const indicatorRanges = {
|
|
14
|
+
A_SHARE: "AG",
|
|
15
|
+
INDEX: "ZS",
|
|
16
|
+
FUND: "JJ",
|
|
17
|
+
};
|
|
18
|
+
const screenRanges = {
|
|
19
|
+
screen_stocks: "AG",
|
|
20
|
+
screen_hk_stocks: "HK-GP",
|
|
21
|
+
screen_funds: "JJ",
|
|
22
|
+
screen_indices: "ZS",
|
|
23
|
+
screen_fund_managers: "ZG-JJJL",
|
|
24
|
+
};
|
|
25
|
+
const klinePeriods = {
|
|
26
|
+
"5_SECONDS": "12",
|
|
27
|
+
"1_MINUTE": "7",
|
|
28
|
+
"5_MINUTES": "0",
|
|
29
|
+
"15_MINUTES": "1",
|
|
30
|
+
"30_MINUTES": "2",
|
|
31
|
+
"1_HOUR": "3",
|
|
32
|
+
DAILY: "4",
|
|
33
|
+
WEEKLY: "5",
|
|
34
|
+
MONTHLY: "6",
|
|
35
|
+
QUARTERLY: "10",
|
|
36
|
+
YEARLY: "11",
|
|
37
|
+
};
|
|
38
|
+
const adjustments = {
|
|
39
|
+
NONE: "0",
|
|
40
|
+
FORWARD: "1",
|
|
41
|
+
BACKWARD: "2",
|
|
42
|
+
};
|
|
43
|
+
const companyProfileSections = {
|
|
44
|
+
OVERVIEW: {
|
|
45
|
+
entry: "TdxSharePCCW.tdxf10_gg_zxts",
|
|
46
|
+
fixedTag: "gsgy",
|
|
47
|
+
},
|
|
48
|
+
BASIC_INFORMATION: {
|
|
49
|
+
entry: "TdxSharePCCW.tdxf10_gg_gsgk",
|
|
50
|
+
fixedTag: "0",
|
|
51
|
+
},
|
|
52
|
+
ISSUANCE_AND_TRADING: {
|
|
53
|
+
entry: "TdxSharePCCW.tdxf10_gg_gsgk",
|
|
54
|
+
fixedTag: "8",
|
|
55
|
+
},
|
|
56
|
+
EXECUTIVES: {
|
|
57
|
+
entry: "TdxSharePCCW.tdxf10_gg_gsgk",
|
|
58
|
+
fixedTag: "20",
|
|
59
|
+
},
|
|
60
|
+
AFFILIATES: {
|
|
61
|
+
entry: "TdxSharePCCW.tdxf10_gg_gsgk",
|
|
62
|
+
fixedTag: "3",
|
|
63
|
+
},
|
|
64
|
+
EMPLOYEE_STRUCTURE: {
|
|
65
|
+
entry: "TdxSharePCCW.tdxf10_gg_gsgk",
|
|
66
|
+
fixedTag: "4",
|
|
67
|
+
},
|
|
68
|
+
EMPLOYEE_EFFICIENCY: {
|
|
69
|
+
entry: "TdxSharePCCW.tdxf10_gg_gsgk",
|
|
70
|
+
fixedTag: "5",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
const shareholderSections = {
|
|
74
|
+
CONTROLLING_SHAREHOLDER: "kggd",
|
|
75
|
+
SHAREHOLDER_COUNT: "gdrs",
|
|
76
|
+
SHAREHOLDER_COUNT_RANK: "thygdrs",
|
|
77
|
+
TOP_FLOAT_SHAREHOLDERS: "ltgd",
|
|
78
|
+
TOP_SHAREHOLDERS: "sdgdbgq",
|
|
79
|
+
};
|
|
80
|
+
const dividendSections = {
|
|
81
|
+
OVERVIEW: "pxmz",
|
|
82
|
+
DIVIDEND_CHART: "fh_zzt",
|
|
83
|
+
RIGHTS_ISSUE_PLAN: "pf",
|
|
84
|
+
PLACEMENT_DETAIL: "zfpg",
|
|
85
|
+
REFINANCING_PLAN: "zf",
|
|
86
|
+
PAYOUT_HISTORY: "fhlszs_glzfl",
|
|
87
|
+
YIELD_HISTORY: "fhlszs_gxl",
|
|
88
|
+
PAYOUT_RANK: "fhpm_glzfl",
|
|
89
|
+
YIELD_RANK: "fhpm_gxl",
|
|
90
|
+
CASH_FINANCING_RATIO_RANK: "fhpm_pxrzb",
|
|
91
|
+
};
|
|
92
|
+
const shareCapitalSections = {
|
|
93
|
+
STRUCTURE: "gbjg",
|
|
94
|
+
CHANGES: "gbbd",
|
|
95
|
+
RESTRICTED_UNLOCKS: "xslt",
|
|
96
|
+
STOCK_BUYBACK: "gphg",
|
|
97
|
+
};
|
|
98
|
+
const hotTopicSections = {
|
|
99
|
+
BOARD_FAMILY: "zttzbkz",
|
|
100
|
+
THEME_LIBRARY: "zttzztk",
|
|
101
|
+
EVENT_DRIVEN: "sjcd",
|
|
102
|
+
INFORMATION_OVERVIEW: "xxmmg",
|
|
103
|
+
};
|
|
104
|
+
const hkFinancialSections = {
|
|
105
|
+
INCOME_STATEMENT: "1",
|
|
106
|
+
BALANCE_SHEET: "2",
|
|
107
|
+
CASH_FLOW_STATEMENT: "3",
|
|
108
|
+
};
|
|
109
|
+
const tongdaxinNamedActionRoutes = {
|
|
110
|
+
lookup_security: (input) => toolCall("tdx_lookup_stock", {
|
|
111
|
+
query: input.query,
|
|
112
|
+
range: lookupRanges[input.market],
|
|
113
|
+
}),
|
|
114
|
+
get_quotes: (input) => toolCall("tdx_quotes", {
|
|
115
|
+
code: input.code,
|
|
116
|
+
setcode: input.marketCode,
|
|
117
|
+
bspNum: input.orderBookDepth,
|
|
118
|
+
hasProInfo: booleanFlag(input.includeProfessionalData),
|
|
119
|
+
hasCwInfo: booleanFlag(input.includeFinancialData),
|
|
120
|
+
hasStatInfo: booleanFlag(input.includeStatistics),
|
|
121
|
+
statParam: input.statisticParameter,
|
|
122
|
+
}),
|
|
123
|
+
get_kline: (input) => toolCall("tdx_kline", {
|
|
124
|
+
code: input.code,
|
|
125
|
+
setcode: input.marketCode,
|
|
126
|
+
period: klinePeriods[input.period],
|
|
127
|
+
wantNum: input.count,
|
|
128
|
+
startxh: input.offset,
|
|
129
|
+
tqFlag: adjustments[input.adjustment],
|
|
130
|
+
hasIpoPrice: booleanFlag(input.includeIpoPrice),
|
|
131
|
+
}),
|
|
132
|
+
query_indicators: (input) => toolCall("tdx_indicator_select", {
|
|
133
|
+
message: input.query,
|
|
134
|
+
rang: indicatorRanges[input.market],
|
|
135
|
+
}),
|
|
136
|
+
screen_stocks: (input) => screenToolCall("screen_stocks", input),
|
|
137
|
+
screen_hk_stocks: (input) => screenToolCall("screen_hk_stocks", input),
|
|
138
|
+
screen_funds: (input) => screenToolCall("screen_funds", input),
|
|
139
|
+
screen_indices: (input) => screenToolCall("screen_indices", input),
|
|
140
|
+
screen_fund_managers: (input) => screenToolCall("screen_fund_managers", input),
|
|
141
|
+
search_news: (input) => wendaToolCall("wenda_news_query", input),
|
|
142
|
+
search_announcements: (input) => wendaToolCall("wenda_notice_query", input),
|
|
143
|
+
search_reports: (input) => wendaToolCall("wenda_report_query", input),
|
|
144
|
+
query_macro_data: (input) => toolCall("wenda_macro_query", { query: input.query }),
|
|
145
|
+
get_financial_statements: (input) => toolCall("tdx_api_data", financialStatementArguments(input)),
|
|
146
|
+
get_company_profile: (input) => {
|
|
147
|
+
const route = companyProfileSections[input.section];
|
|
148
|
+
return toolCall("tdx_api_data", { ...route, code: input.code });
|
|
149
|
+
},
|
|
150
|
+
get_shareholder_research: (input) => toolCall("tdx_api_data", {
|
|
151
|
+
entry: "TdxSharePCCW.tdxf10_gg_gdyj",
|
|
152
|
+
code: input.code,
|
|
153
|
+
fixedTag: shareholderSections[input.section],
|
|
154
|
+
pageNo: input.page,
|
|
155
|
+
pageSize: input.pageSize,
|
|
156
|
+
}),
|
|
157
|
+
get_institutional_holdings: (input) => toolCall("tdx_api_data", institutionalHoldingArguments(input)),
|
|
158
|
+
get_capital_and_trading_data: (input) => toolCall("tdx_api_data", capitalAndTradingArguments(input)),
|
|
159
|
+
get_dividends_and_financing: (input) => toolCall("tdx_api_data", {
|
|
160
|
+
entry: "TdxSharePCCW.tdxf10_gg_fhrz",
|
|
161
|
+
code: input.code,
|
|
162
|
+
fixedTag: dividendSections[input.section],
|
|
163
|
+
}),
|
|
164
|
+
get_share_capital: (input) => toolCall("tdx_api_data", {
|
|
165
|
+
entry: "TdxSharePCCW.tdxf10_gg_gbjg",
|
|
166
|
+
code: input.code,
|
|
167
|
+
fixedTag: shareCapitalSections[input.section],
|
|
168
|
+
}),
|
|
169
|
+
get_valuation_and_ranking: (input) => toolCall("tdx_api_data", valuationAndRankingArguments(input)),
|
|
170
|
+
get_board_and_industry_data: (input) => toolCall("tdx_api_data", boardAndIndustryArguments(input)),
|
|
171
|
+
get_hot_topics: (input) => toolCall("tdx_api_data", {
|
|
172
|
+
entry: "TdxSharePCCW.tdxf10_gg_rdtc",
|
|
173
|
+
code: input.code,
|
|
174
|
+
fixedTag: hotTopicSections[input.section],
|
|
175
|
+
}),
|
|
176
|
+
get_hk_financials: (input) => toolCall("tdx_api_data", {
|
|
177
|
+
entry: "TdxSharePCCW.skef10_hk_cwfx",
|
|
178
|
+
code: input.code,
|
|
179
|
+
fixedTag: hkFinancialSections[input.statement],
|
|
180
|
+
}),
|
|
181
|
+
};
|
|
182
|
+
export function isTongdaxinNamedActionName(value) {
|
|
183
|
+
return value in tongdaxinNamedActionRoutes;
|
|
184
|
+
}
|
|
185
|
+
export function resolveTongdaxinNamedToolCall(actionName, input) {
|
|
186
|
+
return tongdaxinNamedActionRoutes[actionName](input);
|
|
187
|
+
}
|
|
188
|
+
function screenToolCall(actionName, input) {
|
|
189
|
+
return toolCall("tdx_screener", {
|
|
190
|
+
message: input.criteria,
|
|
191
|
+
rang: screenRanges[actionName],
|
|
192
|
+
pageNo: input.page,
|
|
193
|
+
pageSize: input.pageSize,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function toolCall(toolName, arguments_) {
|
|
197
|
+
return { toolName, arguments: compactObject(arguments_) };
|
|
198
|
+
}
|
|
199
|
+
function booleanFlag(value) {
|
|
200
|
+
return typeof value === "boolean" ? (value ? "1" : "0") : undefined;
|
|
201
|
+
}
|
|
202
|
+
function wendaToolCall(toolName, input) {
|
|
203
|
+
return toolCall(toolName, {
|
|
204
|
+
query: input.query,
|
|
205
|
+
name: input.name,
|
|
206
|
+
symbol: input.symbol,
|
|
207
|
+
bdate: input.startDate,
|
|
208
|
+
edate: input.endDate,
|
|
209
|
+
keywords: input.keywords,
|
|
210
|
+
desc: input.context,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function financialStatementArguments(input) {
|
|
214
|
+
const reportTag = input.reportView === "SINGLE_QUARTER" ? "00102" : "00101";
|
|
215
|
+
switch (input.statement) {
|
|
216
|
+
case "INCOME_STATEMENT":
|
|
217
|
+
return {
|
|
218
|
+
entry: "TdxShareCW.ph_agf10_cw_lyb",
|
|
219
|
+
code: input.code,
|
|
220
|
+
fixedTag: reportTag,
|
|
221
|
+
};
|
|
222
|
+
case "BALANCE_SHEET":
|
|
223
|
+
return { entry: "TdxShareCW.ph_agf10_cw_zcfzb", code: input.code };
|
|
224
|
+
case "CASH_FLOW_STATEMENT":
|
|
225
|
+
return {
|
|
226
|
+
entry: "TdxShareCW.ph_agf10_cw_xjllb",
|
|
227
|
+
code: input.code,
|
|
228
|
+
fixedTag: reportTag,
|
|
229
|
+
};
|
|
230
|
+
default:
|
|
231
|
+
throw unsupportedSection("financial statement", input.statement);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function institutionalHoldingArguments(input) {
|
|
235
|
+
const common = { code: input.code, pageNo: input.page, pageSize: input.pageSize };
|
|
236
|
+
switch (input.section) {
|
|
237
|
+
case "AVAILABLE_DATES":
|
|
238
|
+
return {
|
|
239
|
+
entry: "TdxSharePCCW.tdxf10_gg_comreq",
|
|
240
|
+
...common,
|
|
241
|
+
fixedTag: "jgcg",
|
|
242
|
+
};
|
|
243
|
+
case "SUMMARY":
|
|
244
|
+
return {
|
|
245
|
+
entry: "TdxSharePCCW.tdxf10_gg_gdyj",
|
|
246
|
+
...common,
|
|
247
|
+
fixedTag: "jgcg",
|
|
248
|
+
};
|
|
249
|
+
case "OVERVIEW":
|
|
250
|
+
return {
|
|
251
|
+
entry: "TdxSharePCCW.tdxf10_gg_gdyj",
|
|
252
|
+
...common,
|
|
253
|
+
fixedTag: "jgcgz",
|
|
254
|
+
reportDate: input.reportDate,
|
|
255
|
+
};
|
|
256
|
+
case "DETAIL":
|
|
257
|
+
return {
|
|
258
|
+
entry: "TdxSharePCCW.tdxf10_gg_gdyj_jgcgmx",
|
|
259
|
+
...common,
|
|
260
|
+
reportDate: input.reportDate,
|
|
261
|
+
sortType: input.sort,
|
|
262
|
+
typeValue: input.institutionType,
|
|
263
|
+
};
|
|
264
|
+
case "NORTHBOUND_FUNDS":
|
|
265
|
+
return {
|
|
266
|
+
entry: "TdxSharePCCW.tdxf10_gg_zlcc",
|
|
267
|
+
...common,
|
|
268
|
+
fixedTag: "bszj",
|
|
269
|
+
date: input.date,
|
|
270
|
+
};
|
|
271
|
+
case "PRICE_COMPARISON":
|
|
272
|
+
return {
|
|
273
|
+
entry: "TdxShareCW.ph_agf10_gbgd_jgcc",
|
|
274
|
+
...common,
|
|
275
|
+
queryKey: "00101",
|
|
276
|
+
compareFlag: input.comparison,
|
|
277
|
+
};
|
|
278
|
+
default:
|
|
279
|
+
throw unsupportedSection("institutional holdings", input.section);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function capitalAndTradingArguments(input) {
|
|
283
|
+
const code = input.code;
|
|
284
|
+
switch (input.section) {
|
|
285
|
+
case "CAPITAL_FLOW":
|
|
286
|
+
return dataSection("TdxSharePCCW.tdxf10_gg_jyds", code, "zjlx");
|
|
287
|
+
case "NORTHBOUND_FUNDS":
|
|
288
|
+
return {
|
|
289
|
+
...dataSection("TdxSharePCCW.tdxf10_gg_zlcc", code, "bszj"),
|
|
290
|
+
date: input.date,
|
|
291
|
+
};
|
|
292
|
+
case "BLOCK_TRADE":
|
|
293
|
+
return {
|
|
294
|
+
...dataSection("TdxSharePCCW.tdxf10_gg_jyds", code, "dzjy"),
|
|
295
|
+
extra: input.date,
|
|
296
|
+
};
|
|
297
|
+
case "BLOCK_TRADE_INTENTION":
|
|
298
|
+
return dataSection("TdxSharePCCW.tdxf10_gg_iyds", code, "yxsbxx");
|
|
299
|
+
case "MARGIN_TRADING":
|
|
300
|
+
return dataSection("TdxSharePCCW.tdxf10_gg_jyds", code, "rzrq");
|
|
301
|
+
case "REFINANCING":
|
|
302
|
+
return dataSection("TdxSharePCCW.tdxf10_gg_jyds", code, "zrq");
|
|
303
|
+
case "LIMIT_UP_ANALYSIS":
|
|
304
|
+
return dataSection("TdxSharePCCW.tdxf10_gg_jyds", code, "ztfx");
|
|
305
|
+
case "LIMIT_DOWN_ANALYSIS":
|
|
306
|
+
return dataSection("TdxSharePCCW.tdxf10_gg_jyds", code, "dtfx");
|
|
307
|
+
case "SHAREHOLDER_CHANGE":
|
|
308
|
+
return {
|
|
309
|
+
...dataSection("TdxSharePCCW.tdxf10_gg_gdyj", code, "cgbd"),
|
|
310
|
+
beginDate: input.startDate,
|
|
311
|
+
endDate: input.endDate,
|
|
312
|
+
pageNo: input.page,
|
|
313
|
+
pageSize: input.pageSize,
|
|
314
|
+
};
|
|
315
|
+
case "TOP_SHAREHOLDER_DETAIL":
|
|
316
|
+
return {
|
|
317
|
+
mode: "code-sort-report-type-click-page",
|
|
318
|
+
entry: "TdxSharePCCW.tdxf10_gg_gdyj_jgcgmx",
|
|
319
|
+
code,
|
|
320
|
+
reportDate: input.reportDate,
|
|
321
|
+
sortType: input.sort,
|
|
322
|
+
typeValue: input.shareholderType,
|
|
323
|
+
clickIndex: input.selectedIndex,
|
|
324
|
+
pageNo: input.page,
|
|
325
|
+
pageSize: input.pageSize,
|
|
326
|
+
responseTransform: { kind: "preset", preset: "top_shareholder_detail" },
|
|
327
|
+
};
|
|
328
|
+
default:
|
|
329
|
+
throw unsupportedSection("capital and trading", input.section);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function valuationAndRankingArguments(input) {
|
|
333
|
+
switch (input.section) {
|
|
334
|
+
case "VALUATION_HISTORY":
|
|
335
|
+
return {
|
|
336
|
+
entry: "TdxShareCW.ph_agf10_gzfx",
|
|
337
|
+
code: input.code,
|
|
338
|
+
extraOne: input.timeRange,
|
|
339
|
+
extraTwo: input.valuationMetric,
|
|
340
|
+
};
|
|
341
|
+
case "INDUSTRY_FINANCIAL_RANK":
|
|
342
|
+
return {
|
|
343
|
+
entry: "TdxShareCW.ph_agf10_hypm",
|
|
344
|
+
code: input.code,
|
|
345
|
+
queryKey: "00102",
|
|
346
|
+
extra: input.reportDate,
|
|
347
|
+
};
|
|
348
|
+
case "INDUSTRY_VALUATION_RANK":
|
|
349
|
+
return {
|
|
350
|
+
entry: "TdxShareCW.ph_agf10_hypm",
|
|
351
|
+
code: input.code,
|
|
352
|
+
queryKey: "00105",
|
|
353
|
+
extra: input.reportDate,
|
|
354
|
+
};
|
|
355
|
+
case "FINANCIAL_SECTOR_INDICATORS":
|
|
356
|
+
return {
|
|
357
|
+
entry: "TdxShareCW.ph_agf10_cw_zxzbxq",
|
|
358
|
+
code: input.code,
|
|
359
|
+
extra: input.reportDate,
|
|
360
|
+
};
|
|
361
|
+
case "BOARD_RELATIVE_VALUATION":
|
|
362
|
+
return {
|
|
363
|
+
entry: "TdxSharePCCW.skef10_hy_hydw_gzsppm",
|
|
364
|
+
queryType: "01",
|
|
365
|
+
targetCode: input.boardCode,
|
|
366
|
+
stockCode: input.code,
|
|
367
|
+
};
|
|
368
|
+
case "BOARD_HISTORY_VALUATION":
|
|
369
|
+
return {
|
|
370
|
+
entry: "TdxSharePCCW.skef10_hy_hydw_gzsppm",
|
|
371
|
+
queryType: "02",
|
|
372
|
+
targetCode: input.boardCode,
|
|
373
|
+
stockCode: "",
|
|
374
|
+
};
|
|
375
|
+
default:
|
|
376
|
+
throw unsupportedSection("valuation and ranking", input.section);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function boardAndIndustryArguments(input) {
|
|
380
|
+
switch (input.section) {
|
|
381
|
+
case "BOARD_BASIC_INFORMATION":
|
|
382
|
+
return boardSection(input.code, "001", "");
|
|
383
|
+
case "BOARD_DETAIL":
|
|
384
|
+
return boardSection(input.code, "002", "");
|
|
385
|
+
case "BOARD_STAGE_RETURN":
|
|
386
|
+
return boardSection(input.code, "003", input.period ?? "1m");
|
|
387
|
+
case "BOARD_MARKET_STATISTICS":
|
|
388
|
+
return boardSection(input.code, "004", "");
|
|
389
|
+
case "INDUSTRY_CHAIN":
|
|
390
|
+
return {
|
|
391
|
+
entry: "TdxSharePCCW.cfg_tk_gethy",
|
|
392
|
+
industryCode: input.code,
|
|
393
|
+
};
|
|
394
|
+
case "INDUSTRY_IMPORTANT_EVENTS":
|
|
395
|
+
return {
|
|
396
|
+
entry: "TdxSharePCCW.skef10_hy_zxdt_hyzysj",
|
|
397
|
+
industryCode: input.code,
|
|
398
|
+
title: input.title,
|
|
399
|
+
};
|
|
400
|
+
default:
|
|
401
|
+
throw unsupportedSection("board and industry", input.section);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
function dataSection(entry, code, fixedTag) {
|
|
405
|
+
return { entry, code, fixedTag };
|
|
406
|
+
}
|
|
407
|
+
function boardSection(code, branch, timeType) {
|
|
408
|
+
return {
|
|
409
|
+
entry: "TdxSharePCCW.skef10_bk_cpbd_jczl",
|
|
410
|
+
code,
|
|
411
|
+
branch,
|
|
412
|
+
timeType,
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function unsupportedSection(label, value) {
|
|
416
|
+
return providerInputError(`unsupported Tongdaxin ${label} section: ${String(value)}`);
|
|
417
|
+
}
|