{"id":3100,"date":"2025-12-02T07:31:00","date_gmt":"2025-12-01T23:31:00","guid":{"rendered":"https:\/\/www.laoyulaoyu.com\/?p=3100"},"modified":"2025-11-24T12:32:14","modified_gmt":"2025-11-24T04:32:14","slug":"%e6%95%a3%e6%88%b7%e8%bf%98%e5%9c%a8%e7%9c%8bk%e7%ba%bf%ef%bc%8c%e4%b8%bb%e5%8a%9b%e5%b7%b2%e7%bb%8f%e7%94%a8dna%e6%8a%80%e6%9c%af%e9%87%8d%e7%bb%84%e4%ba%86%e8%82%a1%e5%b8%82","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2025\/12\/02\/%e6%95%a3%e6%88%b7%e8%bf%98%e5%9c%a8%e7%9c%8bk%e7%ba%bf%ef%bc%8c%e4%b8%bb%e5%8a%9b%e5%b7%b2%e7%bb%8f%e7%94%a8dna%e6%8a%80%e6%9c%af%e9%87%8d%e7%bb%84%e4%ba%86%e8%82%a1%e5%b8%82\/","title":{"rendered":"\u6563\u6237\u8fd8\u5728\u770bK\u7ebf\uff0c\u4e3b\u529b\u5df2\u7ecf\u7528\u201cDNA\u6280\u672f\u201d\u91cd\u7ec4\u4e86\u80a1\u5e02\uff08\u9644\u6e90\u7801\uff09"},"content":{"rendered":"\n<p>\u4f5c\u8005\uff1a<a href=\"https:\/\/www.laoyulaoyu.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u8001\u4f59\u635e\u9c7c<\/a><\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"900\" height=\"383\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/62cacfea0f79bc50a4ac29e1e46f71f42d6ba8b8.webp\" alt=\"\" class=\"wp-image-3101\" srcset=\"https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/62cacfea0f79bc50a4ac29e1e46f71f42d6ba8b8.webp 900w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/62cacfea0f79bc50a4ac29e1e46f71f42d6ba8b8-300x128.webp 300w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/62cacfea0f79bc50a4ac29e1e46f71f42d6ba8b8-768x327.webp 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-verse\"><strong>\u5199\u5728\u524d\u9762\u7684\u8bdd\uff1a<\/strong>\u5f88\u591a\u670b\u53cb\u89c9\u5f97\u4e70\u4e86\u4e0d\u540c\u884c\u4e1a\u7684\u80a1\u7968\u5c31\u662f\u5206\u6563\u98ce\u9669\uff0c\u7ed3\u679c\u5927\u8dcc\u65f6\u8fd8\u662f\u201c\u5168\u519b\u8986\u6ca1\u201d\u3002\u4eca\u5929\u6211\u4e0d\u8c08K\u7ebf\uff0c\u76f4\u63a5\u5e26\u4f60\u7528\u91cf\u5316\u7a0b\u5e8f\u505a\u4e00\u4e2a\u201c\u57fa\u672c\u9762+\u4ef7\u683c\u201d\u7684\u53cc\u91cd\u805a\u7c7b\u5206\u6790\u3002<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>\u8fd9\u62db\u80fd\u5e2e\u4f60\u4e00\u773c\u770b\u7a7f\u54ea\u4e9b\u80a1\u7968\u662f\u201c\u7a7f\u4e00\u6761\u88e4\u5b50\u201d\u7684\uff0c\u771f\u6b63\u505a\u5230\u79d1\u5b66\u907f\u9669<\/strong>\u3002<\/mark>\u4ee3\u7801\u5df2\u5347\u7ea7\u4e3a\u514d\u8d39\u6570\u636e\u6e90\u7248\u672c\uff0c\u76f4\u63a5\u6284\u4f5c\u4e1a\uff01<\/pre>\n<\/blockquote>\n\n\n\n<p>\u5404\u4f4d\u635e\u53cb\u4eec\uff0c\u5927\u5bb6\u597d\uff0c\u6211\u662f\u8001\u4f59\u3002<\/p>\n\n\n\n<p>\u6628\u665a\u6709\u4e2a\u7c89\u4e1d\u5728\u540e\u53f0\u54ed\u8bc9\uff1a\u201c\u6211\u7279\u610f\u4e70\u4e86\u79d1\u6280\u80a1\u3001\u6d88\u8d39\u80a1\u8fd8\u6709\u65b0\u80fd\u6e90\uff0c\u89c9\u5f97\u8fd9\u53eb\u2018\u5206\u6563\u6295\u8d44\u2019\uff0c\u7a33\u5982\u8001\u72d7\u3002\u7ed3\u679c\u4eca\u5929\u5927\u76d8\u4e00\u8dcc\uff0c\u600e\u4e48\u5b83\u4eec\u624b\u7275\u624b\u4e00\u8d77\u8df3\u6c34\uff1f\u8bf4\u597d\u7684\u5bf9\u51b2\u5462\uff1f\u201d<\/p>\n\n\n\n<p>\u542c\u5230\u8fd9\u513f\uff0c\u8001\u4f59\u6211\u521a\u559d\u8fdb\u5634\u91cc\u7684\u67b8\u675e\u8336\u5dee\u70b9\u55b7\u51fa\u6765\u3002\u5144\u5f1f\uff0c\u4f60\u4ee5\u4e3a\u4e70\u7684\u540d\u5b57\u4e0d\u4e00\u6837\u5c31\u662f\u5206\u6563\u6295\u8d44\u4e86\uff1f\u4f60\u90a3\u662f\u628a\u9e21\u86cb\u5206\u5f00\u653e\u8fdb\u4e86<strong>\u540c\u4e00\u4e2a\u5361\u8f66<\/strong>\u91cc\uff0c\u8f66\u7ffb\u4e86\uff0c\u86cb\u5168\u788e\u3002<\/p>\n\n\n\n<p>\u5728\u91d1\u878d\u5e02\u573a\u91cc\uff0c\u540d\u5b57\u4e0d\u91cd\u8981\uff0c<strong>\u201c\u8840\u7f18\u5173\u7cfb\u201d<\/strong>\u624d\u91cd\u8981\u3002\u5f88\u591a\u770b\u4f3c\u4e0d\u76f8\u5173\u7684\u80a1\u7968\uff0c\u5176\u5b9e\u80cc\u540e\u7684\u8d44\u91d1\u903b\u8f91\u662f\u4e00\u6a21\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<p>\u4eca\u5929\uff0c\u8001\u4f59\u5c31\u7ed3\u5408\u524d\u4e24\u5929\u5728\u56fd\u5916\u91cf\u5316\u5708\u5f88\u706b\u7684\u4e00\u7bc7\u6280\u672f\u8d34\uff0c\u4ee5\u53caGithub\u4e0a\u6700\u65b0\u7684\u7b56\u7565\u4ee3\u7801\uff0c\u5e26\u5927\u5bb6\u7528<strong>\u201c\u673a\u5668\u5b66\u4e60\u201d<\/strong>\u7684\u89c6\u89d2\uff0c\u6252\u4e00\u6252\u4f60\u624b\u91cc\u80a1\u7968\u7684\u771f\u5b9e\u5173\u7cfb\u3002\u6211\u4eec\u8981\u7528\u7684\u6280\u672f\uff0c\u53eb<strong>\u80a1\u7968\u805a\u7c7b\uff08Stock Clustering\uff09<\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>01 \u521d\u7ea7\u73a9\u6cd5\uff1a\u770b\u8c01\u8ddf\u8c01\u201c\u7a7f\u4e00\u6761\u88e4\u5b50\u201d<\/strong><\/h2>\n\n\n\n<p>\u6240\u8c13\u7684\u805a\u7c7b\uff0c\u8bf4\u4eba\u8bdd\u5c31\u662f<strong>\u201c\u7269\u4ee5\u7c7b\u805a\uff0c\u4eba\u4ee5\u7fa4\u5206\u201d<\/strong>\u3002<\/p>\n\n\n\n<p>\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u8d70\u8fdb\u4e00\u4e2a\u70ed\u95f9\u7684\u9152\u5427\u3002\u867d\u7136\u91cc\u9762\u6709\u51e0\u767e\u53f7\u4eba\uff0c\u4f46\u4f60\u4ed4\u7ec6\u4e00\u770b\uff0c\u5c31\u80fd\u5206\u51fa\u51e0\u4e2a\u5708\u5b50\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1024\" height=\"559\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/1.jpg\" alt=\"\" class=\"wp-image-3102\" srcset=\"https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/1.jpg 1024w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/1-300x164.jpg 300w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/1-768x419.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5708\u5b50A\uff1a<\/strong>\u00a0\u897f\u88c5\u9769\u5c65\uff0c\u559d\u7740\u5a01\u58eb\u5fcc\u804a\u4e0a\u5e02\uff08\u94f6\u884c\u91d1\u878d\u80a1\uff09\u3002<\/li>\n\n\n\n<li><strong>\u5708\u5b50B\uff1a<\/strong>\u00a0\u7a7f\u7740\u683c\u5b50\u886b\uff0c\u773c\u955c\u7247\u5f88\u539a\uff0c\u804a\u4ee3\u7801\uff08\u79d1\u6280\u80a1\uff09\u3002<\/li>\n\n\n\n<li><strong>\u5708\u5b50C\uff1a<\/strong>\u00a0\u62ff\u7740\u4fdd\u6e29\u676f\uff0c\u5728\u90a3\u513f\u804a\u517b\u751f\uff08\u533b\u836f\u6d88\u8d39\u80a1\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5728\u80a1\u5e02\u91cc\uff0c\u6211\u4eec\u770b\u4e24\u4e2a\u80a1\u7968\u662f\u4e0d\u662f\u201c\u4e00\u4f19\u7684\u201d\uff0c\u6700\u7b80\u5355\u7684\u529e\u6cd5\u5c31\u662f\u770b\u5b83\u4eec\u7684<strong>\u4ef7\u683c\u8d70\u52bf\uff08Price Action\uff09<\/strong>\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u80a1\u7968A\u6da8\uff0c\u80a1\u7968B\u4e5f\u6da8\uff1bA\u8dcc\uff0cB\u4e5f\u8dcc\uff0c\u90a3\u5b83\u4fe9\u5c31\u662f\u201c\u597d\u57fa\u53cb\u201d\uff0c\u76f8\u5173\u6027\u5f88\u9ad8\u3002\u5982\u679c\u4f60\u540c\u65f6\u91cd\u4ed3\u8fd9\u4e24\u4e2a\uff0c\u53ea\u8981\u6709\u70b9\u98ce\u5439\u8349\u52a8\uff0c\u4f60\u5c31\u7b49\u7740\u53cc\u500d\u9178\u723d\u5427\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"730\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u5178\u578b\u7684\u4ef7\u683c\u76f8\u5173\u6027\u70ed\u529b\u56fe-1024x730.jpg\" alt=\"\" class=\"wp-image-3103\" srcset=\"https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u5178\u578b\u7684\u4ef7\u683c\u76f8\u5173\u6027\u70ed\u529b\u56fe-1024x730.jpg 1024w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u5178\u578b\u7684\u4ef7\u683c\u76f8\u5173\u6027\u70ed\u529b\u56fe-300x214.jpg 300w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u5178\u578b\u7684\u4ef7\u683c\u76f8\u5173\u6027\u70ed\u529b\u56fe-768x547.jpg 768w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u5178\u578b\u7684\u4ef7\u683c\u76f8\u5173\u6027\u70ed\u529b\u56fe.jpg 1388w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">\u25b2 \u5178\u578b\u7684\u4ef7\u683c\u76f8\u5173\u6027\u70ed\u529b\u56fe\uff08\u6765\u6e90\uff1aDataDrivenInvestor\uff09<\/figcaption><\/figure>\n\n\n\n<p>\u770b\u4e0a\u56fe\uff0c\u7ea2\u8272\u7684\u533a\u57df\u5c31\u662f\u201c\u62b1\u56e2\u533a\u201d\u3002\u5982\u679c\u4f60\u624b\u91cc\u7684\u7968\u90fd\u96c6\u4e2d\u5728\u7ea2\u533a\uff0c\u90a3\u4f60\u5176\u5b9e\u53ea\u4e70\u4e86\u4e00\u53ea\u80a1\u7968\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>02 \u8fdb\u9636Pro\u7248\uff1a\u7ed9\u80a1\u7968\u505a\u201cCT\u626b\u63cf\u201d<\/strong><\/h2>\n\n\n\n<p>\u201c\u8001\u4f59\uff0c\u5149\u770b\u4ef7\u683c\u8d70\u52bf\u5c31\u591f\u4e86\u5417\uff1f\u201d<\/p>\n\n\n\n<p>\u95ee\u5f97\u597d\uff01\u8fd9\u5c31\u6d89\u53ca\u5230\u4e86\u91cf\u5316\u7684\u7b2c\u4e8c\u5c42\u601d\u7ef4\u3002\u6709\u65f6\u5019\uff0c\u5783\u573e\u80a1\u548c\u7ee9\u4f18\u80a1\u5728\u725b\u5e02\u91cc\u90fd\u6da8\uff0c\u8d70\u52bf\u5f88\u50cf\uff0c\u4f46\u672c\u8d28\u5b8c\u5168\u4e0d\u540c\u3002\u4e00\u65e6\u6f6e\u6c34\u9000\u53bb\uff0c\u4e00\u4e2a\u5728\u88f8\u6cf3\uff0c\u4e00\u4e2a\u5728\u6e38\u8247\u4e0a\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\uff0c\u6211\u4eec\u4e0d\u4ec5\u8981\u770b\u5b83<strong>\u201c\u600e\u4e48\u8d70\u201d<\/strong>\uff08\u4ef7\u683c\uff09\uff0c\u8fd8\u8981\u770b\u5b83<strong>\u201c\u8eab\u4f53\u597d\u4e0d\u597d\u201d<\/strong>\uff08\u57fa\u672c\u9762\uff09\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u8001\u4f59\u8981\u5f15\u5165\u4e00\u4e2a\u66f4\u9ad8\u7ea7\u7684\u6982\u5ff5\uff1a<strong>\u57fa\u672c\u9762+\u4ef7\u683c\u53cc\u91cd\u805a\u7c7b<\/strong>\u3002\u6211\u4eec\u8981\u628a\u4ee5\u4e0b\u6307\u6807\u6254\u8fdb\u7b97\u6cd5\u7684\u5927\u9505\u91cc\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5e02\u76c8\u7387 (PE)\uff1a<\/strong>\u00a0\u770b\u5b83\u8d35\u4e0d\u8d35\u3002<\/li>\n\n\n\n<li><strong>\u5e02\u503c (Market Cap)\uff1a<\/strong>\u00a0\u770b\u5b83\u76d8\u5b50\u5927\u4e0d\u5927\u3002<\/li>\n\n\n\n<li><strong>\u6ce2\u52a8\u7387 (Volatility)\uff1a<\/strong>\u00a0\u770b\u5b83\u813e\u6c14\u66b4\u4e0d\u66b4\u8e81\u3002<\/li>\n\n\n\n<li><strong>Beta\u7cfb\u6570\uff1a<\/strong>\u00a0\u770b\u5b83\u8ddf\u5927\u76d8\u7d27\u4e0d\u7d27\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u4f46\u662f\u95ee\u9898\u6765\u4e86\uff1a\u5e02\u76c8\u7387\u662f\u51e0\u5341\uff0c\u5e02\u503c\u662f\u51e0\u5343\u4ebf\uff0c\u6ce2\u52a8\u7387\u662f\u767e\u5206\u4e4b\u51e0\u3002\u8fd9\u4e9b\u5355\u4f4d\u90fd\u4e0d\u4e00\u6837\uff0c\u600e\u4e48\u6bd4\uff1f<\/p>\n\n\n\n<p>\u8fd9\u65f6\u5019\uff0c\u5c31\u8981\u796d\u51fa\u6211\u4eec\u7684\u795e\u5668\u2014\u2014<strong>PCA\uff08\u4e3b\u6210\u5206\u5206\u6790\uff09<\/strong>\u3002<\/p>\n\n\n\n<p>\u4f60\u5c31\u628a\u5b83\u60f3\u8c61\u6210\u4e00\u4e2a<strong>\u201c\u8d85\u7ea7\u69a8\u6c41\u673a\u201d<\/strong>\u3002\u4f60\u5f80\u91cc\u9762\u6254\u8fdb\u53bb\u82f9\u679c\uff08\u4ef7\u683c\uff09\u3001\u9999\u8549\uff08PE\uff09\u3001\u725b\u5976\uff08\u5e02\u503c\uff09\uff0c\u5b83\u5494\u5494\u4e00\u987f\u8f6c\uff0c\u628a\u8fd9\u4e9b\u4e71\u4e03\u516b\u7cdf\u7684\u6570\u636e\u201c\u964d\u7ef4\u6253\u51fb\u201d\uff0c\u6700\u540e\u5410\u51fa\u6765\u4e00\u676f\u7eaf\u51c0\u7684\u6df7\u5408\u679c\u6c41\u3002AI\u559d\u4e86\u8fd9\u676f\u679c\u6c41\uff0c\u5c31\u80fd\u7cbe\u51c6\u5730\u628a\u80a1\u7968\u5206\u6210\u4e09\u516d\u4e5d\u7b49\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>03 \u624b\u628a\u624b\u5b9e\u6218\uff1a3\u5206\u949f\u8dd1\u51fa\u4f60\u7684\u7b56\u7565<\/strong><\/h2>\n\n\n\n<p>\u5149\u8bf4\u4e0d\u7ec3\u5047\u628a\u5f0f\u3002\u8001\u4f59\u628aGithub\u4e0a\u7684\u4ed8\u8d39\u4ee3\u7801\uff0c\u6539\u5199\u6210\u4e86<strong>\u514d\u8d39\u7248\uff08\u57fa\u4e8eyfinance\uff09<\/strong>\u3002\u4e0d\u7ba1\u4f60\u662f\u7a0b\u5e8f\u5458\u8fd8\u662f\u91d1\u878d\u6c11\u5de5\uff0c\u590d\u5236\u7c98\u8d34\uff0c\u628a\u8fd9\u56fe\u8dd1\u51fa\u6765\uff0c\u53d1\u4e2a\u670b\u53cb\u5708\uff0c\u903c\u683c\u77ac\u95f4\u62c9\u6ee1\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7b2c\u4e00\u6b65\uff1a\u73af\u5883\u51c6\u5907\u4e0e\u6570\u636e\u4e0b\u8f7d<\/strong><\/h3>\n\n\n\n<p>\u6211\u4eec\u9009\u53d6\u7f8e\u80a1\u5e02\u573a\u4e0a\u6700\u5177\u4ee3\u8868\u6027\u7684\u51e0\u53ea\u7968\uff1a\u79d1\u6280\u5de8\u5934\u3001\u4f20\u7edf\u9632\u5b88\u80a1\u3001\u80fd\u6e90\u80a1\u548c\u94f6\u884c\u80a1\uff0c\u770b\u770bAI\u80fd\u4e0d\u80fd\u628a\u5b83\u4eec\u533a\u5206\u5f00\u3002<\/p>\n\n\n\n<p>Step 1: Get Data (Free Source)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import yfinance as yf\nimport pandas as pd\nimport numpy as np\n\n<em># 1. \u5b9a\u4e49\u80a1\u7968\u6c60\uff1a\u6211\u4eec\u6545\u610f\u9009\u51e0\u4e2a\u4e0d\u540c\u884c\u4e1a\u7684<\/em>\ntickers = &#91;\n    'AAPL', 'MSFT', 'NVDA', 'TSLA', 'GOOG',  <em># \u79d1\u6280\u75af\u72d7\u7ec4<\/em>\n    'KO', 'PEP', 'JNJ', 'MCD', 'PG',         <em># \u517b\u8001\u9632\u5b88\u7ec4<\/em>\n    'XOM', 'CVX', 'JPM', 'BAC'               <em># \u5468\u671f\u84dd\u7b79\u7ec4<\/em>\n]\n\nprint(\"\u8001\u4f59\u6b63\u5728\u5e2e\u4f60\u53bb\u6d77\u5916\u635e\u6570\u636e\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85...\")\n\ndata_list = &#91;]\n\nfor t in tickers:\n    try:\n        stock = yf.Ticker(t)\n        \n        <em># A. \u83b7\u53d6\u57fa\u672c\u9762\u4fe1\u606f (\u4f53\u68c0\u62a5\u544a)<\/em>\n        info = stock.info\n        \n        <em># B. \u83b7\u53d6\u4ef7\u683c\u5386\u53f2 (\u8ba1\u7b97\u813e\u6c14\u66b4\u4e0d\u66b4\u8e81)<\/em>\n        hist = stock.history(period=\"1y\")\n        <em># \u8ba1\u7b97\u5e74\u5316\u6ce2\u52a8\u7387<\/em>\n        volatility = hist&#91;'Close'].pct_change().std() * (252**0.5)\n        \n        <em># \u5c06\u5173\u952e\u6307\u6807\u88c5\u8fdb\u7bee\u5b50<\/em>\n        data_list.append({\n            'Ticker': t,\n            'PE': info.get('trailingPE', 0),       <em># \u5e02\u76c8\u7387<\/em>\n            'MarketCap': info.get('marketCap', 0), <em># \u5e02\u503c<\/em>\n            'Beta': info.get('beta', 1),           <em># \u8d1d\u5854<\/em>\n            'Volatility': volatility               <em># \u6ce2\u52a8\u7387<\/em>\n        })\n    except Exception as e:\n        print(f\"\u54ce\u5440\uff0c{t} \u7684\u6570\u636e\u6ca1\u635e\u5230: {e}\")\n\n<em># \u6574\u7406\u6210\u8868\u683c<\/em>\ndf = pd.DataFrame(data_list).set_index('Ticker')\ndf = df.fillna(0) <em># \u586b\u8865\u7a7a\u7f3a<\/em>\nprint(\"\u6570\u636e\u96c6\u7ed3\u5b8c\u6bd5\uff01\")<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7b2c\u4e8c\u6b65\uff1a\u5f00\u542f\u201c\u69a8\u6c41\u673a\u201d (PCA\u964d\u7ef4\u4e0e\u805a\u7c7b)<\/strong><\/h3>\n\n\n\n<p>\u8fd9\u4e00\u6b65\u662f\u6838\u5fc3\u3002\u6211\u4eec\u8981\u628a\u51e0\u5343\u4ebf\u7684\u5e02\u503c\u548c\u51e0\u5341\u7684\u5e02\u76c8\u7387\u653e\u5728\u4e00\u8d77\u6bd4\uff0c\u5fc5\u987b\u5148\u505a<strong>\u6807\u51c6\u5316\uff08Standardization\uff09<\/strong>\uff0c\u7136\u540e\u7528<strong>K-Means<\/strong>\u7b97\u6cd5\u628a\u5b83\u4eec\u81ea\u52a8\u5206\u7ec4\u3002<\/p>\n\n\n\n<p>Step 2: AI Clustering<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.preprocessing import StandardScaler\nfrom sklearn.decomposition import PCA\nfrom sklearn.cluster import KMeans\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n<em># 1. \u6570\u636e\u6807\u51c6\u5316 (\u628a\u5927\u5bb6\u62c9\u5230\u540c\u4e00\u8d77\u8dd1\u7ebf)<\/em>\nscaler = StandardScaler()\ndf_scaled = scaler.fit_transform(df)\n\n<em># 2. PCA\u964d\u7ef4 (\u628a4\u4e2a\u6307\u6807\u538b\u7f29\u62102\u4e2a\u4e3b\u6210\u5206\uff0c\u65b9\u4fbf\u753b\u56fe)<\/em>\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(df_scaled)\n\n<em># 3. K-Means\u805a\u7c7b (\u5047\u8bbe\u6211\u4eec\u8981\u52064\u4e2a\u5e2e\u6d3e)<\/em>\nkmeans = KMeans(n_clusters=4, random_state=42)\ndf&#91;'Cluster'] = kmeans.fit_predict(df_scaled)\n\n<em># 4. \u628aPCA\u7684\u7ed3\u679c\u4e5f\u5b58\u8fdb\u53bb\uff0c\u65b9\u4fbf\u4e00\u4f1a\u513f\u753b\u56fe<\/em>\ndf&#91;'PC1'] = principal_components&#91;:, 0]\ndf&#91;'PC2'] = principal_components&#91;:, 1]\n\n<em># \u6253\u5370\u7ed3\u679c\u770b\u770b<\/em>\nprint(df.sort_values('Cluster')&#91;&#91;'Cluster', 'PE', 'Volatility']])<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7b2c\u4e09\u6b65\uff1a\u53ef\u89c6\u5316\u4f60\u7684\u201c\u80a1\u5e02\u5730\u56fe\u201d<\/strong><\/h3>\n\n\n\n<p>\u6700\u540e\uff0c\u6211\u4eec\u753b\u4e00\u5f20\u6563\u70b9\u56fe\u3002\u70b9\u79bb\u5f97\u8d8a\u8fd1\uff0c\u8bf4\u660e\u5b83\u4eec\u8d8a\u50cf\uff1b\u989c\u8272\u4e0d\u540c\uff0c\u4ee3\u8868\u4e0d\u540c\u7684\u5e2e\u6d3e\u3002<\/p>\n\n\n\n<p>Step 3: Visualization<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.figure(figsize=(10, 8))\nsns.scatterplot(\n    x='PC1', y='PC2', \n    hue='Cluster', \n    data=df, \n    palette='viridis', \n    s=200 <em># \u70b9\u7684\u5927\u5c0f<\/em>\n)\n\n<em># \u7ed9\u6bcf\u4e2a\u70b9\u6807\u4e0a\u540d\u5b57<\/em>\nfor i in range(df.shape&#91;0]):\n    plt.text(\n        df.PC1&#91;i]+0.1, \n        df.PC2&#91;i]+0.1, \n        df.index&#91;i], \n        fontdict={'size': 12}\n    )\n\nplt.title('\u8001\u4f59\u635e\u9c7c - \u80a1\u7968\u57fa\u672c\u9762+\u4ef7\u683c\u805a\u7c7b\u56fe', fontsize=15)\nplt.xlabel('\u4e3b\u6210\u5206 1 (\u901a\u5e38\u4ee3\u8868\u6ce2\u52a8\/\u6210\u957f\u6027)')\nplt.ylabel('\u4e3b\u6210\u5206 2 (\u901a\u5e38\u4ee3\u8868\u5e02\u503c\/\u7a33\u5065\u6027)')\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"338\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u805a\u7c7b\u6563\u70b9\u56fe-1024x338.jpg\" alt=\"\" class=\"wp-image-3104\" srcset=\"https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u805a\u7c7b\u6563\u70b9\u56fe-1024x338.jpg 1024w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u805a\u7c7b\u6563\u70b9\u56fe-300x99.jpg 300w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u805a\u7c7b\u6563\u70b9\u56fe-768x253.jpg 768w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/11\/\u805a\u7c7b\u6563\u70b9\u56fe.jpg 1400w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">\u8fd0\u884c\u540e\u7684\u805a\u7c7b\u6563\u70b9\u56fe<\/figcaption><\/figure>\n\n\n\n<p>\u4f60\u4f1a\u770b\u5230\uff1a<br>\u25cf&nbsp;<strong>\u7279\u65af\u62c9\u3001\u82f1\u4f1f\u8fbe<\/strong>&nbsp;\u5728\u53f3\u4e0a\u89d2\uff08\u9ad8\u6ce2\u52a8\u3001\u9ad8\u6210\u957f\uff09<br>\u25cf&nbsp;<strong>\u53ef\u53e3\u53ef\u4e50\u3001\u5f3a\u751f<\/strong>&nbsp;\u5728\u5de6\u4e0b\u89d2\uff08\u4f4e\u6ce2\u52a8\u3001\u7a33\u5065\uff09<br>\u25cf&nbsp;<strong>\u82f9\u679c\u3001\u5fae\u8f6f<\/strong>&nbsp;\u5728\u4e2d\u95f4\uff08\u517c\u987e\u6210\u957f\u4e0e\u7a33\u5065\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>04 \u6df1\u5ea6\u89e3\u6790\uff1a\u600e\u4e48\u7528\u8fd9\u4e2a\u56fe\uff1f<\/strong><\/h2>\n\n\n\n<p>\u56fe\u8dd1\u51fa\u6765\u4e86\uff0c\u600e\u4e48\u6307\u5bfc\u6211\u4eec\u7684\u5b9e\u76d8\u64cd\u4f5c\uff1f\u8001\u4f59\u603b\u7ed3\u4e86\u4e00\u4e2a\u5bf9\u6bd4\u8868\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7ef4\u5ea6<\/th><th>\u5c0f\u767d\u7684\u201c\u4f2a\u5206\u6563\u201d<\/th><th>\u8001\u4f59\u7684\u201cAI\u5206\u6563\u201d<\/th><\/tr><\/thead><tbody><tr><td><strong>\u6301\u4ed3\u7279\u5f81<\/strong><\/td><td>\u5168\u4e70\u70ed\u95e8\u80a1\uff08\u82f1\u4f1f\u8fbe+\u7279\u65af\u62c9+AMD\uff09<\/td><td>\u8de8\u7c7b\u522b\u914d\u7f6e\uff08Cluster 1 + Cluster 2 + Cluster 3\uff09<\/td><\/tr><tr><td><strong>\u9047\u5230\u52a0\u606f<\/strong><\/td><td>\u4f30\u503c\u6740\uff0c\u5168\u7ebf\u5d29\u76d8\uff0c\u5173\u706f\u5403\u9762<\/td><td>\u6210\u957f\u80a1\u8dcc\uff0c\u4f46\u4ef7\u503c\u80a1\uff08\u5982\u94f6\u884c\u80fd\u6e90\uff09\u625b\u4f4f\u4e86<\/td><\/tr><tr><td><strong>\u5fc3\u6001<\/strong><\/td><td>\u6bcf\u5929\u76ef\u7740K\u7ebf\u5fc3\u60ca\u8089\u8df3<\/td><td>\u4e1c\u65b9\u4e0d\u4eae\u897f\u65b9\u4eae\uff0c\u7a33\u5982\u6cf0\u5c71<\/td><\/tr><tr><td><strong>\u6838\u5fc3\u903b\u8f91<\/strong><\/td><td>\u8d4c\u8d5b\u9053<\/td><td><strong>\u6570\u5b66\u76f8\u5173\u6027\u5bf9\u51b2<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u5b9e\u6218\u5efa\u8bae\uff1a<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u7684\u6301\u4ed3\u91cc\uff0c80%\u7684\u80a1\u7968\u90fd\u6324\u5728\u540c\u4e00\u4e2a\u989c\u8272\u7684Cluster\u91cc\uff0c\u54ea\u6015\u5b83\u4eec\u884c\u4e1a\u4e0d\u540c\uff0c\u4f60\u7684\u98ce\u9669\u4e5f\u662f\u6781\u5ea6\u96c6\u4e2d\u7684\u3002\u8bd5\u7740\u628a\u8d44\u91d1\u5206\u6563\u5230\u56fe\u8868\u4e0a\u8ddd\u79bb\u6700\u8fdc\u7684\u4e24\u4e2a\u70b9\u4e0a\uff0c\u90a3\u624d\u662f\u771f\u6b63\u7684\u201c\u8d44\u4ea7\u914d\u7f6e\u201d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>05 \u89c2\u70b9\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<p>\u5144\u5f1f\u4eec\uff0c\u6295\u8d44\u8fd9\u4e8b\u513f\uff0c\u6709\u65f6\u5019\u771f\u4e0d\u80fd\u5149\u9760\u76f4\u89c9\u3002\u4f60\u89c9\u5f97\u5b83\u4eec\u4e0d\u4e00\u6837\uff0c\u4f46\u8d44\u91d1\u6d41\u5411\u544a\u8bc9\u4f60\uff0c\u5b83\u4eec\u5c31\u662f\u4e00\u56de\u4e8b\u3002<\/p>\n\n\n\n<p>\u4eca\u5929\u4ecb\u7ecd\u7684\u8fd9\u4e2a<strong>\u57fa\u672c\u9762+\u4ef7\u683c\u53cc\u91cd\u805a\u7c7b<\/strong>\uff0c\u662f\u91cf\u5316\u673a\u6784\u91cc\u5e38\u7528\u7684\u624b\u6bb5\u3002\u5b83\u80fd\u5e2e\u4f60\u6495\u5f00\u80a1\u7968\u8868\u9762\u7684\u6807\u7b7e\uff0c\u770b\u5230\u8d44\u91d1\u6d41\u52a8\u7684\u771f\u76f8\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udcdd \u6838\u5fc3\u7b14\u8bb0<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5206\u6563\u2260\u6570\u91cf\u591a\uff1a<\/strong>\u00a0\u5373\u4f7f\u4f60\u4e70\u4e8610\u53ea\u79d1\u6280\u80a1\uff0c\u53ea\u8981\u5b83\u4eec\u5728\u540c\u4e00\u4e2a\u805a\u7c7b\u91cc\uff0c\u98ce\u9669\u5c31\u662f100%\u3002<\/li>\n\n\n\n<li><strong>\u76f8\u4fe1\u7b97\u6cd5\uff1a<\/strong>\u00a0\u4eba\u8111\u5904\u7406\u4e0d\u4e86\u591a\u7ef4\u5ea6\u7684\u590d\u6742\u5173\u7cfb\uff08PE\u3001\u5e02\u503c\u3001\u6ce2\u52a8\u7387\u6df7\u5728\u4e00\u8d77\uff09\uff0c\u4f46PCA\u548c\u805a\u7c7b\u7b97\u6cd5\u53ef\u4ee5\u3002<\/li>\n\n\n\n<li><strong>\u52a8\u6001\u8c03\u6574\uff1a<\/strong>\u00a0\u5e02\u573a\u98ce\u683c\u4f1a\u53d8\uff08\u6bd4\u5982\u73b0\u5728AI\u706b\uff0c\u4ee5\u524d\u662f\u65b0\u80fd\u6e90\u706b\uff09\uff0c\u5efa\u8bae\u6bcf\u4e2a\u5b63\u5ea6\u8dd1\u4e00\u6b21\u8fd9\u4e2a\u4ee3\u7801\uff0c\u7ed9\u6301\u4ed3\u505a\u4e2a\u201c\u4f53\u68c0\u201d\u3002<\/li>\n\n\n\n<li><strong>\u5de5\u5177\u662f\u8f85\u52a9\uff1a<\/strong>\u00a0\u91cf\u5316\u5de5\u5177\u5e2e\u4f60\u6392\u96f7\uff0c\u4f46\u9009\u80a1\u7684\u6700\u7ec8\u903b\u8f91\uff0c\u8fd8\u5f97\u770b\u4f01\u4e1a\u7684\u57fa\u672c\u9762\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u597d\u4e86\uff0c\u4eca\u5929\u7684\u5e72\u8d27\u5c31\u635e\u5230\u8fd9\u91cc\u3002\u4ee3\u7801\u5982\u679c\u6709\u62a5\u9519\uff0c\u6216\u8005\u60f3\u770b<strong>A\u80a1\u7248\u672c\uff08\u5982\u4f55\u5206\u6790\u8305\u53f0\u548c\u5b81\u5fb7\u65f6\u4ee3\uff09<\/strong>\uff0c<strong>\u70b9\u8d5e\u3001\u5728\u770b\u3001\u8f6c\u53d1<\/strong>\u4e09\u8fde\uff0c\u4eba\u6570\u591a\u7684\u8bdd\u8001\u4f59\u4e0b\u671f\u4e13\u95e8\u51fa\u4e00\u671fA\u80a1\u5b9e\u6218\u7248\uff01<\/p>\n\n\n\n<p>\u6211\u662f\u8001\u4f59\uff0c\u7528\u6570\u636e\u8bf4\u8bdd\uff0c\u54b1\u4eec\u4e0b\u671f\u89c1\uff01\ud83d\udc4b<\/p>\n\n\n\n<p>#\u91cf\u5316\u4ea4\u6613&nbsp;#Python\u91d1\u878d&nbsp;#\u8d44\u4ea7\u914d\u7f6e&nbsp;#\u8001\u4f59\u635e\u9c7c&nbsp;#\u80a1\u7968\u805a\u7c7b<\/p>\n\n\n\n<p><em><em>\u89c9\u5f97\u8001\u4f59\u8fd9\u7bc7\u5e72\u8d27\u6709\u7528\u7684\uff0c\u8001\u89c4\u77e9\uff0c\u70b9\u8d5e\u5728\u770b\uff0c\u8bc4\u8bba\u533a\u89c1\uff01<\/em>&nbsp;\ud83d\udc47<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\">\u98ce\u9669\u63d0\u793a\uff1a\u6295\u8d44\u6709\u98ce\u9669\uff0c\u5165\u5e02\u9700\u8c28\u614e\u3002\u672c\u6587\u4ec5\u4f9b\u5b66\u4e60\u53c2\u8003\uff0c\u4e0d\u6784\u6210\u6295\u8d44\u5efa\u8bae\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u8001\u4f59\u635e\u9c7c \u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/laoyulaoyu.com\/index.php\/2025\/12\/02\/%e6%95%a3%e6%88%b7%e8%bf%98%e5%9c%a8%e7%9c%8bk%e7%ba%bf%ef%bc%8c%e4%b8%bb%e5%8a%9b%e5%b7%b2%e7%bb%8f%e7%94%a8dna%e6%8a%80%e6%9c%af%e9%87%8d%e7%bb%84%e4%ba%86%e8%82%a1%e5%b8%82\/\">Continue reading<span class=\"screen-reader-text\">\u6563\u6237\u8fd8\u5728\u770bK\u7ebf\uff0c\u4e3b\u529b\u5df2\u7ecf\u7528\u201cDNA\u6280\u672f\u201d\u91cd\u7ec4\u4e86\u80a1\u5e02\uff08\u9644\u6e90\u7801\uff09<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[17,4,5,6],"class_list":{"0":"post-3100","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-aiinvest","7":"tag-ai","10":"tag-6","11":"entry"},"_links":{"self":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/3100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/comments?post=3100"}],"version-history":[{"count":1,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/3100\/revisions"}],"predecessor-version":[{"id":3105,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/3100\/revisions\/3105"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=3100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=3100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=3100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}