@8btc/finance-assistant-mcp 0.0.28 → 0.0.29

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 (2) hide show
  1. package/dist/index.cjs +163 -69
  2. package/package.json +3 -2
package/dist/index.cjs CHANGED
@@ -663,67 +663,46 @@ function Chapter3$2({
663
663
  ] })
664
664
  ] });
665
665
  }
666
- function Chapter4$2({ data }) {
667
- const sentiment = react.useMemo(() => {
668
- switch (data.report_type) {
669
- case "industry":
670
- return data.industry_sentiment;
671
- case "market":
672
- return data.market_sentiment;
673
- case "stock":
674
- return data.stock_sentiment;
666
+ function Chapter4Sector({ data }) {
667
+ const d = react.useMemo(() => {
668
+ if (data.report_type === "market") {
669
+ return data.market;
675
670
  }
676
- }, [data]);
677
- const sentimentValue = sentiment?.value || 0;
678
- const normalized = sentimentValue / 100;
679
- const slideWidth = normalized * 400;
680
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chapterPage", children: [
681
- /* @__PURE__ */ jsxRuntime.jsx(SectionHeader, { index: 4, title: "情绪钟摆与板块轮动逻辑" }),
682
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "section-sub-header", children: "4.1 市场情绪指数" }),
683
- /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "table space-y-1", children: [
684
- /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
685
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "指数读数:" }),
686
- sentimentValue
687
- ] }),
688
- /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
689
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "一句话解释:" }),
690
- sentiment?.comment
691
- ] })
692
- ] }),
693
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[400px] mx-auto relative", children: [
694
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[400px] rounded-full h-1.5 bg-[#F5F5F5] absolute", children: /* @__PURE__ */ jsxRuntime.jsx(
695
- "div",
696
- {
697
- className: cn("bg-black h-1.5 relative rounded-full"),
698
- style: {
699
- width: `${slideWidth}px`
700
- },
701
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute w-4 h-4 border border-[#171717] rounded-full right-0 -translate-y-[5px] translate-x-1/2 bg-white" })
671
+ if (data.report_type === "industry") {
672
+ const temp = data.industry;
673
+ return {
674
+ industry_impact: {
675
+ bullish_industries: temp.subsector_impact.bullish_subsectors.map(
676
+ (it) => {
677
+ return {
678
+ sector: it.subsector,
679
+ score: it.score,
680
+ reason: it.reason
681
+ };
682
+ }
683
+ ),
684
+ bearish_industries: temp.subsector_impact.bearish_subsectors.map(
685
+ (it) => {
686
+ return {
687
+ sector: it.subsector,
688
+ score: it.score,
689
+ reason: it.reason
690
+ };
691
+ }
692
+ )
702
693
  }
703
- ) }),
704
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between font-bold", children: [
705
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center my-3 -translate-x-4", children: [
706
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "-1" }),
707
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "悲观" })
708
- ] }),
709
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center my-3", children: [
710
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "0" }),
711
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "中性" })
712
- ] }),
713
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center my-3 translate-x-4", children: [
714
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "1" }),
715
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "乐观" })
716
- ] })
717
- ] })
718
- ] }) }),
719
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "section-sub-header", children: "4.2 利好利空行业分析" }),
694
+ };
695
+ }
696
+ return data.market;
697
+ }, [data]);
698
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
720
699
  /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "table-fixed text-left border-b w-full", children: [
721
700
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "border-t border-b h-[40px]", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
722
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-1/2 px-2 font-bold", children: "股票" }),
701
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-1/2 px-2 font-bold", children: "板块" }),
723
702
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-1/2 px-2 font-bold", children: "利空利好" })
724
703
  ] }) }),
725
704
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
726
- data.market.industry_impact.bullish_industries.map((it, index) => {
705
+ d.industry_impact.bullish_industries.map((it, index) => {
727
706
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "h-[40px]", children: [
728
707
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: it.sector }),
729
708
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: Array(it.score).fill(void 0).map((itt, index2) => {
@@ -731,7 +710,7 @@ function Chapter4$2({ data }) {
731
710
  }) })
732
711
  ] }, index);
733
712
  }),
734
- data.market.industry_impact.bearish_industries.map((it, index) => {
713
+ d.industry_impact.bearish_industries.map((it, index) => {
735
714
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "h-[40px]", children: [
736
715
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: it.sector }),
737
716
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: Array(Math.abs(it.score)).fill(void 0).map((itt, index2) => {
@@ -742,7 +721,7 @@ function Chapter4$2({ data }) {
742
721
  ] })
743
722
  ] }),
744
723
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-bold", children: "利好行业" }),
745
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "table space-y-2", children: data.market.industry_impact.bullish_industries.map((it, index) => {
724
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "table space-y-2", children: d.industry_impact.bullish_industries.map((it, index) => {
746
725
  return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
747
726
  /* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
748
727
  it.sector,
@@ -759,7 +738,7 @@ function Chapter4$2({ data }) {
759
738
  ] }, index);
760
739
  }) }),
761
740
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-bold", children: "利空行业" }),
762
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "table space-y-2", children: data.market.industry_impact.bearish_industries.map((it, index) => {
741
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "table space-y-2", children: d.industry_impact.bearish_industries.map((it, index) => {
763
742
  return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
764
743
  /* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
765
744
  it.sector,
@@ -777,7 +756,87 @@ function Chapter4$2({ data }) {
777
756
  }) })
778
757
  ] });
779
758
  }
759
+ function Chapter4$2({ data }) {
760
+ const sentiment = react.useMemo(() => {
761
+ switch (data.report_type) {
762
+ case "industry":
763
+ return data.industry_sentiment;
764
+ case "market":
765
+ return data.market_sentiment;
766
+ case "stock":
767
+ return data.stock_sentiment;
768
+ }
769
+ }, [data]);
770
+ const sentimentValue = sentiment?.value || 0;
771
+ const normalized = sentimentValue / 100;
772
+ const slideWidth = normalized * 400;
773
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chapterPage", children: [
774
+ /* @__PURE__ */ jsxRuntime.jsx(SectionHeader, { index: 4, title: "情绪钟摆与板块轮动逻辑" }),
775
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "section-sub-header", children: "4.1 市场情绪指数" }),
776
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "table space-y-1", children: [
777
+ /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
778
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "指数读数:" }),
779
+ sentimentValue
780
+ ] }),
781
+ /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
782
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "一句话解释:" }),
783
+ sentiment?.comment
784
+ ] })
785
+ ] }),
786
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[400px] mx-auto relative", children: [
787
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[400px] rounded-full h-1.5 bg-[#F5F5F5] absolute", children: /* @__PURE__ */ jsxRuntime.jsx(
788
+ "div",
789
+ {
790
+ className: cn("bg-black h-1.5 relative rounded-full"),
791
+ style: {
792
+ width: `${slideWidth}px`
793
+ },
794
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute w-4 h-4 border border-[#171717] rounded-full right-0 -translate-y-[5px] translate-x-1/2 bg-white" })
795
+ }
796
+ ) }),
797
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between font-bold", children: [
798
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center my-3 -translate-x-4", children: [
799
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "-1" }),
800
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "悲观" })
801
+ ] }),
802
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center my-3", children: [
803
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "0" }),
804
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "中性" })
805
+ ] }),
806
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center my-3 translate-x-4", children: [
807
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "1" }),
808
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "乐观" })
809
+ ] })
810
+ ] })
811
+ ] }) }),
812
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "section-sub-header", children: "4.2 利好利空行业分析" }),
813
+ /* @__PURE__ */ jsxRuntime.jsx(Chapter4Sector, { data })
814
+ ] });
815
+ }
780
816
  function Chapter5$2({ data }) {
817
+ const d = react.useMemo(() => {
818
+ if (data.report_type === "industry") {
819
+ const dd = data.industry.industry_asset_linkage;
820
+ return {
821
+ a_share: {
822
+ reason: dd.a_share.reason,
823
+ impact: dd.a_share.impact,
824
+ performance: dd.a_share.industry_performance
825
+ },
826
+ hk_share: {
827
+ reason: dd.hk_share.reason,
828
+ impact: dd.hk_share.impact,
829
+ performance: dd.hk_share.industry_performance
830
+ },
831
+ us_share: {
832
+ reason: dd.us_share.reason,
833
+ impact: dd.us_share.impact,
834
+ performance: dd.us_share.industry_performance
835
+ }
836
+ };
837
+ }
838
+ return data.market.asset_class_impact;
839
+ }, [data]);
781
840
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chapterPage", children: [
782
841
  /* @__PURE__ */ jsxRuntime.jsx(SectionHeader, { index: 5, title: "跨市场资产配置视角" }),
783
842
  /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "table-fixed text-left border-b w-full", children: [
@@ -787,9 +846,9 @@ function Chapter5$2({ data }) {
787
846
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-1/3 px-2 font-bold", children: "美股" })
788
847
  ] }) }),
789
848
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "h-[40px]", children: [
790
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: data.market.asset_class_impact.a_share.performance }),
791
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: data.market.asset_class_impact.hk_share.performance }),
792
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: data.market.asset_class_impact.us_share.performance })
849
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: d.a_share.performance }),
850
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: d.hk_share.performance }),
851
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2", children: d.us_share.performance })
793
852
  ] }) })
794
853
  ] }),
795
854
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
@@ -797,15 +856,15 @@ function Chapter5$2({ data }) {
797
856
  /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "table", children: [
798
857
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
799
858
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "表现:" }),
800
- data.market.asset_class_impact.a_share.performance
859
+ d.a_share.performance
801
860
  ] }),
802
861
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
803
862
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "策略:" }),
804
- data.market.asset_class_impact.a_share.impact
863
+ d.a_share.impact
805
864
  ] }),
806
865
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
807
866
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "逻辑:" }),
808
- data.market.asset_class_impact.a_share.reason
867
+ d.a_share.reason
809
868
  ] })
810
869
  ] })
811
870
  ] }),
@@ -814,15 +873,15 @@ function Chapter5$2({ data }) {
814
873
  /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "table", children: [
815
874
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
816
875
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "表现:" }),
817
- data.market.asset_class_impact.hk_share.performance
876
+ d.hk_share.performance
818
877
  ] }),
819
878
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
820
879
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "策略:" }),
821
- data.market.asset_class_impact.hk_share.impact
880
+ d.hk_share.impact
822
881
  ] }),
823
882
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
824
883
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "逻辑:" }),
825
- data.market.asset_class_impact.hk_share.reason
884
+ d.hk_share.reason
826
885
  ] })
827
886
  ] })
828
887
  ] }),
@@ -831,15 +890,15 @@ function Chapter5$2({ data }) {
831
890
  /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "table", children: [
832
891
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
833
892
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "表现:" }),
834
- data.market.asset_class_impact.us_share.performance
893
+ d.us_share.performance
835
894
  ] }),
836
895
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
837
896
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "策略:" }),
838
- data.market.asset_class_impact.us_share.impact
897
+ d.us_share.impact
839
898
  ] }),
840
899
  /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
841
900
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "逻辑:" }),
842
- data.market.asset_class_impact.us_share.reason
901
+ d.us_share.reason
843
902
  ] })
844
903
  ] })
845
904
  ] })
@@ -1354,6 +1413,41 @@ const newsSchema = {
1354
1413
  })
1355
1414
  })
1356
1415
  }),
1416
+ industry: zod.z.object({
1417
+ subsector_impact: zod.z.object({
1418
+ bullish_subsectors: zod.z.array(
1419
+ zod.z.object({
1420
+ subsector: zod.z.string(),
1421
+ score: zod.z.number(),
1422
+ reason: zod.z.string()
1423
+ })
1424
+ ),
1425
+ bearish_subsectors: zod.z.array(
1426
+ zod.z.object({
1427
+ subsector: zod.z.string(),
1428
+ score: zod.z.number(),
1429
+ reason: zod.z.string()
1430
+ })
1431
+ )
1432
+ }),
1433
+ industry_asset_linkage: zod.z.object({
1434
+ a_share: zod.z.object({
1435
+ impact: zod.z.string(),
1436
+ industry_performance: zod.z.string(),
1437
+ reason: zod.z.string()
1438
+ }),
1439
+ hk_share: zod.z.object({
1440
+ impact: zod.z.string(),
1441
+ industry_performance: zod.z.string(),
1442
+ reason: zod.z.string()
1443
+ }),
1444
+ us_share: zod.z.object({
1445
+ impact: zod.z.string(),
1446
+ industry_performance: zod.z.string(),
1447
+ reason: zod.z.string()
1448
+ })
1449
+ })
1450
+ }),
1357
1451
  professional_insights: zod.z.array(
1358
1452
  zod.z.object({
1359
1453
  message: zod.z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@8btc/finance-assistant-mcp",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "财经agent辅助mcp工具",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
@@ -16,7 +16,8 @@
16
16
  "test:html": "npm run build && node ./test/test-gen-html.cjs && open ./report.html",
17
17
  "test:tech-indicator": "npm run build && node test/test-gen-pdf.cjs",
18
18
  "test:portfolio": "npm run build && node test/test-portfolio.cjs",
19
- "test:news": "npm run build && node test/test-financial-news.cjs"
19
+ "test:news": "npm run build && node test/test-financial-news.cjs",
20
+ "test:news:industry": "npm run build && node test/test-financial-news-industry.cjs"
20
21
  },
21
22
  "keywords": [
22
23
  "mcp",