{"id":692,"date":"2024-07-17T07:05:00","date_gmt":"2024-07-16T23:05:00","guid":{"rendered":"http:\/\/123.60.176.65\/?p=692"},"modified":"2024-07-17T07:05:00","modified_gmt":"2024-07-16T23:05:00","slug":"%e6%89%8b%e6%8a%8a%e6%89%8b%e6%95%99%e4%bd%a0ai%e9%a1%be%e6%8a%95%ef%bc%9a%e8%ae%ad%e7%bb%83-ai-%e7%9c%8b%e7%a9%bf%e4%ba%a4%e6%98%93%e6%94%af%e6%92%91%e4%b8%8e%e9%98%bb%e5%8a%9b%e7%9a%84%e7%a7%98","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2024\/07\/17\/%e6%89%8b%e6%8a%8a%e6%89%8b%e6%95%99%e4%bd%a0ai%e9%a1%be%e6%8a%95%ef%bc%9a%e8%ae%ad%e7%bb%83-ai-%e7%9c%8b%e7%a9%bf%e4%ba%a4%e6%98%93%e6%94%af%e6%92%91%e4%b8%8e%e9%98%bb%e5%8a%9b%e7%9a%84%e7%a7%98\/","title":{"rendered":"\u624b\u628a\u624b\u6559\u4f60ai\u987e\u6295\uff1a\u8bad\u7ec3 AI \u770b\u7a7f\u4ea4\u6613\u652f\u6491\u4e0e\u963b\u529b\u7684\u79d8\u8bc0\u5927\u516c\u5f00"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"http:\/\/123.60.176.65\/wp-content\/uploads\/2024\/07\/e3ce52c52d99af4d70964888b507a6a2_1720186925.webp\" alt=\"\" class=\"wp-image-704\"\/><\/figure>\n<\/div>\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>\u5728\u4ea4\u6613\u4e0e\u6280\u672f\u5206\u6790\u7684\u8fbd\u9614\u9886\u57df\u91cc\uff0c\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u65e0\u7591\u662f\u4ea4\u6613\u8005\u4f5c\u51fa\u777f\u667a\u51b3\u7b56\u7684\u91cd\u8981\u57fa\u77f3\u3002\u5b83\u4eec\u662f\u8d44\u4ea7\u4ef7\u683c\u53ef\u80fd\u51fa\u73b0\u8f6c\u5411\u7684\u6f5c\u5728\u6807\u8bc6\u3002\u652f\u6491\u4f4d\u72b9\u5982\u6709\u529b\u7684\u4e0b\u9650\u4fdd\u969c\uff0c\u6709\u6548\u963b\u6b62\u4ef7\u683c\u7ee7\u7eed\u4e0b\u8dcc\uff1b\u963b\u529b\u4f4d\u6070\u4f3c\u96be\u4ee5\u7a81\u7834\u7684\u4e0a\u9650\u9650\u5236\uff0c\u7262\u7262\u9650\u5236\u7740\u4ef7\u683c\u7684\u4e0a\u5347\u3002\u51c6\u786e\u5224\u5b9a\u8fd9\u4e9b\u6c34\u5e73\uff0c\u80fd\u591f\u7ed9\u4ea4\u6613\u8005\u63d0\u4f9b\u5173\u4e8e\u5e02\u573a\u8d8b\u52bf\u548c\u6f5c\u5728\u8fdb\u51fa\u70b9\u7684\u5b9d\u8d35\u770b\u6cd5\u3002\u5728\u672c\u6587\u5f53\u4e2d\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u6211\u4eec\u5c06\u6df1\u5165\u5256\u6790\u5982\u4f55\u901a\u8fc7\u7b80\u5355\u7f16\u7a0b\u4e0e\u6570\u636e\u8bad\u7ec3\uff0c\u4f9d\u7167\u5386\u53f2\u80a1\u7968\u6570\u636e\u786e\u5b9a\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u3002<\/mark>\u6211\u4eec\u4f1a\u5faa\u5e8f\u6e10\u8fdb\u5730\u5b8c\u6210\u83b7\u53d6\u6570\u636e\u3001\u68b3\u7406\u6570\u636e\u5e76\u5728\u4ef7\u683c\u56fe\u8868\u4e0a\u628a\u8fd9\u4e9b\u5173\u952e\u6c34\u5e73\u52a0\u4ee5\u53ef\u89c6\u5316\u7684\u64cd\u4f5c\u6b65\u9aa4\u3002<\/pre>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e00\u3001\u57fa\u7840\u7406\u8bba<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u652f\u6491\uff08Support\uff09\uff1a<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u652f\u6491\u662f\u80a1\u4ef7\u4e0b\u65b9\u7684\u4e00\u4e2a\u533a\u57df\uff0c\u901a\u5e38\u662f\u4ef7\u683c\u5728\u4e0b\u8dcc\u8fc7\u7a0b\u4e2d\u505c\u6b62\u4e0b\u8dcc\u5e76\u5f00\u59cb\u53cd\u5f39\u7684\u5730\u65b9\u3002<\/li>\n\n\n\n<li>\u5728\u652f\u6491\u4e0b\u65b9\uff0c\u4e70\u65b9\u529b\u91cf\u5f3a\u5927\uff0c\u8db3\u4ee5\u62b5\u6297\u5356\u65b9\u538b\u529b\uff0c\u4ece\u800c\u51cf\u7f13\u80a1\u4ef7\u7684\u4e0b\u8dcc\u901f\u5ea6\u3002<\/li>\n\n\n\n<li>\u5f53\u80a1\u4ef7\u5728\u652f\u6491\u533a\u57df\u5f62\u6210\u4e00\u4e2a\u5411\u4e0a\u53cd\u5f39\u7684\u4f4e\u70b9\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u5b9a\u4e00\u4e2a\u652f\u6491\u6c34\u5e73\u3002<\/li>\n\n\n\n<li>\u652f\u6491\u4f4d\u4e0d\u4ec5\u4ec5\u662f\u5355\u4e00\u4ef7\u683c\uff0c\u800c\u662f\u4e00\u4e2a\u533a\u57df\uff0c\u56e0\u4e3a\u4ef7\u683c\u7684\u8fd0\u52a8\u60ef\u6027\u4f1a\u5728\u4e00\u5b9a\u8303\u56f4\u5185\u53d1\u751f\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u963b\u529b\uff08Resistance\uff09\uff1a<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u963b\u529b\u662f\u80a1\u4ef7\u4e0a\u65b9\u7684\u4e00\u4e2a\u533a\u57df\uff0c\u901a\u5e38\u662f\u4ef7\u683c\u5728\u4e0a\u6da8\u8fc7\u7a0b\u4e2d\u53d7\u5230\u538b\u529b\u800c\u505c\u6b62\u4e0a\u6da8\u7684\u5730\u65b9\u3002<\/li>\n\n\n\n<li>\u5728\u963b\u529b\u4e0a\u65b9\uff0c\u5356\u65b9\u538b\u529b\u963b\u6b62\u4e86\u56e0\u4e70\u65b9\u8d2d\u4e70\u800c\u5f62\u6210\u7684\u4e0a\u6da8\u529b\u91cf\uff0c\u5bfc\u81f4\u80a1\u4ef7\u7531\u5347\u8f6c\u8dcc\u3002<\/li>\n\n\n\n<li>\u963b\u529b\u4f4d\u4e5f\u662f\u4e00\u4e2a\u533a\u57df\uff0c\u4e0d\u4ec5\u4ec5\u662f\u5355\u4e00\u4ef7\u683c\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u652f\u6491\u548c\u963b\u529b\u7684\u76f8\u4e92\u8f6c\u6362\uff1a<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5f53\u80a1\u4ef7\u4ece\u4e0a\u5411\u4e0b\u8dcc\u7834\u652f\u6491\u540e\uff0c\u539f\u6709\u7684\u652f\u6491\u53ef\u80fd\u8f6c\u53d8\u4e3a\u963b\u529b\u3002<\/li>\n\n\n\n<li>\u53cd\u4e4b\uff0c\u5f53\u80a1\u4ef7\u4ece\u4e0b\u5411\u4e0a\u7a81\u7834\u963b\u529b\u540e\uff0c\u539f\u6709\u7684\u963b\u529b\u53ef\u80fd\u8f6c\u53d8\u4e3a\u652f\u6491\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><strong>\u4e0d\u7ba1\u662f\u652f\u6491\u8fd8\u662f\u963b\u529b\uff0c\u5b9e\u9645\u90fd\u662f\u5e02\u573a\u4e0a\u4ea4\u6613\u8005\u5fc3\u7406\u535a\u5f08\u5f62\u6210\u7684\uff0c\u53ea\u8981\u76f8\u4fe1\u652f\u6491\u6216\u8005\u963b\u529b\u7684\u4ea4\u6613\u8005\u8d8a\u591a\uff0c\u90a3\u4e48\u5b83\u6210\u7acb\u7684\u6982\u7387\u4e5f\u5c31\u8d8a\u5927\u3002<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/123.60.176.65\/wp-content\/uploads\/2024\/07\/640-1.png\" alt=\"\" class=\"wp-image-693\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u8bbe\u7f6e\u73af\u5883<\/strong><br><\/h3>\n\n\n\n<p>\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u5b89\u88c5\u4e86\u5fc5\u8981\u7684\u5e93\u3002\u4f7f\u7528 pip \u5b89\u88c5\u5b83\u4eec\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install yfinance pandas matplotlib<\/code><\/pre>\n\n\n\n<p><strong>1.\u83b7\u53d6\u5386\u53f2\u80a1\u7968\u6570\u636e<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u5c06\u7528\u4e8e\u83b7\u53d6\u7279\u5b9a\u80a1\u7968\u7684\u5386\u53f2\u6570\u636e\u3002\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u82f9\u679c\u516c\u53f8\u4f5c\u4e3a\u6211\u4eec\u7684\u76ee\u6807\u80a1\u7968\u3002<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code\"><code>import yfinance as yf\nFetch historical data\nticker = 'AAPL'data\n= yf.download\uff08ticker\uff0c start='2015-01-01'\uff0c end='2023-01-01')<\/code><\/pre>\n\n\n\n<p><strong>2.\u8ba1\u7b97\u5206\u6790\u5468\u671f<\/strong><\/p>\n<\/div><\/div>\n\n\n\n<p>\u4e3a\u4e86\u786e\u5b9a\u91cd\u8981\u7684\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\uff0c\u6211\u4eec\u5c06\u8ba1\u7b97\u76f8\u5f53\u4e8e\u6570\u636e\u96c6\u4e2d\u603b\u4ea4\u6613\u65e510%\u7684\u65f6\u95f4\u6bb5\u3002\u8fd9\u6bb5\u65f6\u95f4\u5c06\u5e2e\u52a9\u6211\u4eec\u786e\u5b9a\u5206\u6790\u7684\u7a97\u53e3\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\ntotal_days = data.shape&#91;0]\nperiod = int(total_days * 0.10) \/\/ 2<\/code><\/pre>\n\n\n\n<p><strong>3.\u786e\u5b9a\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u5c06\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6765\u8bc6\u522b\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u3002\u5982\u679c\u5f53\u5929\u7684\u4f4e\u4ef7\u662f\u5c45\u4e2d\u5929\u7a97\u53e3\u5185\u7684\u6700\u4f4e\u4ef7\u683c\uff0c\u5219\u786e\u5b9a\u652f\u6491\u4f4d\u3002\u540c\u6837\uff0c\u5982\u679c\u5f53\u5929\u7684\u6700\u9ad8\u4ef7\u662f\u540c\u4e00\u7a97\u53e3\u4e2d\u7684\u6700\u9ad8\u4ef7\uff0c\u5219\u786e\u5b9a\u963b\u529b\u4f4d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def identify_support_resistance(df, period):\n    support_levels = &#91;]\n    resistance_levels = &#91;]\n    \n    for i in range(period, len(df) - period):\n        # Find the lowest low and highest high in the past '2*period' days centered around 'i'\n        low_period = df&#91;'Low']&#91;i-period:i+period+1].min()\n        high_period = df&#91;'High']&#91;i-period:i+period+1].max()\n        \n        # Check if the current low is the lowest low in the centered period\n        if df&#91;'Low']&#91;i] == low_period:\n            support_levels.append((i, df&#91;'Low']&#91;i]))\n        \n        # Check if the current high is the highest high in the centered period\n        if df&#91;'High']&#91;i] == high_period:\n            resistance_levels.append((i, df&#91;'High']&#91;i]))\n    \n    return support_levels, resistance_levels\n\n# Identify support and resistance levels\nsupport_levels, resistance_levels = identify_support_resistance(data, period)\n\n# Print identified levels\nprint(\"Identified Support Levels (Index, Price):\")\nfor level in support_levels:\n    print(level)\n\nprint(\"\\nIdentified Resistance Levels (Index, Price):\")\nfor level in resistance_levels:\n    print(level)<\/code><\/pre>\n\n\n\n<p><strong>4.\u53ef\u89c6\u5316\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d<\/strong><\/p>\n\n\n\n<p>\u4e3a\u4e86\u4f7f\u6211\u4eec\u7684\u5206\u6790\u66f4\u52a0\u76f4\u89c2\uff0c\u6211\u4eec\u5c06\u7ed8\u5236\u80a1\u7968\u7684\u6536\u76d8\u4ef7\u4ee5\u53ca\u786e\u5b9a\u7684\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Plotting the data with support and resistance levels\nplt.figure(figsize=(12, 6))\nplt.plot(data&#91;'Close'], label='Close Price', color='blue')\n\n# Add horizontal lines for support and resistance levels\nfor level in support_levels:\n    plt.axhline(y=level&#91;1], linestyle='--', color='green', alpha=0.7, label='Support' if 'Support' not in plt.gca().get_legend_handles_labels()&#91;1] else \"\")\nfor level in resistance_levels:\n    plt.axhline(y=level&#91;1], linestyle='--', color='red', alpha=0.7, label='Resistance' if 'Resistance' not in plt.gca().get_legend_handles_labels()&#91;1] else \"\")\n\n# Add legend\nplt.legend()\n\nplt.title(f'Support and Resistance Levels for {ticker}')\nplt.xlabel('Date')\nplt.ylabel('Price')\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong>5.\u89e3\u91ca\u7ed3\u679c<\/strong><\/p>\n\n\n\n<p>\u901a\u8fc7\u68c0\u67e5\u7ed8\u5236\u7684\u56fe\u8868\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u5982\u4f55\u4e0e\u80a1\u7968\u7684\u4ef7\u683c\u8d70\u52bf\u4fdd\u6301\u4e00\u81f4\u3002\u8fd9\u4e9b\u6c34\u5e73\u53ef\u4ee5\u4f5c\u4e3a\u4e70\u5165\uff08\u63a5\u8fd1\u652f\u6491\u4f4d\uff09\u6216\u5356\u51fa\uff08\u63a5\u8fd1\u963b\u529b\u4f4d\uff09\u7684\u6f5c\u5728\u6307\u6807\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e09\u3001<strong>\u7ed3\u8bba<\/strong><\/h3>\n\n\n\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528 Python\u7b80\u5355\u7a0b\u5e8f \u4ee5\u53ca\u8bc6\u522b\u548c\u53ef\u89c6\u5316\u7ed9\u5b9a\u80a1\u7968\u7684\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u3002\u901a\u8fc7\u5c06\u6b64\u65b9\u6cd5\u5e94\u7528\u4e8e\u60a8\u7684\u5206\u6790\uff0c\u60a8\u53ef\u4ee5\u66f4\u6df1\u5165\u5730\u4e86\u89e3\u5e02\u573a\u8d8b\u52bf\u5e76\u505a\u51fa\u66f4\u660e\u667a\u7684\u4ea4\u6613\u51b3\u7b56\u3002\u7a0b\u5e8f\u7684\u7075\u6d3b\u6027\u5141\u8bb8\u60a8\u6839\u636e\u81ea\u5df1\u7684\u7279\u5b9a\u9700\u6c42\u548c\u4ea4\u6613\u7b56\u7565\u8c03\u6574\u548c\u589e\u5f3a\u8fd9\u79cd\u65b9\u6cd5\u3002\u8bf7\u8bb0\u4f4f\uff0c\u867d\u7136\u652f\u6491\u4f4d\u548c\u963b\u529b\u4f4d\u7b49\u6280\u672f\u5206\u6790\u5de5\u5177\u53ef\u4ee5\u63d0\u4f9b\u6709\u4ef7\u503c\u7684\u89c1\u89e3\uff0c\u4f46\u5b83\u4eec\u53ea\u662f\u7efc\u5408\u4ea4\u6613\u7b56\u7565\u7684\u4e00\u90e8\u5206\u3002\u5728\u505a\u51fa\u4efb\u4f55\u4ea4\u6613\u51b3\u5b9a\u4e4b\u524d\uff0c\u8bf7\u52a1\u5fc5\u8003\u8651\u591a\u79cd\u56e0\u7d20\u5e76\u8fdb\u884c\u5f7b\u5e95\u7684\u7814\u7a76\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-bd402b7c146898dcf3d05749282e5860\"><strong>\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<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5199\u5728\u524d\u9762\u7684\u8bdd\uff1a\u5728\u4ea4\u6613\u4e0e\u6280\u672f\u5206\u6790\u7684\u8fbd\u9614\u9886\u57df\u91cc\uff0c\u652f\u6491\u4f4d&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/laoyulaoyu.com\/index.php\/2024\/07\/17\/%e6%89%8b%e6%8a%8a%e6%89%8b%e6%95%99%e4%bd%a0ai%e9%a1%be%e6%8a%95%ef%bc%9a%e8%ae%ad%e7%bb%83-ai-%e7%9c%8b%e7%a9%bf%e4%ba%a4%e6%98%93%e6%94%af%e6%92%91%e4%b8%8e%e9%98%bb%e5%8a%9b%e7%9a%84%e7%a7%98\/\">Continue reading<span class=\"screen-reader-text\">\u624b\u628a\u624b\u6559\u4f60ai\u987e\u6295\uff1a\u8bad\u7ec3 AI \u770b\u7a7f\u4ea4\u6613\u652f\u6491\u4e0e\u963b\u529b\u7684\u79d8\u8bc0\u5927\u516c\u5f00<\/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":[5],"class_list":["post-692","post","type-post","status-publish","format-standard","hentry","category-aiinvest","tag-ai","entry"],"_links":{"self":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/692","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=692"}],"version-history":[{"count":0,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/692\/revisions"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}