{"id":1043574,"date":"2024-12-31T13:07:17","date_gmt":"2024-12-31T05:07:17","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1043574.html"},"modified":"2024-12-31T13:07:19","modified_gmt":"2024-12-31T05:07:19","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e6%b1%82%e8%82%a1%e7%a5%a8%e6%94%b6%e7%9b%8a%e7%8e%87","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1043574.html","title":{"rendered":"\u5982\u4f55\u7528python\u6c42\u80a1\u7968\u6536\u76ca\u7387"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/32aed0a1-0d49-4698-92ff-712928e98022.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u7528python\u6c42\u80a1\u7968\u6536\u76ca\u7387\" \/><\/p>\n<p><p> <strong>\u7528Python\u6c42\u80a1\u7968\u6536\u76ca\u7387\u7684\u65b9\u6cd5\u4e3b\u8981\u6709\uff1a\u4e0b\u8f7d\u80a1\u7968\u6570\u636e\u3001\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\u3001\u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387\u3001\u5206\u6790\u548c\u53ef\u89c6\u5316\u7ed3\u679c<\/strong>\u3002\u5176\u4e2d\uff0c\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\u662f\u6700\u5173\u952e\u7684\u4e00\u6b65\u3002\u6bcf\u65e5\u6536\u76ca\u7387\u662f\u5f53\u524d\u80a1\u7968\u4ef7\u683c\u4e0e\u524d\u4e00\u5929\u80a1\u7968\u4ef7\u683c\u7684\u6bd4\u503c\u51cf\u53bb1\uff0c\u53ef\u4ee5\u7528\u516c\u5f0f\u8868\u793a\u4e3a\uff1a<code>(P_t - P_(t-1)) \/ P_(t-1)<\/code>\uff0c\u5176\u4e2d<code>P_t<\/code>\u8868\u793a\u7b2ct\u5929\u7684\u80a1\u7968\u4ef7\u683c\uff0c<code>P_(t-1)<\/code>\u8868\u793a\u7b2ct-1\u5929\u7684\u80a1\u7968\u4ef7\u683c\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Python\u8ba1\u7b97\u80a1\u7968\u6536\u76ca\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4e0b\u8f7d\u80a1\u7968\u6570\u636e<\/h3>\n<\/p>\n<p><p>\u8981\u8ba1\u7b97\u80a1\u7968\u6536\u76ca\u7387\uff0c\u9996\u5148\u9700\u8981\u83b7\u53d6\u80a1\u7968\u7684\u5386\u53f2\u6570\u636e\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>yfinance<\/code>\u5e93\u6765\u4e0b\u8f7d\u80a1\u7968\u6570\u636e\u3002<code>yfinance<\/code>\u662f\u4e00\u4e2a\u65b9\u4fbf\u7684\u5e93\uff0c\u53ef\u4ee5\u4eceYahoo Finance\u83b7\u53d6\u80a1\u7968\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import yfinance as yf<\/p>\n<h2><strong>\u4e0b\u8f7d\u80a1\u7968\u6570\u636e<\/strong><\/h2>\n<p>ticker = &#39;AAPL&#39;  # \u66ff\u6362\u4e3a\u4f60\u611f\u5174\u8da3\u7684\u80a1\u7968\u4ee3\u7801<\/p>\n<p>stock_data = yf.download(ticker, start=&#39;2020-01-01&#39;, end=&#39;2023-01-01&#39;)<\/p>\n<p>print(stock_data.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u9762\u7684\u4ee3\u7801\u5c06\u4e0b\u8f7d\u82f9\u679c\u516c\u53f8\uff08AAPL\uff09\u7684\u80a1\u7968\u6570\u636e\uff0c\u4ece2020\u5e741\u67081\u65e5\u52302023\u5e741\u67081\u65e5\u3002\u7ed3\u679c\u5c06\u5b58\u50a8\u5728<code>stock_data<\/code>\u4e2d\uff0c\u8fd9\u4e2a\u6570\u636e\u6846\u5305\u542b\u4e86\u65e5\u671f\u3001\u5f00\u76d8\u4ef7\u3001\u6700\u9ad8\u4ef7\u3001\u6700\u4f4e\u4ef7\u3001\u6536\u76d8\u4ef7\u3001\u8c03\u6574\u6536\u76d8\u4ef7\u548c\u6210\u4ea4\u91cf\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387<\/h3>\n<\/p>\n<p><p>\u83b7\u53d6\u5230\u80a1\u7968\u6570\u636e\u540e\uff0c\u53ef\u4ee5\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\u3002\u6bcf\u65e5\u6536\u76ca\u7387\u516c\u5f0f\u4e3a\uff1a<code>(P_t - P_(t-1)) \/ P_(t-1)<\/code>\u3002\u6211\u4eec\u53ef\u4ee5\u7528Pandas\u5e93\u6765\u65b9\u4fbf\u5730\u5b9e\u73b0\u8fd9\u4e00\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387<\/strong><\/h2>\n<p>stock_data[&#39;D<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ly Return&#39;] = stock_data[&#39;Adj Close&#39;].pct_change()<\/p>\n<p>print(stock_data[[&#39;Adj Close&#39;, &#39;Daily Return&#39;]].head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86<code>pct_change()<\/code>\u65b9\u6cd5\u6765\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\uff0c\u5e76\u5c06\u7ed3\u679c\u5b58\u50a8\u5728\u65b0\u5217<code>Daily Return<\/code>\u4e2d\u3002<code>pct_change()<\/code>\u65b9\u6cd5\u5c06\u5f53\u524d\u884c\u7684\u503c\u4e0e\u524d\u4e00\u884c\u7684\u503c\u8fdb\u884c\u6bd4\u8f83\uff0c\u5e76\u8ba1\u7b97\u51fa\u767e\u5206\u6bd4\u53d8\u5316\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387<\/h3>\n<\/p>\n<p><p>\u7d2f\u8ba1\u6536\u76ca\u7387\u8868\u793a\u6295\u8d44\u4ece\u5f00\u59cb\u5230\u7ed3\u675f\u7684\u603b\u6536\u76ca\u7387\uff0c\u53ef\u4ee5\u901a\u8fc7\u5c06\u6bcf\u65e5\u6536\u76ca\u7387\u7d2f\u79ef\u76f8\u4e58\u5f97\u5230\u3002\u7d2f\u8ba1\u6536\u76ca\u7387\u516c\u5f0f\u4e3a\uff1a<code>(1 + r_t) * (1 + r_(t-1)) * ... * (1 + r_1) - 1<\/code>\uff0c\u5176\u4e2d<code>r_t<\/code>\u8868\u793a\u7b2ct\u5929\u7684\u6bcf\u65e5\u6536\u76ca\u7387\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387<\/p>\n<p>stock_data[&#39;Cumulative Return&#39;] = (1 + stock_data[&#39;Daily Return&#39;]).cumprod() - 1<\/p>\n<p>print(stock_data[[&#39;Adj Close&#39;, &#39;Cumulative Return&#39;]].head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>cumprod()<\/code>\u65b9\u6cd5\u6765\u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387\uff0c\u5e76\u5c06\u7ed3\u679c\u5b58\u50a8\u5728\u65b0\u5217<code>Cumulative Return<\/code>\u4e2d\u3002<code>cumprod()<\/code>\u65b9\u6cd5\u5c06\u5f53\u524d\u884c\u7684\u503c\u4e0e\u524d\u9762\u6240\u6709\u884c\u7684\u503c\u76f8\u4e58\uff0c\u5e76\u8ba1\u7b97\u7d2f\u8ba1\u4e58\u79ef\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5206\u6790\u548c\u53ef\u89c6\u5316\u7ed3\u679c<\/h3>\n<\/p>\n<p><p>\u8ba1\u7b97\u51fa\u6bcf\u65e5\u6536\u76ca\u7387\u548c\u7d2f\u8ba1\u6536\u76ca\u7387\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u7ed3\u679c\u8fdb\u884c\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002\u53ef\u4ee5\u4f7f\u7528Matplotlib\u548cSeaborn\u5e93\u6765\u7ed8\u5236\u56fe\u8868\uff0c\u76f4\u89c2\u5730\u5c55\u793a\u80a1\u7968\u7684\u6536\u76ca\u7387\u53d8\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import seaborn as sns<\/p>\n<h2><strong>\u8bbe\u7f6e\u56fe\u8868\u98ce\u683c<\/strong><\/h2>\n<p>sns.set(style=&#39;whitegrid&#39;)<\/p>\n<h2><strong>\u7ed8\u5236\u6bcf\u65e5\u6536\u76ca\u7387\u56fe\u8868<\/strong><\/h2>\n<p>plt.figure(figsize=(14, 7))<\/p>\n<p>plt.plot(stock_data.index, stock_data[&#39;Daily Return&#39;], label=&#39;Daily Return&#39;)<\/p>\n<p>plt.title(&#39;Daily Return of &#39; + ticker)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Daily Return&#39;)<\/p>\n<p>plt.legend()<\/p>\n<p>plt.show()<\/p>\n<h2><strong>\u7ed8\u5236\u7d2f\u8ba1\u6536\u76ca\u7387\u56fe\u8868<\/strong><\/h2>\n<p>plt.figure(figsize=(14, 7))<\/p>\n<p>plt.plot(stock_data.index, stock_data[&#39;Cumulative Return&#39;], label=&#39;Cumulative Return&#39;, color=&#39;green&#39;)<\/p>\n<p>plt.title(&#39;Cumulative Return of &#39; + ticker)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Cumulative Return&#39;)<\/p>\n<p>plt.legend()<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u9762\u7684\u4ee3\u7801\u5c06\u7ed8\u5236\u6bcf\u65e5\u6536\u76ca\u7387\u548c\u7d2f\u8ba1\u6536\u76ca\u7387\u7684\u56fe\u8868\uff0c\u5e2e\u52a9\u6211\u4eec\u66f4\u76f4\u89c2\u5730\u4e86\u89e3\u80a1\u7968\u7684\u6536\u76ca\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5b9e\u6218\u6848\u4f8b<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u7528Python\u6c42\u80a1\u7968\u6536\u76ca\u7387\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e2a\u5b9e\u6218\u6848\u4f8b\u6765\u8bf4\u660e\u3002\u5047\u8bbe\u6211\u4eec\u60f3\u8981\u5206\u6790\u7279\u65af\u62c9\uff08TSLA\uff09\u7684\u80a1\u7968\u6536\u76ca\u7387\uff0c\u5e76\u6bd4\u8f83\u5176\u4e0e\u7eb3\u65af\u8fbe\u514b\u7efc\u5408\u6307\u6570\uff08IXIC\uff09\u7684\u8868\u73b0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4e0b\u8f7d\u7279\u65af\u62c9\u548c\u7eb3\u65af\u8fbe\u514b\u7efc\u5408\u6307\u6570\u6570\u636e<\/p>\n<p>tesla_data = yf.download(&#39;TSLA&#39;, start=&#39;2020-01-01&#39;, end=&#39;2023-01-01&#39;)<\/p>\n<p>nasdaq_data = yf.download(&#39;^IXIC&#39;, start=&#39;2020-01-01&#39;, end=&#39;2023-01-01&#39;)<\/p>\n<h2><strong>\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387<\/strong><\/h2>\n<p>tesla_data[&#39;Daily Return&#39;] = tesla_data[&#39;Adj Close&#39;].pct_change()<\/p>\n<p>nasdaq_data[&#39;Daily Return&#39;] = nasdaq_data[&#39;Adj Close&#39;].pct_change()<\/p>\n<h2><strong>\u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387<\/strong><\/h2>\n<p>tesla_data[&#39;Cumulative Return&#39;] = (1 + tesla_data[&#39;Daily Return&#39;]).cumprod() - 1<\/p>\n<p>nasdaq_data[&#39;Cumulative Return&#39;] = (1 + nasdaq_data[&#39;Daily Return&#39;]).cumprod() - 1<\/p>\n<h2><strong>\u7ed8\u5236\u6bcf\u65e5\u6536\u76ca\u7387\u56fe\u8868<\/strong><\/h2>\n<p>plt.figure(figsize=(14, 7))<\/p>\n<p>plt.plot(tesla_data.index, tesla_data[&#39;Daily Return&#39;], label=&#39;TSLA Daily Return&#39;)<\/p>\n<p>plt.plot(nasdaq_data.index, nasdaq_data[&#39;Daily Return&#39;], label=&#39;NASDAQ Daily Return&#39;, color=&#39;orange&#39;)<\/p>\n<p>plt.title(&#39;Daily Return of TSLA and NASDAQ&#39;)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Daily Return&#39;)<\/p>\n<p>plt.legend()<\/p>\n<p>plt.show()<\/p>\n<h2><strong>\u7ed8\u5236\u7d2f\u8ba1\u6536\u76ca\u7387\u56fe\u8868<\/strong><\/h2>\n<p>plt.figure(figsize=(14, 7))<\/p>\n<p>plt.plot(tesla_data.index, tesla_data[&#39;Cumulative Return&#39;], label=&#39;TSLA Cumulative Return&#39;)<\/p>\n<p>plt.plot(nasdaq_data.index, nasdaq_data[&#39;Cumulative Return&#39;], label=&#39;NASDAQ Cumulative Return&#39;, color=&#39;orange&#39;)<\/p>\n<p>plt.title(&#39;Cumulative Return of TSLA and NASDAQ&#39;)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Cumulative Return&#39;)<\/p>\n<p>plt.legend()<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u4ee3\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u4e0b\u8f7d\u7279\u65af\u62c9\u548c\u7eb3\u65af\u8fbe\u514b\u7efc\u5408\u6307\u6570\u7684\u80a1\u7968\u6570\u636e\uff0c\u8ba1\u7b97\u5176\u6bcf\u65e5\u6536\u76ca\u7387\u548c\u7d2f\u8ba1\u6536\u76ca\u7387\uff0c\u5e76\u7ed8\u5236\u5bf9\u6bd4\u56fe\u8868\u3002\u8fd9\u6837\u53ef\u4ee5\u76f4\u89c2\u5730\u5c55\u793a\u7279\u65af\u62c9\u80a1\u7968\u4e0e\u7eb3\u65af\u8fbe\u514b\u7efc\u5408\u6307\u6570\u7684\u8868\u73b0\u5dee\u5f02\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u7528Python\u6c42\u80a1\u7968\u6536\u76ca\u7387\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u4e0b\u8f7d\u80a1\u7968\u6570\u636e\u3001\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\u3001\u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387\u3001\u5206\u6790\u548c\u53ef\u89c6\u5316\u7ed3\u679c\u3002\u901a\u8fc7\u5b9e\u6218\u6848\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3\u548c\u5e94\u7528\u8fd9\u4e9b\u65b9\u6cd5\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u8fdb\u884c\u8c03\u6574\u548c\u6269\u5c55\uff0c\u4f8b\u5982\u52a0\u5165\u66f4\u591a\u7684\u80a1\u7968\u8fdb\u884c\u5bf9\u6bd4\u5206\u6790\u3001\u4f7f\u7528\u4e0d\u540c\u7684\u65f6\u95f4\u6bb5\u8fdb\u884c\u56de\u6d4b\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u603b\u4e4b\uff0cPython\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5de5\u5177\u548c\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u65b9\u4fbf\u5730\u8fdb\u884c\u80a1\u7968\u6536\u76ca\u7387\u7684\u8ba1\u7b97\u548c\u5206\u6790\u3002\u8fd9\u5bf9\u4e8e\u6295\u8d44\u8005\u548c\u7814\u7a76\u4eba\u5458\u6765\u8bf4\uff0c\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u6280\u80fd\u3002\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u80fd\u591f\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u638c\u63e1\u7528Python\u6c42\u80a1\u7968\u6536\u76ca\u7387\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u8ba1\u7b97\u80a1\u7968\u7684\u6536\u76ca\u7387\uff1f<\/strong><br \/>\u8981\u8ba1\u7b97\u80a1\u7968\u7684\u6536\u76ca\u7387\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u4e2d\u7684Pandas\u5e93\u6765\u5904\u7406\u6570\u636e\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u83b7\u53d6\u80a1\u7968\u7684\u5386\u53f2\u4ef7\u683c\u6570\u636e\uff0c\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7Yahoo Finance\u7b49API\u83b7\u53d6\u3002\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528Pandas\u8bfb\u53d6\u6570\u636e\uff0c\u8ba1\u7b97\u6536\u76ca\u7387\u53ef\u4ee5\u901a\u8fc7\u4ef7\u683c\u7684\u53d8\u52a8\u767e\u5206\u6bd4\u6765\u5b9e\u73b0\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u516c\u5f0f\uff1a(\u5f53\u524d\u4ef7\u683c &#8211; \u524d\u4e00\u4e2a\u4ef7\u683c) \/ \u524d\u4e00\u4e2a\u4ef7\u683c \u6765\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u5904\u7406\u7f3a\u5931\u7684\u80a1\u7968\u6570\u636e\uff1f<\/strong><br \/>\u5728\u83b7\u53d6\u80a1\u7968\u6570\u636e\u65f6\uff0c\u7f3a\u5931\u503c\u662f\u5e38\u89c1\u95ee\u9898\u3002\u4f7f\u7528Pandas\u5e93\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u63d2\u503c\u65b9\u6cd5\u6216\u586b\u5145\u65b9\u6cd5\u6765\u5904\u7406\u8fd9\u4e9b\u7f3a\u5931\u503c\u3002\u5e38\u7528\u7684\u6280\u5de7\u5305\u62ec\u4f7f\u7528\u524d\u4e00\u4e2a\u6709\u6548\u503c\u586b\u5145\uff08ffill\uff09\u6216\u8005\u4f7f\u7528\u5747\u503c\u586b\u5145\u3002\u786e\u4fdd\u5728\u8ba1\u7b97\u6536\u76ca\u7387\u4e4b\u524d\u5904\u7406\u597d\u7f3a\u5931\u6570\u636e\uff0c\u4ee5\u4fdd\u8bc1\u7ed3\u679c\u7684\u51c6\u786e\u6027\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9bPython\u5e93\u63a8\u8350\u7528\u4e8e\u80a1\u7968\u6570\u636e\u5206\u6790\uff1f<\/strong><br \/>\u5728\u80a1\u7968\u6570\u636e\u5206\u6790\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2aPython\u5e93\u6765\u63d0\u5347\u6548\u7387\u3002Pandas\u662f\u6570\u636e\u5904\u7406\u7684\u6838\u5fc3\u5e93\uff0c\u800cNumPy\u53ef\u7528\u4e8e\u9ad8\u6548\u7684\u6570\u5b66\u8ba1\u7b97\u3002\u6b64\u5916\uff0cMatplotlib\u548cSeaborn\u53ef\u4ee5\u7528\u4e8e\u6570\u636e\u53ef\u89c6\u5316\uff0c\u5e2e\u52a9\u60a8\u66f4\u76f4\u89c2\u5730\u7406\u89e3\u6536\u76ca\u7387\u53d8\u5316\u3002\u5bf9\u4e8e\u83b7\u53d6\u91d1\u878d\u6570\u636e\uff0cyfinance\u548cAlpha Vantage\u90fd\u662f\u975e\u5e38\u53d7\u6b22\u8fce\u7684\u5e93\uff0c\u80fd\u591f\u65b9\u4fbf\u5730\u83b7\u53d6\u5b9e\u65f6\u548c\u5386\u53f2\u80a1\u7968\u6570\u636e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u7528Python\u6c42\u80a1\u7968\u6536\u76ca\u7387\u7684\u65b9\u6cd5\u4e3b\u8981\u6709\uff1a\u4e0b\u8f7d\u80a1\u7968\u6570\u636e\u3001\u8ba1\u7b97\u6bcf\u65e5\u6536\u76ca\u7387\u3001\u8ba1\u7b97\u7d2f\u8ba1\u6536\u76ca\u7387\u3001\u5206\u6790\u548c\u53ef\u89c6\u5316\u7ed3\u679c\u3002\u5176\u4e2d\uff0c [&hellip;]","protected":false},"author":3,"featured_media":1043586,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1043574"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1043574"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1043574\/revisions"}],"predecessor-version":[{"id":1043588,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1043574\/revisions\/1043588"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1043586"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1043574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1043574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1043574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}