{"id":1704,"date":"2024-12-10T07:34:00","date_gmt":"2024-12-09T23:34:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=1704"},"modified":"2024-11-15T23:37:46","modified_gmt":"2024-11-15T15:37:46","slug":"%e8%b7%a8%e7%95%8c%e5%ad%a6%e4%b9%a0%e5%bf%85%e5%a4%87%ef%bc%81%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e9%87%91%e8%9e%8d%e6%95%b0%e6%8d%ae%e8%ae%ad%e7%bb%83ml-%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2024\/12\/10\/%e8%b7%a8%e7%95%8c%e5%ad%a6%e4%b9%a0%e5%bf%85%e5%a4%87%ef%bc%81%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e9%87%91%e8%9e%8d%e6%95%b0%e6%8d%ae%e8%ae%ad%e7%bb%83ml-%e6%a8%a1%e5%9e%8b\/","title":{"rendered":"\u8de8\u754c\u5b66\u4e60\u5fc5\u5907\uff01\u5982\u4f55\u5229\u7528\u91d1\u878d\u6570\u636e\u8bad\u7ec3ML \u6a21\u578b"},"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 decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/111501.png\" alt=\"\" class=\"wp-image-2959\"\/><\/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>\u673a\u5668\u5b66\u4e60\uff08ML\uff09\u5df2\u6210\u4e3a\u83b7\u5f97\u6d1e\u5bdf\u529b\u3001\u8fdb\u884c\u9884\u6d4b\u548c\u52a0\u5f3a\u91d1\u878d\u51b3\u7b56\u7684\u5173\u952e\u3002\u9ad8\u8d28\u91cf\u7684\u91d1\u878d\u6570\u636e\u5bf9\u6709\u6548\u7684 ML \u6a21\u578b\u81f3\u5173\u91cd\u8981\uff0c\u800c EODHD \u51ed\u501f\u5176\u5f3a\u5927\u7684\u91d1\u878d\u6570\u636e API \u5957\u4ef6\u63d0\u4f9b\u4e86\u8fd9\u4e00\u57fa\u7840\u3002<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u672c\u6587\u5c06\u63a2\u8ba8\u5229\u7528 EODHD \u6570\u636e\u8bad\u7ec3 ML \u6a21\u578b\u7684\u5b9e\u7528\u7b56\u7565\uff0c\u4ee5\u53ca\u5728\u5b9e\u9645\u5e02\u573a\u73af\u5883\u4e2d\u7684\u5e94\u7528\u3002<\/mark>\u6211\u60f3\uff0c\u65e0\u8bba\u60a8\u662f\u5728\u5f00\u53d1\u4e00\u79cd\u65b0\u7684\u4ea4\u6613\u7b97\u6cd5\uff0c\u8fd8\u662f\u5728\u8fdb\u884c\u5b9a\u91cf\u91d1\u878d\u7814\u7a76\uff0c\u6709\u6548\u5229\u7528 EODHD \u7684\u6570\u636e\u90fd\u80fd\u6781\u5927\u5730\u4fc3\u8fdb\u60a8\u7684\u9879\u76ee\u3002<\/pre>\n<\/blockquote>\n\n\n\n<p><strong>\u4eca\u5929\u804a\u4e00\u4e2a\u70ed\u95e8\u8bdd\u9898\uff1a\u5982\u4f55\u5229\u7528\u91d1\u878d\u6570\u636e\u8bad\u7ec3\u673a\u5668\u5b66\u4e60\uff08ML\uff09\u6a21\u578b\u3002<\/strong>\u6211\u5728\u4e0d\u5c11\u6587\u7ae0\u4e2d\u90fd\u5199\u8fc7\u8c03\u7528 Yahoo Finance\u3001Bloomberg\u3001EODHD\u3001Polygon\u7b49\u91d1\u878d\u6570\u636e API\u7684\u6587\u7ae0\uff0c<strong>\u4f46\u5728\u8bad\u7ec3ML\u6a21\u578b\u7684\u5355\u5143\uff0c\u6211\u7528\u7684\u6700\u987a\u624b\u7684\u8fd8\u662f EODHD\u3002<\/strong>\u5b83\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u91d1\u878d\u6570\u636e\u63a5\u53e3\uff08API\uff09\uff0c\u6db5\u76d6\u4e86\u80a1\u7968\u3001\u5916\u6c47\u3001\u6307\u6570\u7b49\u591a\u4e2a\u91d1\u878d\u9886\u57df\uff0c\u6570\u636e\u96c6\u5305\u62ec\u5386\u53f2\u80a1\u4ef7\u3001\u5b9e\u65f6\u6570\u636e\u3001\u57fa\u672c\u9762\u3001\u6280\u672f\u6307\u6807\u548c\u60c5\u7eea\u6570\u636e\u7b49\uff0c\u8986\u76d6\u4e86\u5168\u7403 70 \u591a\u4e2a\u4ea4\u6613\u6240\u7684 150,000 \u591a\u4e2a\u80a1\u7968\u4ee3\u7801\u3002\u5e76\u4e14\u63d0\u4f9b\u4e86\u957f\u8fbe30\u5e74\u7684\u5386\u53f2\u6570\u636e\u548c\u5b9e\u65f6\u6570\u636e\uff0c\u800c\u4e14\u8fd9\u4e2a <a href=\"https:\/\/eodhd.com\/\">EODHD.COM<\/a> \u5728\u56fd\u5185\u80fd\u6b63\u5e38\u8bbf\u95ee\uff0cAPI\u8c03\u7528\u54cd\u5e94\u901f\u5ea6\u4e5f\u5f88\u5feb\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731675721096-1024x649.png\" alt=\"\" class=\"wp-image-2963\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731675647154-805x1024.png\" alt=\"\" class=\"wp-image-2962\"\/><\/figure>\n\n\n\n<p><strong>\u9700\u8981\u58f0\u660e\u7684\u662f\uff0c\u6211\u548c EODHD \u6ca1\u6709\u4efb\u4f55\u5229\u76ca\u5f80\u6765\uff0c\u672c\u6587\u4e5f\u4e0d\u662f\u5e7f\u544a\u8f6f\u6587 \uff01<\/strong>\u5b83\u5438\u5f15\u6211\u7684\u5730\u65b9\u5c31\u662f\u6bd4 Yahoo Finance \u65b9\u4fbf\uff0c\u6bd4Bloomberg \u8fd9\u4e9b\u4fbf\u5b9c\uff0c\u6bd4\u56fd\u5185\u7684\u91d1\u878d\u54c1\u79cd\u591a\u3002\u5728\u5f00\u59cb\u8bd5\u7528\u65f6\u514d\u8d39\uff0c\u540e\u976219.99 \u7f8e\u5143\/\u6708\u53ef\u83b7\u5f97\u5927\u90e8\u5206\u7684\u6570\u636e\u8bbf\u95ee\uff0c\u4e5f\u65e0\u9700\u957f\u671f\u5408\u7ea6\u3002\u5bf9\u4e8e\u5b66\u751f\u548c\u5b66\u672f\u76ee\u7684\uff0c\u8fd8\u6700\u9ad8\u53ef\u4eab\u53d7 50% \u7684\u6298\u6263\u3002<\/p>\n\n\n\n<p>\u6211\u5728\u6211\u7684\u4e0d\u5c11\u6587\u7ae0\u4e2d\u90fd\u4ecb\u7ecd\u8fc7&nbsp;EODHD API&nbsp;\uff0c\u5927\u5bb6\u53ef\u4ee5\u7528\u5173\u952e\u8bcd EODHD\u5728\u6211\u7684\u7f51\u7ad9\u3001\u516c\u4f17\u53f7\u4e0a\u641c\u7d22\u90fd\u53ef\u4ee5\u627e\u5230\u3002\u8a00\u5f52\u6b63\u4f20\uff0c\u5f00\u59cb\u6211\u4eec\u4eca\u5929\u7684\u4e3b\u9898\u3002<\/p>\n\n\n\n<p>\u70b9\u51fb\u4e0b\u9762\u7684\u94fe\u63a5\uff0c\u60a8\u53ef\u4ee5\u627e\u5230\u5305\u542b\u672c\u6587\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u7684 Google \u7b14\u8bb0\u672c\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/colab.research.google.com\/drive\/1JAVuecGM1uGqD_yUSj5JR_0W58qeHCg_?usp=sharing\">https:\/\/colab.research.google.com\/drive\/1JAVuecGM1uGqD_yUSj5JR_0W58qeHCg_?usp=sharing<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u91d1\u878d\u6570\u636e\u5728\u673a\u5668\u5b66\u4e60\u4e2d\u7684\u4f5c\u7528<\/strong><\/h2>\n\n\n\n<p>\u5728\u91d1\u878d\u884c\u4e1a\u4e2d\uff0c\u91d1\u878d\u6570\u636e\u5bf9\u673a\u5668\u5b66\u4e60\uff08ML\uff09\u6a21\u578b\u81f3\u5173\u91cd\u8981\u3002\u8fd9\u4e9b\u6a21\u578b\u7684\u6709\u6548\u6027\u9ad8\u5ea6\u4f9d\u8d56\u4e8e\u5b83\u4eec\u6240\u8bad\u7ec3\u7684\u6570\u636e\u7684\u8d28\u91cf\uff0c\u56e0\u6b64\u91d1\u878d\u6570\u636e\u7684\u51c6\u786e\u6027\u548c\u5b8c\u6574\u6027\u81f3\u5173\u91cd\u8981\u3002\u8ba9\u6211\u4eec\u63a2\u8ba8\u4e00\u4e0b \u91d1\u878d\u6570\u636e\u7c7b\u578b\u53ca\u5176\u4e0e ML \u5e94\u7528\u7684\u76f8\u5173\u6027\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5386\u53f2\u80a1\u7968\u4ef7\u683c\uff1a<\/strong>\u8bb8\u591a\u91d1\u878d ML \u6a21\u578b\u7684\u57fa\u672c\u7ec4\u6210\u90e8\u5206\uff0c\u4f7f\u5176\u80fd\u591f\u4ece\u8fc7\u53bb\u7684\u5e02\u573a\u884c\u4e3a\u4e2d\u5b66\u4e60\u5e76\u8bc6\u522b\u8d8b\u52bf\u3002<\/li>\n\n\n\n<li><strong>\u5b9e\u65f6\u5e02\u573a\u6570\u636e\uff1a<\/strong>\u5bf9\u4e8e\u9700\u8981\u5373\u65f6\u51b3\u7b56\u7684\u6a21\u578b\uff08\u5982\u9ad8\u9891\u4ea4\u6613\u4e2d\u4f7f\u7528\u7684\u6a21\u578b\uff09\u81f3\u5173\u91cd\u8981\u3002<\/li>\n\n\n\n<li><strong>\u57fa\u672c\u6570\u636e\uff1a<\/strong>\u5bf9\u4e8e\u8bc4\u4f30\u516c\u53f8\u5185\u5728\u4ef7\u503c\u6216\u9884\u6d4b\u957f\u671f\u4e1a\u7ee9\u7684\u6a21\u578b\u6765\u8bf4\u81f3\u5173\u91cd\u8981\uff0c\u5176\u4e2d\u5305\u542b\u8d44\u4ea7\u8d1f\u503a\u8868\u3001\u635f\u76ca\u8868\u548c\u73b0\u91d1\u6d41\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/li>\n\n\n\n<li><strong>\u6280\u672f\u6307\u6807\uff1a<\/strong>EODHD \u63d0\u4f9b\u9884\u5148\u8ba1\u7b97\u7684\u6307\u6807\uff0c\u53ef\u8282\u7701\u5f00\u53d1\u65f6\u95f4\uff0c\u5e76\u786e\u4fdd\u4e0d\u540c\u5e94\u7528\u4e2d\u7684\u6a21\u578b\u8f93\u5165\u7edf\u4e00\u3002<\/li>\n\n\n\n<li><strong>\u60c5\u7eea\u6570\u636e\uff1a<\/strong>\u53e6\u4e00\u79cd\u6570\u636e\u6e90\uff0c\u53ef\u589e\u52a0\u5bf9\u5e02\u573a\u60c5\u7eea\u7684\u6d1e\u5bdf\u529b\uff0c\u5e2e\u52a9\u9884\u6d4b\u6f5c\u5728\u7684\u77ed\u671f\u4ef7\u683c\u53d8\u5316\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5728\u8bad\u7ec3 ML \u6a21\u578b\u65f6\uff0c\u6570\u636e\u8d28\u91cf\u548c\u7c92\u5ea6\u5bf9\u5b9e\u73b0\u51c6\u786e\u6027\u81f3\u5173\u91cd\u8981\u3002EODHD \u7684\u6570\u636e\u7ecf\u8fc7\u4e86\u4e25\u683c\u7684\u9a8c\u8bc1\uff0c\u5e76\u5305\u542b\u7ec6\u7c92\u5ea6\u4fe1\u606f\uff08\u5982\u7279\u5b9a\u5e02\u573a\u7684&nbsp;tick-level \u6570\u636e\uff09\uff0c\u56e0\u6b64\u53ef\u4ee5\u8fdb\u884c\u7cbe\u786e\u7684\u6a21\u578b\u8bad\u7ec3\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001EODHD \u5e94\u7528\u7a0b\u5e8f\u63a5\u53e3\u4f7f\u7528\u793a\u4f8b<\/strong><\/h2>\n\n\n\n<p>\u4e0b\u9762\u7684\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528 EODHD \u7684 End-of-Day API \u68c0\u7d22\u5386\u53f2\u80a1\u7968\u6570\u636e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import requests\nimport pandas as pd\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data&#91;'date'] = pd.to_datetime(data&#91;'date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\n# Usage\napi_key = \"demo\"\napple_data = get_stock_data(\"AAPL\", \"2024-01-01\", \"2024-09-31\", api_key)\nprint(apple_data.head())<\/code><\/pre>\n\n\n\n<p>\u8be5\u4ee3\u7801\u5c55\u793a\u4e86 EODHD \u6570\u636e\u5982\u4f55\u65e0\u7f1d\u96c6\u6210\u5230 Python \u73af\u5883\u4e2d\uff0c\u4e3a\u8fdb\u4e00\u6b65\u7684\u6570\u636e\u5206\u6790\u548c\u6a21\u578b\u8bad\u7ec3\u5960\u5b9a\u4e86\u57fa\u7840\u3002\u6b64\u5916\uff0cEODHD \u81ea\u8eab\u7684\u5e93\u53ef\u7528\u4e8e\u66f4\u5feb\u7684\u5f00\u53d1\u548c\u96c6\u6210\u3002<\/p>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u5c06 &#8220;demo &#8220;\u66ff\u6362\u4e3a\u60a8\u4eea\u8868\u677f\u4e0a\u7684\u5b9e\u9645 EODHD API \u5bc6\u94a5\u3002demo \u5bc6\u94a5\u4ec5\u63d0\u4f9b AAPL\u3001TSLA\u3001AMZN \u548c MSFT \u80a1\u7968\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u91d1\u878d\u6570\u636e\u673a\u5668\u5b66\u4e60\u6a21\u578b\u7684\u7c7b\u578b<\/strong><\/h2>\n\n\n\n<p id=\"8d05\">\u91d1\u878d\u90e8\u95e8\u5229\u7528\u5404\u79cd\u673a\u5668\u5b66\u4e60 (ML) \u6a21\u578b\uff0c\u4e3a\u7279\u5b9a\u4efb\u52a1\u548c\u6570\u636e\u7c7b\u578b\u91cf\u8eab\u5b9a\u5236\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684 ML \u6a21\u578b\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528 EODHD \u7684\u91d1\u878d\u6570\u636e\u6765\u5e94\u7528\u8fd9\u4e9b\u6a21\u578b\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"03c5\"><strong>3.1 \u76d1\u7763\u5b66\u4e60\u6a21\u578b\uff08SL\uff09<\/strong><\/h3>\n\n\n\n<p id=\"2d7f\">\u76d1\u7763\u5b66\u4e60\u6a21\u578b\uff08Supervised Learning Models\uff09\u901a\u5e38\u7528\u4e8e\u80a1\u7968\u4ef7\u683c\u9884\u6d4b\u3001\u5e02\u573a\u8d8b\u52bf\u9884\u6d4b\u548c\u4fe1\u7528\u8bc4\u5206\u7b49\u4efb\u52a1\u3002\u8fd9\u4e9b\u6a21\u578b\u4ece\u6807\u6ce8\u7684\u5386\u53f2\u6570\u636e\u4e2d\u5b66\u4e60\uff0c\u4ece\u800c\u505a\u51fa\u9884\u6d4b\u6216\u5206\u7c7b\u3002<\/p>\n\n\n\n<p id=\"2b1e\"><strong>\u4f8b\u5982\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7ebf\u6027\u56de\u5f52\uff1a<\/strong>\u9002\u7528\u4e8e\u9884\u6d4b\u7b80\u5355\u8d8b\u52bf\u3002<\/li>\n\n\n\n<li><strong>\u968f\u673a\u68ee\u6797\uff1a<\/strong>\u9002\u7528\u4e8e\u5904\u7406\u91d1\u878d\u6570\u636e\u4e2d\u590d\u6742\u7684\u975e\u7ebf\u6027\u5173\u7cfb\u3002<\/li>\n\n\n\n<li><strong>\u652f\u6301\u5411\u91cf\u673a\uff08SVM\uff09\uff1a<\/strong>\u975e\u5e38\u9002\u5408\u4e8c\u5143\u5206\u7c7b\u548c\u56de\u5f52\u4efb\u52a1\uff0c\u5982\u9884\u6d4b\u5e02\u573a\u65b9\u5411\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7478\"><strong>3.2 \u80a1\u7968\u4ef7\u683c\u9884\u6d4b-\u968f\u673a\u68ee\u6797\u6a21\u578b\u793a\u4f8b<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.ensemble import RandomForestRegressor\nfrom sklearn.model_selection import train_test_split\nimport numpy as np\nimport requests\nimport pandas as pd\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data&#91;'date'] = pd.to_datetime(data&#91;'date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef prepare_data(df, look_back=30):\n    X, y = &#91;], &#91;]\n    for i in range(len(df) - look_back):\n        X.append(df.iloc&#91;i:i+look_back]&#91;'close'].values)\n        y.append(df.iloc&#91;i+look_back]&#91;'close'])\n    return np.array(X), np.array(y)\n\n#loading data\napi_key = \"demo\"\napple_data = get_stock_data(\"AAPL\", \"2024-01-01\", \"2024-09-31\", api_key)\nprint(apple_data.head())\n\nX, y = prepare_data(apple_data)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\nmodel = RandomForestRegressor(n_estimators=100, random_state=42)\nmodel.fit(X_train, y_train)\n\nprint(f\"Model Score: {model.score(X_test, y_test)}\")<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"bc04\"><strong>3.3 \u9884\u6d4b\u6a21\u578b\u7ed3\u679c\u53ef\u89c6\u5316<\/strong><\/h3>\n\n\n\n<p id=\"e1a3\">\u4f7f\u7528 AAPL \u80a1\u7968\u6570\u636e\u8bad\u7ec3\u6a21\u578b\u540e\uff0c\u9884\u6d4b\u4ef7\u683c\u4e0e\u5b9e\u9645\u6536\u76d8\u4ef7\u683c\u7684\u5bf9\u6bd4\u56fe\u6709\u52a9\u4e8e\u76f4\u89c2\u5730\u663e\u793a\u6a21\u578b\u7684\u51c6\u786e\u6027\u3002<\/p>\n\n\n\n<p id=\"e1a3\"><strong>\u9884\u6d4b\u6a21\u578b\u7ed3\u679c\uff1a<\/strong>\u8be5\u56fe\u663e\u793a\u4e86\u9884\u6d4b\u6536\u76d8\u4ef7\u4e0e\u5b9e\u9645\u503c\u7684\u543b\u5408\u7a0b\u5ea6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"2d30\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.readmedium.com\/v2\/resize:fit:800\/0*RxIlxKSWhmUkgvE6.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"71d9\"><strong>\u6b8b\u5dee\u56fe<\/strong>\uff08<strong>Residual Plot<\/strong>\uff09\uff1a\u663e\u793a\u8bef\u5dee\u7684\u5927\u5c0f\u548c\u5206\u5e03\u60c5\u51b5\uff0c\u6709\u52a9\u4e8e\u6df1\u5165\u4e86\u89e3\u6a21\u578b\u7684\u9884\u6d4b\u53ef\u9760\u6027\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"1105\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.readmedium.com\/v2\/resize:fit:800\/0*u2zAU3dZRCjytcoW.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"12a3\"><br><strong>3.4 \u65e0\u76d1\u7763\u5b66\u4e60\u6a21\u578b\uff08UL\uff09<\/strong><\/h3>\n\n\n\n<p id=\"936b\">\u65e0\u76d1\u7763\u5b66\u4e60\u6a21\u578b\uff08Unsupervised Learning Models\uff09\u901a\u8fc7\u5206\u6790\u65e0\u6807\u6ce8\u6570\u636e\u6765\u8bc6\u522b\u6a21\u5f0f\uff0c\u56e0\u6b64\u5bf9\u5e02\u573a\u7ec6\u5206\u3001\u6b3a\u8bc8\u68c0\u6d4b\u548c\u98ce\u9669\u8bc4\u4f30\u975e\u5e38\u6709\u4ef7\u503c\u3002<\/p>\n\n\n\n<p id=\"cf00\"><strong>\u65e0\u76d1\u7763\u6a21\u578b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>K-Means \u805a\u7c7b\uff1a<\/strong>\u9002\u7528\u4e8e\u5e02\u573a\u7ec6\u5206\u3002<\/li>\n\n\n\n<li><strong>\u5f02\u5e38\u68c0\u6d4b\uff1a<\/strong>\u5e2e\u52a9\u8bc6\u522b\u53ef\u80fd\u9884\u793a\u6b3a\u8bc8\u6216\u5e02\u573a\u64cd\u7eb5\u7684\u5f02\u5e38\u6a21\u5f0f\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"e846\"><strong>3.5 \u5f3a\u5316\u5b66\u4e60\u6a21\u578b\uff08RL\uff09<\/strong><\/h3>\n\n\n\n<p id=\"9468\">\u5f3a\u5316\u5b66\u4e60\u6a21\u578b\uff08Reinforcement Learning Models\uff09\u901a\u8fc7\u4e0e\u73af\u5883\u7684\u4e92\u52a8\u6765\u5b66\u4e60\uff0c\u56e0\u6b64\u975e\u5e38\u9002\u5408\u7b97\u6cd5\u4ea4\u6613\u548c\u6295\u8d44\u7ec4\u5408\u4f18\u5316\u7b49\u52a8\u6001\u91d1\u878d\u4efb\u52a1\u3002<\/p>\n\n\n\n<p id=\"e0dc\"><strong>\u5316\u5b66\u4e60\u6a21\u578b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6df1\u5ea6 Q \u7f51\u7edc\uff08DQN\uff09\uff1a<\/strong>\u5e38\u7528\u4e8e\u7b97\u6cd5\u4ea4\u6613\u3002<\/li>\n\n\n\n<li><strong>\u653f\u7b56\u68af\u5ea6\u6cd5\uff1a<\/strong>\u901a\u5e38\u5e94\u7528\u4e8e\u6295\u8d44\u7ec4\u5408\u4f18\u5316\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"caa7\"><strong>3.6 \u6df1\u5ea6\u5b66\u4e60\u6a21\u578b(DNN)<\/strong><\/h3>\n\n\n\n<p id=\"d08e\"><br>\u6df1\u5ea6\u5b66\u4e60\u795e\u7ecf\u7f51\u7edc(Deep learning neural networks)\u5728\u5904\u7406\u5927\u91cf\u91d1\u878d\u6570\u636e\u65b9\u9762\u975e\u5e38\u6709\u6548\uff0c\u901a\u5e38\u5e94\u7528\u4e8e\u65f6\u95f4\u5e8f\u5217\u9884\u6d4b\u3001\u60c5\u611f\u5206\u6790\u548c\u9ad8\u9891\u4ea4\u6613\u3002<\/p>\n\n\n\n<p id=\"b9a9\"><strong>\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9012\u5f52\u795e\u7ecf\u7f51\u7edc\uff08RNN\uff09\uff1a<\/strong>\u9002\u7528\u4e8e\u65f6\u95f4\u5e8f\u5217\u9884\u6d4b\u3002<\/li>\n\n\n\n<li><strong>\u957f\u77ed\u671f\u8bb0\u5fc6\uff08LSTM\uff09\uff1a<\/strong>\u53ef\u6709\u6548\u6355\u6349\u91d1\u878d\u6570\u636e\u4e2d\u7684\u957f\u671f\u4f9d\u8d56\u5173\u7cfb\u3002<\/li>\n<\/ul>\n\n\n\n<p id=\"f218\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 TensorFlow \u9884\u6d4b\u80a1\u7968\u4ef7\u683c\u7684 LSTM \u6a21\u578b\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tensorflow as tf\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import LSTM, Dense\nfrom sklearn.preprocessing import MinMaxScaler\nimport numpy as np\nimport requests\nimport pandas as pd\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data&#91;'date'] = pd.to_datetime(data&#91;'date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef prepare_data(df, look_back=30):\n    X, y = &#91;], &#91;]\n    for i in range(len(df) - look_back):\n        X.append(df.iloc&#91;i:i+look_back]&#91;'close'].values)\n        y.append(df.iloc&#91;i+look_back]&#91;'close'])\n    return np.array(X), np.array(y)\n\n#loading data\napi_key = \"demo\"\napple_data = get_stock_data(\"AAPL\", \"2024-01-01\", \"2024-09-31\", api_key)\nprint(apple_data.head())\n\n# Prepare data\nscaler = MinMaxScaler()\nscaled_data = scaler.fit_transform(apple_data&#91;&#91;'close']])\n\nX, y = prepare_data(pd.DataFrame(scaled_data, columns=&#91;'close']))\nX = X.reshape((X.shape&#91;0], X.shape&#91;1], 1))\n\n# Build model\nmodel = Sequential(&#91;\n    LSTM(50, return_sequences=True, input_shape=(30, 1)),\n    LSTM(50, return_sequences=False),\n    Dense(25),\n    Dense(1)\n])\n\nmodel.compile(optimizer='adam', loss='mean_squared_error')\nmodel.fit(X, y, batch_size=32, epochs=100)\n\nprint(\"Model trained successfully\")<\/code><\/pre>\n\n\n\n<p id=\"6efc\"><strong>\u53ef\u89c6\u5316\u6a21\u578b\u6027\u80fd<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"0b4f\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.readmedium.com\/v2\/resize:fit:800\/0*3rlt4ZTybZJ1qqFc.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"58ec\"><br><strong>\u56db\u3001\u5229\u7528\u60c5\u7eea\u6570\u636e\u8fdb\u884c\u91d1\u878d\u9884\u6d4b<\/strong><\/h2>\n\n\n\n<p id=\"500d\">\u673a\u5668\u5b66\u4e60\u6a21\u578b\u53ef\u4ee5\u5e2e\u52a9\u9884\u6d4b\u4ece\u80a1\u7968\u4ef7\u683c\u5230\u5229\u7387\u7b49\u7ecf\u6d4e\u6307\u6807\u7684\u5404\u79cd\u91d1\u878d\u6307\u6807\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731683482249.png\" alt=\"\" class=\"wp-image-2971\"\/><\/figure>\n\n\n\n<p id=\"500d\">\u4e0b\u9762\u662f\u4e00\u4e2a\u5229\u7528 EODHD \u60c5\u7eea\u6570\u636e\u7684\u76f4\u63a5\u80a1\u4ef7\u9884\u6d4b\u6a21\u578b\u793a\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import requests\nimport pandas as pd\nimport numpy as np\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.model_selection import train_test_split\nfrom datetime import datetime, timedelta\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    \"\"\"Fetch stock price data\"\"\"\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data&#91;'date'] = pd.to_datetime(data&#91;'date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef get_sentiment_data(symbol, start_date,end_date, api_key):\n    \"\"\"Fetch sentiment data\"\"\"\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/sentiments?s={symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    \n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = response.json()\n        symbol_key = f\"{symbol}.US\"\n        if symbol_key not in data:\n            raise KeyError(f\"No sentiment data found for symbol {symbol}\")\n        \n        sentiment_df = pd.DataFrame(data&#91;symbol_key])\n        sentiment_df&#91;'date'] = pd.to_datetime(sentiment_df&#91;'date'])\n        sentiment_df = sentiment_df.set_index('date')\n        \n        # Calculate additional sentiment metrics\n        sentiment_df&#91;'sentiment_strength'] = abs(sentiment_df&#91;'normalized'] - 0.5) * 200\n        \n        return sentiment_df\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef prepare_data_with_sentiment(price_df, sentiment_df, look_back=30):\n    \"\"\"Prepare data with both price and sentiment features\"\"\"\n    # Ensure sentiment_df has same dates as price_df\n    combined_df = price_df.join(sentiment_df, how='left')\n    \n    # Forward fill sentiment values for missing dates\n    combined_df&#91;'normalized'] = combined_df&#91;'normalized'].ffill()\n    combined_df&#91;'count'] = combined_df&#91;'count'].ffill()\n    combined_df&#91;'sentiment_strength'] = combined_df&#91;'sentiment_strength'].ffill()\n    \n    # Fill any remaining NaN values with median values\n    combined_df = combined_df.fillna(combined_df.median())\n    \n    X, y = &#91;], &#91;]\n    feature_names = &#91;'close', 'normalized', 'count', 'sentiment_strength']\n    \n    for i in range(len(combined_df) - look_back):\n        features = &#91;]\n        for feature in feature_names:\n            features.extend(combined_df.iloc&#91;i:i+look_back]&#91;feature].values)\n        X.append(features)\n        y.append(combined_df.iloc&#91;i+look_back]&#91;'close'])\n    \n    return np.array(X), np.array(y)\n\n# Modified training and prediction code to include dates\ndef train_model_with_dates(X, y, dates, test_size=0.2):\n    \"\"\"Train model and return results with corresponding dates\"\"\"\n    # Split the data\n    split_idx = int(len(X) * (1 - test_size))\n    X_train, X_test = X&#91;:split_idx], X&#91;split_idx:]\n    y_train, y_test = y&#91;:split_idx], y&#91;split_idx:]\n    test_dates = dates&#91;split_idx:]\n    \n    # Train model\n    model = RandomForestRegressor(n_estimators=100, random_state=42)\n    model.fit(X_train, y_train)\n    \n    # Make predictions\n    y_pred = model.predict(X_test)\n    score = model.score(X_test, y_test)\n    \n    return model, X_test, y_test, y_pred, test_dates, score\n\n# Example usage\napi_key = \"demo\"\nsymbol = \"AAPL\"\nend_date = datetime.now()\nstart_date = end_date - timedelta(days=365)\n\n# Get data\nstock_data = get_stock_data(symbol, start_date.strftime('%Y-%m-%d'), \n                            end_date.strftime('%Y-%m-%d'), api_key)\nsentiment_data = get_sentiment_data(symbol, start_date.strftime('%Y-%m-%d'),end_date.strftime('%Y-%m-%d'), api_key)\n\n# Prepare data\nX, y = prepare_data_with_sentiment(stock_data, sentiment_data)\ndates = stock_data.index&#91;30:]  # Adjust for lookback period\n\n# Train model and get predictions with dates\nmodel, X_test, y_test, y_pred, test_dates, score = train_model_with_dates(X, y, dates)\n\nprint(f\"Model Score with Sentiment Features: {score:.4f}\")\n\n# Calculate error metrics\nmse = np.mean((y_test - y_pred) ** 2)\nrmse = np.sqrt(mse)\nmae = np.mean(np.abs(y_test - y_pred))\n\nprint(f\"Root Mean Square Error: ${rmse:.2f}\")\nprint(f\"Mean Absolute Error: ${mae:.2f}\")<\/code><\/pre>\n\n\n\n<p id=\"ef4d\">\u4f7f\u7528 EODHDs \u60c5\u611f\u6570\u636e\u7684\u9884\u6d4b\u6a21\u578b\u7ed3\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"927b\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.readmedium.com\/v2\/resize:fit:800\/0*FudSHkxeUZaDtE5e.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"3f43\">\u8fd9\u4e9b\u5e94\u7528\u51f8\u663e\u4e86 ML \u6a21\u578b\u4e0e EODHD \u9ad8\u8d28\u91cf\u8d22\u52a1\u6570\u636e\u76f8\u7ed3\u5408\u7684\u591a\u529f\u80fd\u6027\u548c\u4f18\u52bf\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"21b1\"><strong>\u4e94\u3001EODHD \u6570\u636e\u5728\u673a\u5668\u5b66\u4e60\u9879\u76ee\u4e2d\u7684\u5b9e\u9645\u5e94\u7528<\/strong><\/h2>\n\n\n\n<p id=\"f7ea\">\u4e3a\u4e86\u8bf4\u660e EODHD \u6570\u636e\u5728\u673a\u5668\u5b66\u4e60\u9879\u76ee\u4e2d\u7684\u5b9e\u9645\u5e94\u7528\uff0c\u4e0b\u9762\u5c06\u4ecb\u7ecd\u4e00\u4e9b\u516c\u53f8\u5982\u4f55\u5229\u7528\u8fd9\u4e9b\u6570\u636e\u4e3a\u5176\u91d1\u878d\u6280\u672f\u89e3\u51b3\u65b9\u6848\u63d0\u4f9b\u52a8\u529b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"9df1\"><strong>5.1 Eccuity<\/strong><\/h3>\n\n\n\n<p id=\"421f\">\u91d1\u878d\u79d1\u6280\u516c\u53f8 Eccuity \u5229\u7528 EODHD \u7684\u5168\u9762\u6570\u636e\u8fdb\u884c\u9ad8\u7ea7\u5206\u6790\u548c\u98ce\u9669\u7ba1\u7406\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5e02\u573a\u98ce\u9669\u8bc4\u4f30\uff1a<\/strong>Eccuity \u91c7\u7528\u6765\u81ea EODHD \u7684\u5386\u53f2\u4ef7\u683c\u6570\u636e\u548c\u6ce2\u52a8\u6027\u6307\u6807\u6765\u8bad\u7ec3\u8bc4\u4f30\u5404\u7c7b\u8d44\u4ea7\u98ce\u9669\u7684\u6a21\u578b\u3002<\/li>\n\n\n\n<li><strong>\u6295\u8d44\u7ec4\u5408\u4f18\u5316\uff1a<\/strong>\u901a\u8fc7\u7ed3\u5408 EODHD \u7684\u57fa\u672c\u9762\u6570\u636e\u548c\u6280\u672f\u6307\u6807\uff0cEccuity \u7684\u591a\u5c42\u9762\u6a21\u578b\u53ef\u5e2e\u52a9\u5ba2\u6237\u4f18\u5316\u5176\u6295\u8d44\u7ec4\u5408\u914d\u7f6e\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"d0b7\"><strong>5.2 Korzo<\/strong><\/h3>\n\n\n\n<p id=\"2e04\">\u7b97\u6cd5\u4ea4\u6613\u5e73\u53f0 Korzo \u6574\u5408\u4e86 EODHD \u6570\u636e\uff0c\u4ee5\u63d0\u9ad8\u4ea4\u6613\u6548\u7387\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4fe1\u53f7\u751f\u6210\uff1a<\/strong>Korzo \u7684\u6a21\u578b\u4f7f\u7528 EODHD \u7684\u5b9e\u65f6\u548c\u5386\u53f2\u6570\u636e\u6765\u8bc6\u522b\u4ea4\u6613\u4fe1\u53f7\u3002<\/li>\n\n\n\n<li><strong>\u56de\u6eaf\u6d4b\u8bd5\uff1a<\/strong>EODHD \u5e7f\u6cdb\u7684\u5386\u53f2\u6570\u636e\u4f7f Korzo \u80fd\u591f\u5bf9\u4ea4\u6613\u7b56\u7565\u8fdb\u884c\u4e25\u683c\u7684\u56de\u6eaf\u6d4b\u8bd5\u548c\u9a8c\u8bc1\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5f54\"><strong>5.3 Quinetics<\/strong><\/h3>\n\n\n\n<p id=\"04c6\">Quinetics \u4e13\u6ce8\u4e8e\u5b9a\u91cf\u4ea4\u6613\u7b56\u7565\uff0c\u5176 ML \u6a21\u578b\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u4f9d\u8d56\u4e8e EODHD \u6570\u636e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6280\u672f\u5206\u6790\uff1a<\/strong>Quinetics \u7684\u6a21\u578b\u4f7f\u7528 EODHD \u7684\u6280\u672f\u6307\u6807\u6765\u786e\u5b9a\u4ea4\u6613\u673a\u4f1a\u3002<\/li>\n\n\n\n<li><strong>\u57fa\u672c\u9762\u5206\u6790\uff1a<\/strong>EODHD \u7684\u57fa\u672c\u9762\u6570\u636e\u4f7f Quinetics \u80fd\u591f\u8bc4\u4f30\u80a1\u7968\u7684\u5185\u5728\u4ef7\u503c\u3002<\/li>\n\n\n\n<li><strong>\u60c5\u7eea\u5206\u6790\uff1a<\/strong>EODHD \u7684\u60c5\u7eea\u6570\u636e\u4e3a Quinetics \u7684\u5e02\u573a\u60c5\u7eea\u6a21\u578b\u63d0\u4f9b\u4fe1\u606f\uff0c\u4ee5\u8c03\u6574\u7b56\u7565\u3002<\/li>\n\n\n\n<li><strong>\u7ecf\u6d4e\u9884\u6d4b\uff1a<\/strong>EODHD \u7684\u5b8f\u89c2\u7ecf\u6d4e\u6570\u636e\u4e3a Quinetics \u9884\u6d4b\u66f4\u5e7f\u6cdb\u5e02\u573a\u8d8b\u52bf\u7684\u6a21\u578b\u63d0\u4f9b\u652f\u6301\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"742c\"><strong>\u516d\u3001EODHD \u6570\u636e\u5728\u673a\u5668\u5b66\u4e60\u9879\u76ee\u4e2d\u7684\u4f18\u52bf<\/strong><\/h2>\n\n\n\n<p id=\"a629\">EODHD \u7684\u6570\u636e\u63d0\u4f9b\u7cbe\u786e\u6027\u548c\u53ef\u8bbf\u95ee\u6027\uff0c\u5728\u8986\u76d6\u5168\u7403 70 \u591a\u4e2a\u4ea4\u6613\u6240\u7684\u6570\u636e\u96c6\u4e0a\u5b9e\u73b0\u4e86\u56db\u4f4d\u6570\u7684\u7cbe\u786e\u5ea6\uff0c\u4ece\u800c\u6539\u53d8\u4e86\u91d1\u878d\u673a\u5668\u5b66\u4e60\u7684\u5f00\u53d1\u65b9\u5f0f\u3002EODHD \u7684\u5e94\u7528\u7a0b\u5e8f\u63a5\u53e3\u652f\u6301\u6807\u51c6\u683c\u5f0f\uff0c\u4f7f\u91d1\u878d ML \u6a21\u578b\u5f00\u53d1\u53ef\u4ee5\u8f7b\u677e\u8bbf\u95ee\u9ad8\u8d28\u91cf\u6570\u636e\u3002<\/p>\n\n\n\n<p id=\"e878\">EODHD \u901a\u8fc7\u7ecf\u8fc7\u9a8c\u8bc1\u7684\u9884\u6e05\u7406\u6570\u636e\u96c6\uff08&nbsp;<a href=\"https:\/\/eodhd.com\/financial-academy\/financial-faq\/data-processing-in-delivering-high-quality-financial-data\"><strong>data preparation<\/strong><\/a>&nbsp;\uff09\u7b80\u5316\u4e86\u6570\u636e\u51c6\u5907\u5de5\u4f5c\uff0c\u51cf\u5c11\u4e86\u6570\u636e\u5904\u7406\u548c\u9a8c\u8bc1\u6240\u9700\u7684\u8d44\u6e90\u3002\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5229\u7528\u6df1\u5ea6\u5386\u53f2\u6570\u636e\u8fdb\u884c\u6a21\u5f0f\u8bc6\u522b\uff0c\u540c\u65f6\u5229\u7528\u5b9e\u65f6\u6570\u636e\u8fdb\u884c\u5f53\u524d\u5206\u6790\uff0c\u4ece\u800c\u5728 ML \u6a21\u578b\u4e2d\u5b9e\u73b0\u957f\u671f\u6218\u7565\u548c\u77ed\u671f\u54cd\u5e94\u7684\u5e73\u8861\u3002<\/p>\n\n\n\n<p id=\"5567\">\u9664\u5e02\u573a\u6570\u636e\u5916\uff0cEODHD \u7684\u5e73\u53f0\u8fd8\u63d0\u4f9b\u5168\u9762\u7684\u516c\u53f8\u7ea7\u4fe1\u606f\u548c\u60c5\u611f\u5206\u6790\uff08&nbsp;<a href=\"https:\/\/eodhd.com\/financial-apis\/\"><strong>company-level information<\/strong><\/a>\uff09\uff0c\u589e\u52a0\u4e86\u6a21\u578b\u5f00\u53d1\u7684\u6df1\u5ea6\u3002\u8fd9\u79cd\u6570\u636e\u57fa\u7840\u8bbe\u65bd\u4f7f\u4f01\u4e1a\u80fd\u591f\u7b80\u5316 ML \u5f00\u53d1\uff0c\u540c\u65f6\u4f18\u5148\u8003\u8651\u9ad8\u6570\u636e\u8d28\u91cf\u3002EODHD \u4f7f\u4f01\u4e1a\u80fd\u591f\u4e13\u6ce8\u4e8e\u5176\u4e3b\u8981\u76ee\u6807&#8211;\u6784\u5efa\u521b\u65b0\u3001\u6709\u6548\u7684\u91d1\u878d ML \u89e3\u51b3\u65b9\u6848\uff0c\u4ece\u800c\u63d0\u5347\u7ade\u4e89\u4f18\u52bf\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"b6eb\"><strong>\u4e03\u3001\u673a\u5668\u5b66\u4e60 EODHD \u5165\u95e8\u8bfe\u7a0b<\/strong><\/h2>\n\n\n\n<p id=\"1739\">EODHD \u63d0\u4f9b\u4e86\u4e00\u5957\u5f3a\u5927\u7684\u91d1\u878d API\uff0c\u975e\u5e38\u9002\u5408\u5404\u79cd\u673a\u5668\u5b66\u4e60\u9879\u76ee\u3002\u4ee5\u4e0b\u662f\u5173\u952e API \u7684\u7b80\u8981\u6982\u8ff0\uff0c\u4ee5\u53ca\u5982\u4f55\u5728 ML \u5e94\u7528\u7a0b\u5e8f\u4e2d\u5229\u7528\u8fd9\u4e9b API\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7.1 \u6bcf\u65e5\u6536\u76d8\uff08EOD\uff09\u5386\u53f2\u6570\u636e <\/strong><\/h3>\n\n\n\n<p>\u63d0\u4f9b\u5927\u91cf\u5386\u53f2\u5b9a\u4ef7\u6570\u636e\uff0c\u8fd9\u4e9b\u6570\u636e\u5bf9\u4e8e\u4fa7\u91cd\u4e8e\u957f\u671f\u8d8b\u52bf\u5206\u6790\u548c\u4ea4\u6613\u7b56\u7565\u56de\u6eaf\u6d4b\u8bd5\u7684\u6a21\u578b\u81f3\u5173\u91cd\u8981\u3002\u5c06\u5176\u4e0e\u57fa\u672c\u9762\u6307\u6807\u76f8\u7ed3\u5408\uff0c\u6709\u52a9\u4e8e\u5efa\u7acb\u66f4\u5177\u5f39\u6027\u7684\u9884\u6d4b\u6a21\u578b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731682298593.png\" alt=\"\" class=\"wp-image-2966\"\/><\/figure>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\">https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7.2 \u5b9e\u65f6\u6570\u636e<\/strong><\/h3>\n\n\n\n<p>\u901a\u8fc7 WebSockets \u5c06\u7f8e\u56fd\u5e02\u573a\u7684\u5b9e\u65f6\u91d1\u878d\u6570\u636e\u30011100 \u591a\u79cd\u5916\u6c47\u5bf9\u30011000 \u591a\u79cd\u6570\u5b57\u8d27\u5e01\u7eb3\u5165\uff0c\u5ef6\u8fdf\u4e0d\u5230<strong>50 \u6beb\u79d2<\/strong>\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731682660658.png\" alt=\"\" class=\"wp-image-2968\"\/><\/figure>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/new-real-time-data-api-websockets\">https:\/\/eodhd.com\/financial-apis\/new-real-time-data-api-websockets<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7.3 \u57fa\u672c\u6570\u636e<\/strong><\/h3>\n\n\n\n<p>\u63d0\u4f9b\u8be6\u7ec6\u7684\u516c\u53f8\u8d22\u52a1\u6307\u6807\uff0c\u662f\u4ef7\u503c\u6295\u8d44\u548c\u516c\u53f8\u4e1a\u7ee9\u9884\u6d4b\u6a21\u578b\u7684\u7406\u60f3\u9009\u62e9\u3002\u5c06\u8fd9\u4e9b\u6570\u636e\u4e0e\u60c5\u611f\u5206\u6790\u76f8\u7ed3\u5408\uff0c\u53ef\u5168\u9762\u4e86\u89e3\u516c\u53f8\u7684\u524d\u666f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731683076563.png\" alt=\"\" class=\"wp-image-2969\"\/><\/figure>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/stock-etfs-fundamental-data-feeds\">https:\/\/eodhd.com\/financial-apis\/stock-etfs-fundamental-data-feeds<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7.4 \u65e5\u5185\u5386\u53f2\u6570\u636e <\/strong><\/h3>\n\n\n\n<p>\u63d0\u4f9b\u8be6\u7ec6\u7684\u65f6\u95f4\u5e8f\u5217\u6570\u636e\uff0c\u9002\u7528\u4e8e\u9ad8\u9891\u4ea4\u6613\u6a21\u578b\u548c\u77ed\u671f\u4ef7\u683c\u8d70\u52bf\u5206\u6790\u3002\u4e0e\u6280\u672f\u6307\u6807\u642d\u914d\u4f7f\u7528\u65f6\uff0c\u8be5 API \u53ef\u63d0\u9ad8\u4ea4\u6613\u4fe1\u53f7\u7684\u51c6\u786e\u6027\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/11\/1731682435109.png\" alt=\"\" class=\"wp-image-2967\"\/><\/figure>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/intraday-historical-data-api\">https:\/\/eodhd.com\/financial-apis\/intraday-historical-data-api<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7.5 \u5176\u4ed6\u6570\u636e<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b9e\u65f6\uff08\u5ef6\u8fdf\uff09\u80a1\u7968\u4ef7\u683c API\uff1a<\/strong>\u652f\u6301\u5b9e\u65f6\u6a21\u578b\u63a8\u65ad\uff0c\u5b9e\u73b0\u52a8\u6001\u6295\u8d44\u7ec4\u5408\u518d\u5e73\u8861\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/live-realtime-stocks-api\">https:\/\/eodhd.com\/financial-apis\/live-realtime-stocks-api<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6280\u672f\u6307\u6807 API\uff1a<\/strong>\u63d0\u4f9b\u9884\u5148\u8ba1\u7b97\u7684\u6280\u672f\u6307\u6807\uff0c\u5bf9\u4ea4\u6613\u6a21\u578b\u5f88\u6709\u4ef7\u503c\u3002\u8bd5\u9a8c\u5404\u79cd\u6307\u6807\u7ec4\u5408\u6709\u52a9\u4e8e\u4f18\u5316\u6a21\u578b\u6027\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\">https:\/\/eodhd.com\/financial-apis\/technical-indicators-api<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u53e6\u7c7b\u6570\u636e\u5e94\u7528\u7a0b\u5e8f\u63a5\u53e3\uff08\u5305\u62ec\u60c5\u611f\u5206\u6790\uff09<\/strong>\uff1a\u5305\u62ec\u7ecf\u6d4e\u4e8b\u4ef6\u6570\u636e\u3001\u7ecf\u65b0\u95fb\u63d0\u8981\u548c\u80a1\u7968\u65b0\u95fb\u60c5\u7eea\u6570\u636e\u3001\u5b8f\u89c2\u6307\u6807\u548c\u5b8f\u89c2\u7ecf\u6d4e\u6570\u636e\u3002\u5f3a\u70c8\u5efa\u8bae\u4f7f\u7528 NLP \u6280\u672f\u6765\u8fdb\u4e00\u6b65\u5206\u6790\u6240\u63d0\u4f9b\u7684\u6587\u672c\u6570\u636e\u3002<\/li>\n<\/ul>\n\n\n\n<p id=\"9086\">\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/category\/alternative-data-financial-api\">https:\/\/eodhd.com\/financial-apis\/category\/alternative-data-financial-api<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6709\u5173 API \u4f7f\u7528\u548c\u6700\u4f73\u5b9e\u8df5\u7684\u5b8c\u6574\u8be6\u60c5\uff0c\u8bf7\u67e5\u9605 EODHD \u7684\u5b98\u65b9\u6587\u6863\u3002<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u5730\u5740\uff1a<a href=\"https:\/\/eodhd.com\/financial-apis\/\">https:\/\/eodhd.com\/financial-apis\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u516b\u3001\u89c2\u70b9\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<p id=\"a1c6\">\u672c\u6587\u4ecb\u7ecd\u4e86\u91d1\u878d\u9886\u57df\u7684\u673a\u5668\u5b66\u4e60\uff0c\u5c55\u793a\u4e86 EODHD \u7684\u7efc\u5408 API \u5982\u4f55\u652f\u6491\u5148\u8fdb\u7684\u91d1\u878d\u6280\u672f\u5e94\u7528\u3002\u4ece\u80a1\u7968\u4ef7\u683c\u9884\u6d4b\u5230\u590d\u6742\u7684\u7b97\u6cd5\u4ea4\u6613\u7cfb\u7edf\uff0c\u9ad8\u8d28\u91cf\u7684\u91d1\u878d\u6570\u636e\u5bf9\u4e8e\u521b\u5efa\u51c6\u786e\u53ef\u9760\u7684 ML \u6a21\u578b\u81f3\u5173\u91cd\u8981\u3002\u968f\u7740\u91d1\u878d\u79d1\u6280\u7684\u53d1\u5c55\uff0c\u673a\u5668\u5b66\u4e60\u4e0e\u8be6\u7ec6\u7684\u91d1\u878d\u6570\u636e\u76f8\u7ed3\u5408\u5c06\u7ee7\u7eed\u6210\u4e3a\u6838\u5fc3\u3002\u65e0\u8bba\u662f\u6784\u5efa\u4e2a\u4eba\u4ea4\u6613\u7b97\u6cd5\u3001\u91d1\u878d\u5206\u6790\u5e73\u53f0\uff0c\u8fd8\u662f\u4e0b\u4e00\u4e2a\u521b\u65b0\u91d1\u878d\u6280\u672f\u5e94\u7528\uff0cEODHD \u90fd\u662f\u503c\u5f97\u4e00\u8bd5\u7684\u9009\u62e9\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u91d1\u878d\u6570\u636e\u7684\u8d28\u91cf\u5bf9\u4e8e\u8bad\u7ec3\u6709\u6548\u7684 ML \u6a21\u578b\u81f3\u5173\u91cd\u8981<\/strong>\u3002EODHD \u63d0\u4f9b\u7684\u6570\u636e\u96c6\u5177\u6709\u9ad8\u51c6\u786e\u6027\u548c\u5e7f\u6cdb\u7684\u8986\u76d6\u8303\u56f4\uff0c\u662f\u6784\u5efa\u9ad8\u8d28\u91cf ML \u6a21\u578b\u7684\u57fa\u7840\u3002<\/li>\n\n\n\n<li><strong>EODHD \u6570\u636e\u7684\u591a\u6837\u6027\u548c\u5168\u9762\u6027<\/strong>&nbsp;\u4f7f\u5f97\u5b83\u80fd\u591f\u652f\u6301\u591a\u79cd\u91d1\u878d ML \u5e94\u7528\uff0c\u5305\u62ec\u80a1\u7968\u4ef7\u683c\u9884\u6d4b\u3001\u5e02\u573a\u8d8b\u52bf\u5206\u6790\u3001\u98ce\u9669\u7ba1\u7406\u3001\u7b97\u6cd5\u4ea4\u6613\u548c\u6295\u8d44\u7ec4\u5408\u4f18\u5316\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u7ed3\u5408 EODHD \u7684\u60c5\u7eea\u6570\u636e\u53ef\u4ee5\u589e\u5f3a ML \u6a21\u578b\u7684\u9884\u6d4b\u80fd\u529b<\/strong>\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u5e02\u573a\u60c5\u7eea\u7684\u91cf\u5316\u6307\u6807\uff0c\u8fd9\u5bf9\u4e8e\u7406\u89e3\u5e02\u573a\u52a8\u6001\u548c\u8c03\u6574\u4ea4\u6613\u7b56\u7565\u81f3\u5173\u91cd\u8981\u3002<\/li>\n\n\n\n<li><strong>EODHD \u7684 API \u7b80\u5316\u4e86\u6570\u636e\u7684\u83b7\u53d6\u548c\u5904\u7406<\/strong>\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u5feb\u5730\u8fdb\u884c\u6570\u636e\u5206\u6790\u548c\u6a21\u578b\u8bad\u7ec3\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\u3002<\/li>\n\n\n\n<li><strong>\u91d1\u878d\u79d1\u6280\u7684\u53d1\u5c55\u8d8b\u52bf\u8868\u660e<\/strong>\uff0c\u673a\u5668\u5b66\u4e60\u4e0e\u8be6\u5c3d\u7684\u91d1\u878d\u6570\u636e\u76f8\u7ed3\u5408\u5c06\u7ee7\u7eed\u5728\u91d1\u878d\u9886\u57df\u4e2d\u53d1\u6325\u6838\u5fc3\u4f5c\u7528\uff0c\u63a8\u52a8\u521b\u65b0\u548c\u7ade\u4e89\u529b\u7684\u63d0\u5347\u3002<\/li>\n\n\n\n<li><strong>\u5f00\u53d1\u8005\u548c\u72ec\u7acb\u4ea4\u6613\u8005\u90fd\u5e94\u8be5\u5229\u7528 EODHD \u7684\u6570\u636e\u548c\u8d44\u6e90<\/strong>\uff0c\u4ee5\u6784\u5efa\u66f4\u52a0\u521b\u65b0\u548c\u6709\u6548\u7684\u91d1\u878d ML \u89e3\u51b3\u65b9\u6848\uff0c\u4ece\u800c\u5728\u7ade\u4e89\u6fc0\u70c8\u7684\u91d1\u878d\u5e02\u573a\u4e2d\u83b7\u5f97\u4f18\u52bf\u3002<\/li>\n<\/ul>\n\n\n\n<p id=\"a1c6\">\u70b9\u51fb\u4e0b\u9762\u7684\u94fe\u63a5\uff0c\u60a8\u53ef\u4ee5\u627e\u5230\u5305\u542b\u672c\u6587\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u7684 Google \u7b14\u8bb0\u672c\u3002<\/p>\n\n\n\n<p id=\"a1c6\"><a href=\"https:\/\/colab.research.google.com\/drive\/1JAVuecGM1uGqD_yUSj5JR_0W58qeHCg_?usp=sharing\">https:\/\/colab.research.google.com\/drive\/1JAVuecGM1uGqD_yUSj5JR_0W58qeHCg_?usp=sharing<\/a><\/p>\n\n\n\n<p>\u611f\u8c22\u60a8\u9605\u8bfb\u5230\u6700\u540e\uff0c\u5e0c\u671b\u672c\u6587\u80fd\u7ed9\u60a8\u5e26\u6765\u65b0\u7684\u6536\u83b7\u3002\u795d\u60a8\u6295\u8d44\u987a\u5229\uff01\u5982\u679c\u5bf9\u6587\u4e2d\u7684\u5185\u5bb9\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u8bf7\u7ed9\u6211\u7559\u8a00\uff0c\u5fc5\u590d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-center\" id=\"a1c6\"><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u672c\u6587\u5185\u5bb9\u4ec5\u4ec5\u662f\u6280\u672f\u63a2\u8ba8\u548c\u5b66\u4e60\uff0c\u5e76\u4e0d\u6784\u6210\u4efb\u4f55\u6295\u8d44\u5efa\u8bae\u3002<\/mark><\/strong><\/p>\n\n\n\n<p><\/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\/2024\/12\/10\/%e8%b7%a8%e7%95%8c%e5%ad%a6%e4%b9%a0%e5%bf%85%e5%a4%87%ef%bc%81%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e9%87%91%e8%9e%8d%e6%95%b0%e6%8d%ae%e8%ae%ad%e7%bb%83ml-%e6%a8%a1%e5%9e%8b\/\">Continue reading<span class=\"screen-reader-text\">\u8de8\u754c\u5b66\u4e60\u5fc5\u5907\uff01\u5982\u4f55\u5229\u7528\u91d1\u878d\u6570\u636e\u8bad\u7ec3ML \u6a21\u578b<\/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":[4,5],"class_list":{"0":"post-1704","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-aiinvest","7":"tag-ai","9":"entry"},"_links":{"self":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1704","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=1704"}],"version-history":[{"count":1,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1704\/revisions"}],"predecessor-version":[{"id":1705,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1704\/revisions\/1705"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=1704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=1704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}