@t2b2c/agent-stock-sdk 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +188 -2
  2. package/dist/board/ge7-themes.d.ts +4 -0
  3. package/dist/board/ge7-themes.d.ts.map +1 -0
  4. package/dist/board/ge7-themes.js +10 -0
  5. package/dist/board/limit-up-ladder.d.ts +8 -0
  6. package/dist/board/limit-up-ladder.d.ts.map +1 -0
  7. package/dist/board/limit-up-ladder.js +13 -0
  8. package/dist/client.d.ts +76 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +130 -0
  11. package/dist/config.d.ts +34 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +12 -0
  14. package/dist/http.d.ts +12 -0
  15. package/dist/http.d.ts.map +1 -0
  16. package/dist/http.js +60 -0
  17. package/dist/index.d.ts +35 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +22 -0
  20. package/dist/kline/capture-kline-screenshots.d.ts +10 -0
  21. package/dist/kline/capture-kline-screenshots.d.ts.map +1 -0
  22. package/dist/kline/capture-kline-screenshots.js +133 -0
  23. package/dist/kline/capture-market-kline-screenshots.d.ts +13 -0
  24. package/dist/kline/capture-market-kline-screenshots.d.ts.map +1 -0
  25. package/dist/kline/capture-market-kline-screenshots.js +167 -0
  26. package/dist/kline/fetch-kline.d.ts +30 -0
  27. package/dist/kline/fetch-kline.d.ts.map +1 -0
  28. package/dist/kline/fetch-kline.js +54 -0
  29. package/dist/kline/fetch-market-kline.d.ts +10 -0
  30. package/dist/kline/fetch-market-kline.d.ts.map +1 -0
  31. package/dist/kline/fetch-market-kline.js +67 -0
  32. package/dist/kline/kline-list-url.d.ts +14 -0
  33. package/dist/kline/kline-list-url.d.ts.map +1 -0
  34. package/dist/kline/kline-list-url.js +46 -0
  35. package/dist/kline/market-symbols.d.ts +22 -0
  36. package/dist/kline/market-symbols.d.ts.map +1 -0
  37. package/dist/kline/market-symbols.js +105 -0
  38. package/dist/kline/normalize.d.ts +17 -0
  39. package/dist/kline/normalize.d.ts.map +1 -0
  40. package/dist/kline/normalize.js +34 -0
  41. package/dist/kline/screenshot-helpers.d.ts +59 -0
  42. package/dist/kline/screenshot-helpers.d.ts.map +1 -0
  43. package/dist/kline/screenshot-helpers.js +320 -0
  44. package/dist/kline/screenshot-route.d.ts +25 -0
  45. package/dist/kline/screenshot-route.d.ts.map +1 -0
  46. package/dist/kline/screenshot-route.js +65 -0
  47. package/dist/kline/webbridge-client.d.ts +22 -0
  48. package/dist/kline/webbridge-client.d.ts.map +1 -0
  49. package/dist/kline/webbridge-client.js +41 -0
  50. package/dist/pool/large-cap-limit-up-3d.d.ts +7 -0
  51. package/dist/pool/large-cap-limit-up-3d.d.ts.map +1 -0
  52. package/dist/pool/large-cap-limit-up-3d.js +20 -0
  53. package/dist/pool/large-cap-trend.d.ts +7 -0
  54. package/dist/pool/large-cap-trend.d.ts.map +1 -0
  55. package/dist/pool/large-cap-trend.js +20 -0
  56. package/dist/pool/limit-up-30d.d.ts +8 -0
  57. package/dist/pool/limit-up-30d.d.ts.map +1 -0
  58. package/dist/pool/limit-up-30d.js +21 -0
  59. package/dist/pool/pick-and-merge.d.ts +12 -0
  60. package/dist/pool/pick-and-merge.d.ts.map +1 -0
  61. package/dist/pool/pick-and-merge.js +110 -0
  62. package/dist/pool/query-bodies.d.ts +68 -0
  63. package/dist/pool/query-bodies.d.ts.map +1 -0
  64. package/dist/pool/query-bodies.js +121 -0
  65. package/dist/pool/small-cap-trend.d.ts +8 -0
  66. package/dist/pool/small-cap-trend.d.ts.map +1 -0
  67. package/dist/pool/small-cap-trend.js +27 -0
  68. package/dist/pool/snapshot-query.d.ts +5 -0
  69. package/dist/pool/snapshot-query.d.ts.map +1 -0
  70. package/dist/pool/snapshot-query.js +15 -0
  71. package/dist/types/board.d.ts +67 -0
  72. package/dist/types/board.d.ts.map +1 -0
  73. package/dist/types/board.js +1 -0
  74. package/dist/types/kline-screenshot.d.ts +64 -0
  75. package/dist/types/kline-screenshot.d.ts.map +1 -0
  76. package/dist/types/kline-screenshot.js +1 -0
  77. package/dist/types/kline.d.ts +31 -0
  78. package/dist/types/kline.d.ts.map +1 -0
  79. package/dist/types/kline.js +6 -0
  80. package/dist/types/market-kline-screenshot.d.ts +35 -0
  81. package/dist/types/market-kline-screenshot.d.ts.map +1 -0
  82. package/dist/types/market-kline-screenshot.js +1 -0
  83. package/dist/types/snapshot-pool.d.ts +53 -0
  84. package/dist/types/snapshot-pool.d.ts.map +1 -0
  85. package/dist/types/snapshot-pool.js +1 -0
  86. package/docs/SnapshotPoolItem/345/255/227/346/256/265/350/257/264/346/230/216.md +140 -0
  87. package/docs//344/270/244/344/270/252/350/266/213/345/212/277/347/245/250curl.md +102 -0
  88. package/docs//350/266/213/345/212/277/347/245/250/344/270/216/346/211/223/346/235/277/350/202/241/347/245/250/346/261/240.md +260 -0
  89. package/examples/capture-kline-screenshots.ts +151 -0
  90. package/examples/capture-market-kline-screenshots.ts +152 -0
  91. package/examples/fetch-snapshot-pools.ts +237 -0
  92. package/package.json +54 -4
@@ -0,0 +1,41 @@
1
+ import { DEFAULT_WEBBRIDGE_BASE_URL } from '../config.js';
2
+ export { DEFAULT_WEBBRIDGE_BASE_URL };
3
+ export class WebbridgeError extends Error {
4
+ code;
5
+ constructor(message, code) {
6
+ super(message);
7
+ this.name = 'WebbridgeError';
8
+ this.code = code;
9
+ }
10
+ }
11
+ /**
12
+ * Thin HTTP client for the Kimi WebBridge local daemon (`POST /command`).
13
+ * @see https://www.kimi.com/zh-cn/features/webbridge
14
+ */
15
+ export function createWebbridgeClient(options) {
16
+ const baseUrl = (options.baseUrl ?? DEFAULT_WEBBRIDGE_BASE_URL).replace(/\/+$/, '');
17
+ const fetchImpl = options.fetch ?? globalThis.fetch;
18
+ if (typeof fetchImpl !== 'function') {
19
+ throw new Error('createWebbridgeClient requires a fetch implementation (Node 18+ or pass options.fetch)');
20
+ }
21
+ async function command(action, args = {}) {
22
+ const res = await fetchImpl(`${baseUrl}/command`, {
23
+ method: 'POST',
24
+ headers: { 'Content-Type': 'application/json' },
25
+ body: JSON.stringify({
26
+ action,
27
+ args,
28
+ session: options.session,
29
+ }),
30
+ });
31
+ if (!res.ok) {
32
+ throw new WebbridgeError(`WebBridge HTTP ${res.status} for action=${action}`, 'http_error');
33
+ }
34
+ const body = (await res.json());
35
+ if (body.ok === false) {
36
+ throw new WebbridgeError(body.error?.message ?? `WebBridge action failed: ${action}`, body.error?.code);
37
+ }
38
+ return body.data;
39
+ }
40
+ return { command, session: options.session, baseUrl };
41
+ }
@@ -0,0 +1,7 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { SnapshotPoolQueryPaging, SnapshotPoolResult } from '../types/snapshot-pool.js';
3
+ /**
4
+ * 池 D:大市值涨停观察(流通市值 ≥ 300 亿,韭研异动日近 3 自然日)。
5
+ */
6
+ export declare function fetchLargeCapLimitUp3dPool(http: HttpClient, paging?: SnapshotPoolQueryPaging): Promise<SnapshotPoolResult>;
7
+ //# sourceMappingURL=large-cap-limit-up-3d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"large-cap-limit-up-3d.d.ts","sourceRoot":"","sources":["../../src/pool/large-cap-limit-up-3d.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAKlC;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
@@ -0,0 +1,20 @@
1
+ import { buildLargeCapLimitUp3dBody } from './query-bodies.js';
2
+ import { pickSnapshotPoolItems } from './pick-and-merge.js';
3
+ import { postSnapshotQuery } from './snapshot-query.js';
4
+ /**
5
+ * 池 D:大市值涨停观察(流通市值 ≥ 300 亿,韭研异动日近 3 自然日)。
6
+ */
7
+ export async function fetchLargeCapLimitUp3dPool(http, paging) {
8
+ const res = await postSnapshotQuery(http, buildLargeCapLimitUp3dBody(paging));
9
+ const items = pickSnapshotPoolItems(res.items);
10
+ return {
11
+ items,
12
+ sourceTotals: {
13
+ d: res.total,
14
+ merged: items.length,
15
+ },
16
+ dataVersion: res.dataVersion,
17
+ stale: res.stale,
18
+ recentTradingDays10: res.recentTradingDays10 ?? null,
19
+ };
20
+ }
@@ -0,0 +1,7 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { SnapshotPoolQueryPaging, SnapshotPoolResult } from '../types/snapshot-pool.js';
3
+ /**
4
+ * 池 C:大市值趋势(市值 ≥ 500 亿,基金持股 ≥ 40,看谁涨得好)。
5
+ */
6
+ export declare function fetchLargeCapTrendPool(http: HttpClient, paging?: SnapshotPoolQueryPaging): Promise<SnapshotPoolResult>;
7
+ //# sourceMappingURL=large-cap-trend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"large-cap-trend.d.ts","sourceRoot":"","sources":["../../src/pool/large-cap-trend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAKlC;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
@@ -0,0 +1,20 @@
1
+ import { buildLargeCapTrendBody } from './query-bodies.js';
2
+ import { pickSnapshotPoolItems } from './pick-and-merge.js';
3
+ import { postSnapshotQuery } from './snapshot-query.js';
4
+ /**
5
+ * 池 C:大市值趋势(市值 ≥ 500 亿,基金持股 ≥ 40,看谁涨得好)。
6
+ */
7
+ export async function fetchLargeCapTrendPool(http, paging) {
8
+ const res = await postSnapshotQuery(http, buildLargeCapTrendBody(paging));
9
+ const items = pickSnapshotPoolItems(res.items);
10
+ return {
11
+ items,
12
+ sourceTotals: {
13
+ c: res.total,
14
+ merged: items.length,
15
+ },
16
+ dataVersion: res.dataVersion,
17
+ stale: res.stale,
18
+ recentTradingDays10: res.recentTradingDays10 ?? null,
19
+ };
20
+ }
@@ -0,0 +1,8 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { SnapshotPoolQueryPaging, SnapshotPoolResult } from '../types/snapshot-pool.js';
3
+ /**
4
+ * 池 B:近 30 自然日涨停活跃股(涨停总天数 ≥ 5)。
5
+ * 后续用于找打板二波 / 打板中军候选;与池 A 勿混并。
6
+ */
7
+ export declare function fetchLimitUp30dPool(http: HttpClient, paging?: SnapshotPoolQueryPaging): Promise<SnapshotPoolResult>;
8
+ //# sourceMappingURL=limit-up-30d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limit-up-30d.d.ts","sourceRoot":"","sources":["../../src/pool/limit-up-30d.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAKlC;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
@@ -0,0 +1,21 @@
1
+ import { buildLimitUp30dBody } from './query-bodies.js';
2
+ import { pickSnapshotPoolItems } from './pick-and-merge.js';
3
+ import { postSnapshotQuery } from './snapshot-query.js';
4
+ /**
5
+ * 池 B:近 30 自然日涨停活跃股(涨停总天数 ≥ 5)。
6
+ * 后续用于找打板二波 / 打板中军候选;与池 A 勿混并。
7
+ */
8
+ export async function fetchLimitUp30dPool(http, paging) {
9
+ const res = await postSnapshotQuery(http, buildLimitUp30dBody(paging));
10
+ const items = pickSnapshotPoolItems(res.items);
11
+ return {
12
+ items,
13
+ sourceTotals: {
14
+ b: res.total,
15
+ merged: items.length,
16
+ },
17
+ dataVersion: res.dataVersion,
18
+ stale: res.stale,
19
+ recentTradingDays10: res.recentTradingDays10 ?? null,
20
+ };
21
+ }
@@ -0,0 +1,12 @@
1
+ import type { SnapshotPoolItem } from '../types/snapshot-pool.js';
2
+ /**
3
+ * 从 Nest snapshot query 单行裁剪出 K 线网格必要字段。
4
+ * 无有效 `code` 的行丢弃。
5
+ */
6
+ export declare function pickSnapshotPoolItem(row: unknown): SnapshotPoolItem | null;
7
+ export declare function pickSnapshotPoolItems(rows: unknown[]): SnapshotPoolItem[];
8
+ /**
9
+ * 按 `code`(大写)去重合并;后写覆盖前写。
10
+ */
11
+ export declare function mergeSnapshotPoolByCode(...lists: SnapshotPoolItem[][]): SnapshotPoolItem[];
12
+ //# sourceMappingURL=pick-and-merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pick-and-merge.d.ts","sourceRoot":"","sources":["../../src/pool/pick-and-merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAgDjE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAoC1E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAOzE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,KAAK,EAAE,gBAAgB,EAAE,EAAE,GAC7B,gBAAgB,EAAE,CASpB"}
@@ -0,0 +1,110 @@
1
+ const POOL_ITEM_KEYS = [
2
+ 'code',
3
+ 'name',
4
+ 'floatMarketCapYuan',
5
+ 'fundHoldingsCount',
6
+ 'financingBalanceYuan',
7
+ 'price',
8
+ 'changePercent',
9
+ 'klineTurnover',
10
+ 'amount',
11
+ 'bullBarDate',
12
+ 'dayReturn20d',
13
+ 'dayReturn40d',
14
+ 'dayReturn60d',
15
+ 'weekReturn26w',
16
+ 'boxAmplitudePct',
17
+ 'jiuyanActDate',
18
+ 'jiuyanFieldName',
19
+ 'jiuyanLimitUpTotalDays',
20
+ 'jiuyanLimitUpDuringDays',
21
+ 'jiuyanConsecutiveLimitUpDays',
22
+ 'jiuyanLimitUpTime',
23
+ 'jiuyanBriefReason',
24
+ 'jiuyanDetailReason',
25
+ 'jiuyanThemeRank',
26
+ ];
27
+ function asOptionalNumber(value) {
28
+ if (value === undefined)
29
+ return undefined;
30
+ if (value === null)
31
+ return null;
32
+ return typeof value === 'number' && Number.isFinite(value) ? value : null;
33
+ }
34
+ function asOptionalString(value) {
35
+ if (value === undefined)
36
+ return undefined;
37
+ if (value === null)
38
+ return null;
39
+ return typeof value === 'string' ? value : null;
40
+ }
41
+ function asOptionalStringArray(value) {
42
+ if (value === undefined)
43
+ return undefined;
44
+ if (value === null)
45
+ return null;
46
+ if (!Array.isArray(value))
47
+ return null;
48
+ return value.filter((x) => typeof x === 'string');
49
+ }
50
+ /**
51
+ * 从 Nest snapshot query 单行裁剪出 K 线网格必要字段。
52
+ * 无有效 `code` 的行丢弃。
53
+ */
54
+ export function pickSnapshotPoolItem(row) {
55
+ if (!row || typeof row !== 'object')
56
+ return null;
57
+ const raw = row;
58
+ const code = typeof raw.code === 'string' ? raw.code.trim() : '';
59
+ if (!code)
60
+ return null;
61
+ const item = { code };
62
+ item.name = asOptionalString(raw.name);
63
+ item.floatMarketCapYuan = asOptionalNumber(raw.floatMarketCapYuan);
64
+ item.fundHoldingsCount = asOptionalNumber(raw.fundHoldingsCount);
65
+ item.financingBalanceYuan = asOptionalNumber(raw.financingBalanceYuan);
66
+ item.price = asOptionalNumber(raw.price);
67
+ item.changePercent = asOptionalNumber(raw.changePercent);
68
+ item.klineTurnover = asOptionalNumber(raw.klineTurnover);
69
+ item.amount = asOptionalNumber(raw.amount);
70
+ item.bullBarDate = asOptionalString(raw.bullBarDate);
71
+ item.dayReturn20d = asOptionalNumber(raw.dayReturn20d);
72
+ item.dayReturn40d = asOptionalNumber(raw.dayReturn40d);
73
+ item.dayReturn60d = asOptionalNumber(raw.dayReturn60d);
74
+ item.weekReturn26w = asOptionalNumber(raw.weekReturn26w);
75
+ item.boxAmplitudePct = asOptionalNumber(raw.boxAmplitudePct);
76
+ item.jiuyanActDate = asOptionalString(raw.jiuyanActDate);
77
+ item.jiuyanFieldName = asOptionalString(raw.jiuyanFieldName);
78
+ item.jiuyanLimitUpTotalDays = asOptionalNumber(raw.jiuyanLimitUpTotalDays);
79
+ item.jiuyanLimitUpDuringDays = asOptionalNumber(raw.jiuyanLimitUpDuringDays);
80
+ item.jiuyanConsecutiveLimitUpDays = asOptionalNumber(raw.jiuyanConsecutiveLimitUpDays);
81
+ item.jiuyanLimitUpTime = asOptionalString(raw.jiuyanLimitUpTime);
82
+ item.jiuyanBriefReason = asOptionalStringArray(raw.jiuyanBriefReason);
83
+ item.jiuyanDetailReason = asOptionalStringArray(raw.jiuyanDetailReason);
84
+ item.jiuyanThemeRank = asOptionalNumber(raw.jiuyanThemeRank);
85
+ // Touch keys list so refactors keep pick in sync with SnapshotPoolItem.
86
+ void POOL_ITEM_KEYS;
87
+ return item;
88
+ }
89
+ export function pickSnapshotPoolItems(rows) {
90
+ const out = [];
91
+ for (const row of rows) {
92
+ const item = pickSnapshotPoolItem(row);
93
+ if (item)
94
+ out.push(item);
95
+ }
96
+ return out;
97
+ }
98
+ /**
99
+ * 按 `code`(大写)去重合并;后写覆盖前写。
100
+ */
101
+ export function mergeSnapshotPoolByCode(...lists) {
102
+ const byCode = new Map();
103
+ for (const list of lists) {
104
+ for (const row of list) {
105
+ const key = row.code.toUpperCase();
106
+ byCode.set(key, row);
107
+ }
108
+ }
109
+ return [...byCode.values()];
110
+ }
@@ -0,0 +1,68 @@
1
+ import type { SnapshotPoolQueryPaging } from '../types/snapshot-pool.js';
2
+ /**
3
+ * 小市值找趋势票 A1:流通市值 ≤ 300 亿,`dayReturn20d ≥ 30`,无基金持股门槛。
4
+ * 见 `docs/两个趋势票curl.md`。
5
+ */
6
+ export declare function buildSmallCapTrendA1Body(paging?: SnapshotPoolQueryPaging): {
7
+ filters: Record<string, unknown>;
8
+ sort: {
9
+ field: string;
10
+ order: "desc";
11
+ };
12
+ page: number;
13
+ pageSize: number;
14
+ };
15
+ /**
16
+ * 小市值找趋势票 A2:流通市值 ≤ 300 亿,`fundHoldingsCount ≥ 3`,`dayReturn20d ≥ 25`。
17
+ */
18
+ export declare function buildSmallCapTrendA2Body(paging?: SnapshotPoolQueryPaging): {
19
+ filters: Record<string, unknown>;
20
+ sort: {
21
+ field: string;
22
+ order: "desc";
23
+ };
24
+ page: number;
25
+ pageSize: number;
26
+ };
27
+ /**
28
+ * 近 30 自然日涨停活跃池 B:`jiuyanActDate` lastNDays=30,涨停总天数 ≥ 5,
29
+ * boards = 沪主板 / 创业板 / 深主板。
30
+ */
31
+ export declare function buildLimitUp30dBody(paging?: SnapshotPoolQueryPaging): {
32
+ filters: Record<string, unknown>;
33
+ sort: {
34
+ field: string;
35
+ order: "desc";
36
+ };
37
+ page: number;
38
+ pageSize: number;
39
+ };
40
+ /**
41
+ * 池 C:大市值趋势(市值 ≥ 500 亿,哪个涨的好)。
42
+ * 流通市值 ≥ 500 亿;基金持股 ≥ 40;60 日收益 ≥ 20;40 日收益 ≤ 100;
43
+ * boards = 沪主板 / 深主板。
44
+ */
45
+ export declare function buildLargeCapTrendBody(paging?: SnapshotPoolQueryPaging): {
46
+ filters: Record<string, unknown>;
47
+ sort: {
48
+ field: string;
49
+ order: "desc";
50
+ };
51
+ page: number;
52
+ pageSize: number;
53
+ };
54
+ /**
55
+ * 池 D:大市值涨停观察(流通市值 ≥ 300 亿,韭研异动日近 3 自然日)。
56
+ * boards = 沪主板 / 深主板 / 创业板。
57
+ * 注:curl 未写 `jiuyanLimitUpTotalDays.min`;近 3 日异动日即观察窗口。
58
+ */
59
+ export declare function buildLargeCapLimitUp3dBody(paging?: SnapshotPoolQueryPaging): {
60
+ filters: Record<string, unknown>;
61
+ sort: {
62
+ field: string;
63
+ order: "desc";
64
+ };
65
+ page: number;
66
+ pageSize: number;
67
+ };
68
+ //# sourceMappingURL=query-bodies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bodies.d.ts","sourceRoot":"","sources":["../../src/pool/query-bodies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAuDxE;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,uBAAuB;aAjB9D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;UAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;UAChC,MAAM;cACF,MAAM;EA8BjB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,uBAAuB;aAtC9D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;UAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;UAChC,MAAM;cACF,MAAM;EAoDjB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,uBAAuB;aA7DzD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;UAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;UAChC,MAAM;cACF,MAAM;EAuEjB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,uBAAuB;aAjF5D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;UAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;UAChC,MAAM;cACF,MAAM;EA6FjB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,uBAAuB;aAvGhE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;UAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;UAChC,MAAM;cACF,MAAM;EAiHjB"}
@@ -0,0 +1,121 @@
1
+ /** Shared empty-ish filter defaults matching stock-app snapshot query UI payloads. */
2
+ function baseFilters(extra) {
3
+ return {
4
+ signalNames: [],
5
+ jiuyanFieldNames: [],
6
+ jiuyanThemeMatchQuery: '',
7
+ jiuyanThemeRankMax: null,
8
+ onlyWithSignals: false,
9
+ changePercentMin: null,
10
+ changePercentMax: null,
11
+ amountMin: null,
12
+ amountMax: null,
13
+ klineTurnoverMin: null,
14
+ klineTurnoverMax: null,
15
+ bullConfirmed: false,
16
+ acquisitionOpenIn20Td: false,
17
+ reorganizationIn20Td: false,
18
+ stRemovalIn20Td: false,
19
+ stRemovalIn60Td: false,
20
+ earningsGrowthIn20Td: false,
21
+ earningsGrowthIn60Td: false,
22
+ detailDateInLast10Td: false,
23
+ minBoxWin: null,
24
+ ranges: extra.ranges ?? {},
25
+ dateRanges: extra.dateRanges ?? {},
26
+ ...(extra.boards ? { boards: extra.boards } : {}),
27
+ };
28
+ }
29
+ function withPaging(filters, paging) {
30
+ return {
31
+ filters,
32
+ sort: { field: 'jiuyanActDate', order: 'desc' },
33
+ page: paging?.page ?? 0,
34
+ pageSize: paging?.pageSize ?? 100,
35
+ };
36
+ }
37
+ /**
38
+ * 小市值找趋势票 A1:流通市值 ≤ 300 亿,`dayReturn20d ≥ 30`,无基金持股门槛。
39
+ * 见 `docs/两个趋势票curl.md`。
40
+ */
41
+ export function buildSmallCapTrendA1Body(paging) {
42
+ return withPaging(baseFilters({
43
+ ranges: {
44
+ weekReturn6w: { min: null, max: null },
45
+ weekReturn26w: { min: null, max: 180 },
46
+ dayReturn60d: { min: 25, max: 140 },
47
+ boxAmplitudePct: { min: null, max: 150 },
48
+ floatMarketCapYuan: { min: null, max: 30_000_000_000 },
49
+ jiuyanLimitUpDuringDays: { min: null, max: null },
50
+ dayReturn20d: { min: 30, max: null },
51
+ jiuyanLimitUpTotalDays: { min: 2, max: null },
52
+ },
53
+ }), paging);
54
+ }
55
+ /**
56
+ * 小市值找趋势票 A2:流通市值 ≤ 300 亿,`fundHoldingsCount ≥ 3`,`dayReturn20d ≥ 25`。
57
+ */
58
+ export function buildSmallCapTrendA2Body(paging) {
59
+ return withPaging(baseFilters({
60
+ ranges: {
61
+ weekReturn6w: { min: null, max: null },
62
+ weekReturn26w: { min: null, max: 180 },
63
+ dayReturn60d: { min: 25, max: 140 },
64
+ boxAmplitudePct: { min: null, max: 150 },
65
+ floatMarketCapYuan: { min: null, max: 30_000_000_000 },
66
+ fundHoldingsCount: { min: 3, max: null },
67
+ jiuyanLimitUpDuringDays: { min: null, max: null },
68
+ dayReturn20d: { min: 25, max: null },
69
+ jiuyanLimitUpTotalDays: { min: 2, max: null },
70
+ },
71
+ }), paging);
72
+ }
73
+ /**
74
+ * 近 30 自然日涨停活跃池 B:`jiuyanActDate` lastNDays=30,涨停总天数 ≥ 5,
75
+ * boards = 沪主板 / 创业板 / 深主板。
76
+ */
77
+ export function buildLimitUp30dBody(paging) {
78
+ return withPaging(baseFilters({
79
+ ranges: {
80
+ jiuyanLimitUpTotalDays: { min: 5, max: null },
81
+ },
82
+ dateRanges: {
83
+ jiuyanActDate: { from: null, to: null, lastNDays: 30 },
84
+ },
85
+ boards: ['hz_zb', 'cyb', 'sz_zb'],
86
+ }), paging);
87
+ }
88
+ /**
89
+ * 池 C:大市值趋势(市值 ≥ 500 亿,哪个涨的好)。
90
+ * 流通市值 ≥ 500 亿;基金持股 ≥ 40;60 日收益 ≥ 20;40 日收益 ≤ 100;
91
+ * boards = 沪主板 / 深主板。
92
+ */
93
+ export function buildLargeCapTrendBody(paging) {
94
+ return withPaging(baseFilters({
95
+ ranges: {
96
+ jiuyanLimitUpTotalDays: { min: null, max: null },
97
+ floatMarketCapYuan: { min: 50_000_000_000, max: null },
98
+ dayReturn40d: { min: null, max: 100 },
99
+ dayReturn60d: { min: 20, max: null },
100
+ dayReturn10d: { min: null, max: null },
101
+ fundHoldingsCount: { min: 40, max: null },
102
+ },
103
+ boards: ['hz_zb', 'sz_zb'],
104
+ }), paging);
105
+ }
106
+ /**
107
+ * 池 D:大市值涨停观察(流通市值 ≥ 300 亿,韭研异动日近 3 自然日)。
108
+ * boards = 沪主板 / 深主板 / 创业板。
109
+ * 注:curl 未写 `jiuyanLimitUpTotalDays.min`;近 3 日异动日即观察窗口。
110
+ */
111
+ export function buildLargeCapLimitUp3dBody(paging) {
112
+ return withPaging(baseFilters({
113
+ ranges: {
114
+ floatMarketCapYuan: { min: 30_000_000_000, max: null },
115
+ },
116
+ dateRanges: {
117
+ jiuyanActDate: { from: null, to: null, lastNDays: 3 },
118
+ },
119
+ boards: ['hz_zb', 'sz_zb', 'cyb'],
120
+ }), paging);
121
+ }
@@ -0,0 +1,8 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { SnapshotPoolQueryPaging, SnapshotPoolResult } from '../types/snapshot-pool.js';
3
+ /**
4
+ * 池 A:小市值找趋势股。
5
+ * 并行请求 A1 + A2,按 `code` 去重合并(A2 覆盖 A1),裁剪为网格必要字段。
6
+ */
7
+ export declare function fetchSmallCapTrendPool(http: HttpClient, paging?: SnapshotPoolQueryPaging): Promise<SnapshotPoolResult>;
8
+ //# sourceMappingURL=small-cap-trend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"small-cap-trend.d.ts","sourceRoot":"","sources":["../../src/pool/small-cap-trend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAQlC;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAsB7B"}
@@ -0,0 +1,27 @@
1
+ import { buildSmallCapTrendA1Body, buildSmallCapTrendA2Body, } from './query-bodies.js';
2
+ import { mergeSnapshotPoolByCode, pickSnapshotPoolItems } from './pick-and-merge.js';
3
+ import { postSnapshotQuery } from './snapshot-query.js';
4
+ /**
5
+ * 池 A:小市值找趋势股。
6
+ * 并行请求 A1 + A2,按 `code` 去重合并(A2 覆盖 A1),裁剪为网格必要字段。
7
+ */
8
+ export async function fetchSmallCapTrendPool(http, paging) {
9
+ const [a1, a2] = await Promise.all([
10
+ postSnapshotQuery(http, buildSmallCapTrendA1Body(paging)),
11
+ postSnapshotQuery(http, buildSmallCapTrendA2Body(paging)),
12
+ ]);
13
+ const a1Items = pickSnapshotPoolItems(a1.items);
14
+ const a2Items = pickSnapshotPoolItems(a2.items);
15
+ const items = mergeSnapshotPoolByCode(a1Items, a2Items);
16
+ return {
17
+ items,
18
+ sourceTotals: {
19
+ a1: a1.total,
20
+ a2: a2.total,
21
+ merged: items.length,
22
+ },
23
+ dataVersion: a2.dataVersion ?? a1.dataVersion,
24
+ stale: a1.stale === true || a2.stale === true,
25
+ recentTradingDays10: a2.recentTradingDays10 ?? a1.recentTradingDays10 ?? null,
26
+ };
27
+ }
@@ -0,0 +1,5 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { SnapshotQueryResponse } from '../types/snapshot-pool.js';
3
+ export declare const SNAPSHOT_QUERY_PATH = "/stocks/snapshot/query";
4
+ export declare function postSnapshotQuery(http: HttpClient, body: unknown): Promise<SnapshotQueryResponse>;
5
+ //# sourceMappingURL=snapshot-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-query.d.ts","sourceRoot":"","sources":["../../src/pool/snapshot-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEtE,eAAO,MAAM,mBAAmB,2BAA2B,CAAA;AAE3D,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,qBAAqB,CAAC,CAahC"}
@@ -0,0 +1,15 @@
1
+ export const SNAPSHOT_QUERY_PATH = '/stocks/snapshot/query';
2
+ export async function postSnapshotQuery(http, body) {
3
+ const data = await http.postJson(SNAPSHOT_QUERY_PATH, body);
4
+ return {
5
+ items: Array.isArray(data.items) ? data.items : [],
6
+ total: typeof data.total === 'number' ? data.total : 0,
7
+ page: typeof data.page === 'number' ? data.page : 0,
8
+ pageSize: typeof data.pageSize === 'number' ? data.pageSize : 0,
9
+ ...(data.dataVersion !== undefined ? { dataVersion: data.dataVersion } : {}),
10
+ ...(data.stale !== undefined ? { stale: data.stale } : {}),
11
+ ...(data.recentTradingDays10 !== undefined
12
+ ? { recentTradingDays10: data.recentTradingDays10 }
13
+ : {}),
14
+ };
15
+ }
@@ -0,0 +1,67 @@
1
+ /** ≥7 连板高板主题日行(对应 /a-share-sentiment「高板主题」) */
2
+ export type Ge7BoardDayRow = {
3
+ tradeDate: string;
4
+ code: string;
5
+ name: string;
6
+ boards: number;
7
+ fieldName: string | null;
8
+ fieldReason?: string | null;
9
+ briefReason: string[];
10
+ detailReason?: string[];
11
+ };
12
+ export type Ge7BoardDayRowsJson = {
13
+ rows: Ge7BoardDayRow[];
14
+ sourceOk: boolean;
15
+ generatedAt?: string;
16
+ dateFrom?: string;
17
+ dateTo?: string;
18
+ };
19
+ export type JiuyanLimitUpLadderStock = {
20
+ code: string;
21
+ name: string;
22
+ boards: number;
23
+ fieldName: string | null;
24
+ priceYuan: number | null;
25
+ capYi: number | null;
26
+ changePct?: number | null;
27
+ fundHoldingsCount?: number | null;
28
+ limitUpTotalDays?: number | null;
29
+ briefReason?: string[] | null;
30
+ detailReason?: string[] | null;
31
+ };
32
+ export type JiuyanLimitUpLadderTier = {
33
+ yesterdayBoards: number;
34
+ todayBoards: number;
35
+ yesterday: JiuyanLimitUpLadderStock[];
36
+ today: JiuyanLimitUpLadderStock[];
37
+ promotedCodes: string[];
38
+ broken: JiuyanLimitUpLadderStock[];
39
+ };
40
+ export type JiuyanLimitUpLadderFirstToSecond = {
41
+ yesterdayFirst: JiuyanLimitUpLadderStock[];
42
+ todaySecond: JiuyanLimitUpLadderStock[];
43
+ promotedCodes: string[];
44
+ broken: JiuyanLimitUpLadderStock[];
45
+ };
46
+ /** 涨停快照(今/昨对比) */
47
+ export type JiuyanLimitUpLadderTodayYesterday = {
48
+ today: string;
49
+ prev: string;
50
+ tiers: JiuyanLimitUpLadderTier[];
51
+ firstToSecond: JiuyanLimitUpLadderFirstToSecond;
52
+ todayFirst?: JiuyanLimitUpLadderStock[];
53
+ };
54
+ /** 多日对比 */
55
+ export type JiuyanLimitUpLadderMultiDay = {
56
+ trading_days: string[];
57
+ max_days: number;
58
+ cells: Record<string, Record<string, JiuyanLimitUpLadderStock[]>>;
59
+ };
60
+ export type JiuyanLimitUpLadderJson = {
61
+ schema_version: string;
62
+ generated_at: string;
63
+ dates_available: string[];
64
+ multi_day: JiuyanLimitUpLadderMultiDay | null;
65
+ today_yesterday: JiuyanLimitUpLadderTodayYesterday | null;
66
+ };
67
+ //# sourceMappingURL=board.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/types/board.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,wBAAwB,EAAE,CAAA;IACrC,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,EAAE,wBAAwB,EAAE,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,wBAAwB,EAAE,CAAA;IAC1C,WAAW,EAAE,wBAAwB,EAAE,CAAA;IACvC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,EAAE,wBAAwB,EAAE,CAAA;CACnC,CAAA;AAED,kBAAkB;AAClB,MAAM,MAAM,iCAAiC,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,uBAAuB,EAAE,CAAA;IAChC,aAAa,EAAE,gCAAgC,CAAA;IAC/C,UAAU,CAAC,EAAE,wBAAwB,EAAE,CAAA;CACxC,CAAA;AAED,WAAW;AACX,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAA;CAClE,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,SAAS,EAAE,2BAA2B,GAAG,IAAI,CAAA;IAC7C,eAAe,EAAE,iCAAiC,GAAG,IAAI,CAAA;CAC1D,CAAA"}
@@ -0,0 +1 @@
1
+ export {};