{"id":6272,"date":"2025-05-31T14:48:08","date_gmt":"2025-06-04T07:01:08","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=6272"},"modified":"2025-06-04T14:48:08","modified_gmt":"2025-06-04T07:01:08","slug":"%e5%88%a9%e7%94%a8%e5%b8%8c%e7%88%be%e5%b0%b1%e5%9c%b0%e6%8c%87%e6%a8%99%e5%b8%b6stochasticbands%e4%ba%a4%e6%98%93%e6%8c%87%e6%a8%99%e7%9a%84%e6%99%82%e6%a9%9f%e8%88%87python%e7%af%84%e4%be%8b","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/python\/%e5%88%a9%e7%94%a8%e5%b8%8c%e7%88%be%e5%b0%b1%e5%9c%b0%e6%8c%87%e6%a8%99%e5%b8%b6stochasticbands%e4%ba%a4%e6%98%93%e6%8c%87%e6%a8%99%e7%9a%84%e6%99%82%e6%a9%9f%e8%88%87python%e7%af%84%e4%be%8b\/","title":{"rendered":"\u5229\u7528\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\uff08Stochastic Bands\uff09\u9032\u884c\u4ea4\u6613\u7684\u6700\u4f73\u6642\u6a5f\u82072025\u5e74Python\u7bc4\u4f8b"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Python, \u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36, Stochastic Bands, \u4ea4\u6613\u6307\u6a19, \u4f7f\u7528\u6642\u6a5f, \u80a1\u7968\u5206\u6790, \u6280\u8853\u5206\u6790\"><\/p>\n<h1>\u5229\u7528\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\uff08Stochastic Bands\uff09\u9032\u884c\u4ea4\u6613\u7684\u6700\u4f73\u6642\u6a5f\u82072025\u5e74Python\u7bc4\u4f8b<\/h1>\n<p>\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\uff08Stochastic Bands\uff09\u662f\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u6280\u8853\u5206\u6790\u5de5\u5177\uff0c\u65e8\u5728\u5e6b\u52a9\u6295\u8cc7\u8005\u66f4\u597d\u5730\u7406\u89e3\u80a1\u7968\u5e02\u5834\u7684\u8d70\u52e2\u4e26\u628a\u63e1\u4ea4\u6613\u6a5f\u6703\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7684\u6700\u65b0\u61c9\u7528\u6642\u6a5f\u53ca\u5176\u5728Python\u4e2d\u7684\u5be6\u4f5c\u7bc4\u4f8b\uff0c\u4ee5\u52a9\u65bc\u63d0\u5347\u60a8\u7684\u6295\u8cc7\u7b56\u7565\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\uff1f<\/h2>\n<p>\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7531\u7f8e\u570b\u6295\u8cc7\u5b78\u5bb6George C. Lane\u65bc20\u4e16\u7d0050\u5e74\u4ee3\u63d0\u51fa\uff0c\u5b83\u7684\u57fa\u672c\u539f\u7406\u662f\u5c07\u5e02\u5834\u8d70\u52e2\u5206\u70ba\u4e09\u500b\u5340\u9593\uff1a\u4e0a\u5347\u8da8\u52e2\u3001\u4e0b\u964d\u8da8\u52e2\u548c\u76e4\u6574\u8da8\u52e2\u3002\u9019\u4e00\u6307\u6a19\u4e3b\u8981\u7528\u65bc\u5e6b\u52a9\u6295\u8cc7\u8005\u8b58\u5225\u6f5b\u5728\u7684\u8cb7\u5165\u548c\u8ce3\u51fa\u6642\u6a5f\u3002<\/p>\n<h2>\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7684\u4f7f\u7528\u6642\u6a5f<\/h2>\n<p>\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u53ef\u4ee5\u7528\u65bc\u5206\u6790\u80a1\u7968\u5e02\u5834\u7684\u8da8\u52e2\uff0c\u4e26\u70ba\u6295\u8cc7\u8005\u63d0\u4f9b\u4ea4\u6613\u4fe1\u865f\u3002\u4ee5\u4e0b\u662f\u5176\u4f7f\u7528\u6642\u6a5f\u7684\u5177\u9ad4\u8aaa\u660e\uff1a<\/p>\n<ul>\n<li><strong>\u4e0a\u5347\u8da8\u52e2\uff1a<\/strong>\u7576\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7684\u6307\u6a19\u7dda\u4e0a\u5347\uff0c\u986f\u793a\u5e02\u5834\u53ef\u80fd\u8655\u65bc\u4e0a\u5347\u8da8\u52e2\u3002\u6295\u8cc7\u8005\u53ef\u4ee5\u8003\u616e\u5728\u6b64\u6642\u8cb7\u5165\u80a1\u7968\u4ee5\u7372\u53d6\u6f5b\u5728\u5229\u6f64\u3002<\/li>\n<li><strong>\u4e0b\u964d\u8da8\u52e2\uff1a<\/strong>\u7576\u6307\u6a19\u7dda\u4e0b\u964d\uff0c\u986f\u793a\u5e02\u5834\u53ef\u80fd\u8655\u65bc\u4e0b\u964d\u8da8\u52e2\uff0c\u6295\u8cc7\u8005\u61c9\u8003\u616e\u6e1b\u5c11\u6301\u6709\u7684\u80a1\u7968\u6216\u5c0b\u627e\u5176\u4ed6\u6295\u8cc7\u6a5f\u6703\u3002<\/li>\n<li><strong>\u76e4\u6574\u8da8\u52e2\uff1a<\/strong>\u7576\u6307\u6a19\u7dda\u9032\u5165\u76e4\u6574\u72c0\u614b\uff0c\u986f\u793a\u5e02\u5834\u7f3a\u4e4f\u660e\u78ba\u65b9\u5411\uff0c\u6295\u8cc7\u8005\u53ef\u4ee5\u9078\u64c7\u4fdd\u6301\u539f\u6709\u7684\u6295\u8cc7\u7d44\u5408\uff0c\u8010\u5fc3\u7b49\u5f85\u5e02\u5834\u8b8a\u5316\u3002<\/li>\n<\/ul>\n<h2>Python\u7bc4\u4f8b\uff1a\u7e6a\u88fd\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u5c07\u901a\u904ePython\u7a0b\u5f0f\u78bc\u4f86\u7e6a\u88fd\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u3002\u78ba\u4fdd\u60a8\u5df2\u5b89\u88dd\u5fc5\u8981\u7684\u5eab\uff0c\u4f8b\u5982pandas\u548cmatplotlib\u3002<\/p>\n<p>&#8220;`python<br \/>\nimport pandas as pd<br \/>\nimport matplotlib.pyplot as plt<\/p>\n<p># \u8b80\u53d6\u8cc7\u6599<br \/>\ndata = pd.read_csv(&#8216;data.csv&#8217;)<\/p>\n<p># \u8a08\u7b97\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36<br \/>\ndata[&#8216;Upper Band&#8217;] = data[&#8216;Close&#8217;].rolling(window=14).max()<br \/>\ndata[&#8216;Lower Band&#8217;] = data[&#8216;Close&#8217;].rolling(window=14).min()<\/p>\n<p># \u7e6a\u88fd\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36<br \/>\nplt.figure(figsize=(14, 7))<br \/>\nplt.plot(data[&#8216;Close&#8217;], label=&#8217;Close Price&#8217;, color=&#8217;blue&#8217;)<br \/>\nplt.plot(data[&#8216;Upper Band&#8217;], label=&#8217;Upper Band&#8217;, color=&#8217;green&#8217;, linestyle=&#8217;&#8211;&#8216;)<br \/>\nplt.plot(data[&#8216;Lower Band&#8217;], label=&#8217;Lower Band&#8217;, color=&#8217;red&#8217;, linestyle=&#8217;&#8211;&#8216;)<br \/>\nplt.fill_between(data.index, data[&#8216;Upper Band&#8217;], data[&#8216;Lower Band&#8217;], color=&#8217;lightgrey&#8217;, alpha=0.5)<br \/>\nplt.title(&#8216;\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\uff08Stochastic Bands\uff09&#8217;)<br \/>\nplt.xlabel(&#8216;Date&#8217;)<br \/>\nplt.ylabel(&#8216;Price&#8217;)<br \/>\nplt.legend()<br \/>\nplt.grid()<br \/>\nplt.show()<br \/>\n&#8220;`<\/p>\n<p>\u9019\u6bb5\u7a0b\u5f0f\u78bc\u5c07\u5e6b\u52a9\u60a8\u5be6\u73fe\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7684\u7e6a\u88fd\uff0c\u5f9e\u800c\u66f4\u76f4\u89c0\u5730\u5206\u6790\u5e02\u5834\u8d70\u52e2\uff0c\u63d0\u5347\u4ea4\u6613\u7684\u6e96\u78ba\u6027\u548c\u6210\u529f\u7387\u3002<\/p>\n<h2>\u932f\u8aa4\u6392\u9664\u8207\u5ef6\u4f38\u61c9\u7528<\/h2>\n<p>\u5728\u5be6\u4f5c\u904e\u7a0b\u4e2d\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u4ee5\u4e0b\u5e38\u898b\u932f\u8aa4\uff1a<\/p>\n<p>&#8211; **\u8cc7\u6599\u7f3a\u5931**\uff1a\u82e5\u6578\u64da\u96c6\u5b58\u5728\u7f3a\u5931\u503c\uff0c\u8acb\u78ba\u4fdd\u60a8\u5728\u8a08\u7b97\u6307\u6a19\u4e4b\u524d\u9032\u884c\u6578\u64da\u6e05\u7406\u3002<br \/>\n&#8211; **\u8996\u89ba\u5316\u554f\u984c**\uff1a\u82e5\u5716\u8868\u7121\u6cd5\u6b63\u5e38\u986f\u793a\uff0c\u6aa2\u67e5\u60a8\u7684matplotlib\u5eab\u662f\u5426\u6b63\u78ba\u5b89\u88dd\uff0c\u4e26\u78ba\u4fdd\u57f7\u884c\u74b0\u5883\u652f\u6301\u5716\u5f62\u986f\u793a\u3002<br \/>\n&#8211; **\u6307\u6a19\u7dda\u91cd\u758a**\uff1a\u8abf\u6574\u5716\u8868\u7684\u900f\u660e\u5ea6\u6216\u984f\u8272\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u5340\u5206\u4e0d\u540c\u7684\u6307\u6a19\u7dda\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u60a8\u53ef\u4ee5\u5c07\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u61c9\u7528\u65bc\u4e0d\u540c\u7684\u5e02\u5834\u548c\u8cc7\u7522\u985e\u5225\uff0c\u4f8b\u5982\u5916\u532f\u6216\u5546\u54c1\u5e02\u5834\uff0c\u5f9e\u800c\u9032\u4e00\u6b65\u64f4\u5c55\u5176\u4f7f\u7528\u7bc4\u570d\u3002<\/p>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u662f\u4e00\u7a2e\u5f37\u5927\u7684\u4ea4\u6613\u6307\u6a19\uff0c\u5e6b\u52a9\u6295\u8cc7\u8005\u8b58\u5225\u5e02\u5834\u8d70\u52e2\u548c\u4ea4\u6613\u6a5f\u6703\u3002\u901a\u904e\u672c\u6587\u63d0\u4f9b\u7684Python\u7bc4\u4f8b\u548c\u61c9\u7528\u6307\u5c0e\uff0c\u60a8\u53ef\u4ee5\u66f4\u6709\u6548\u5730\u904b\u7528\u9019\u4e00\u5de5\u5177\u4ee5\u63d0\u5347\u60a8\u7684\u6295\u8cc7\u6536\u76ca\u3002<\/p>\n<p>\u5982\u9700\u9032\u4e00\u6b65\u4e86\u89e3Python\u5728\u91d1\u878d\u5206\u6790\u4e2d\u7684\u61c9\u7528\uff0c\u60a8\u53ef\u4ee5\u53c3\u8003\u9019\u7bc7\u6587\u7ae0\uff1a[Python\u5728\u91d1\u878d\u4e2d\u7684\u904b\u7528](https:\/\/vocus.cc\/article\/605bbf1a3c0d865a5e81e0c5)\u3002<\/p>\n<h2>Q&#038;A\uff08\u5e38\u898b\u554f\u984c\u89e3\u7b54\uff09<\/h2>\n<h3>Q1: \u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7684\u6709\u6548\u6027\u5982\u4f55\uff1f<\/h3>\n<p>A1: \u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36\u7684\u6709\u6548\u6027\u53d6\u6c7a\u65bc\u5e02\u5834\u74b0\u5883\uff0c\u901a\u5e38\u5728\u6ce2\u52d5\u8f03\u5927\u7684\u5e02\u5834\u4e2d\u6548\u679c\u66f4\u4f73\u3002\u5efa\u8b70\u8207\u5176\u4ed6\u6280\u8853\u6307\u6a19\u7d50\u5408\u4f7f\u7528\u4ee5\u63d0\u9ad8\u6e96\u78ba\u6027\u3002<\/p>\n<h3>Q2: \u5982\u4f55\u9078\u64c7\u5408\u9069\u7684\u6642\u9593\u7a97\u53e3\uff1f<\/h3>\n<p>A2: \u6642\u9593\u7a97\u53e3\u7684\u9078\u64c7\u61c9\u6839\u64da\u60a8\u7684\u4ea4\u6613\u98a8\u683c\u800c\u5b9a\u3002\u77ed\u671f\u4ea4\u6613\u8005\u53ef\u80fd\u6703\u9078\u64c7\u8f03\u77ed\u7684\u6642\u9593\u7a97\u53e3\uff0c\u800c\u9577\u671f\u6295\u8cc7\u8005\u5247\u53ef\u4ee5\u9078\u64c7\u8f03\u9577\u7684\u6642\u9593\u7a97\u53e3\u3002<\/p>\n<h3>Q3: \u5982\u4f55\u89e3\u91cb\u6307\u6a19\u7684\u4e0a\u5347\u548c\u4e0b\u964d\uff1f<\/h3>\n<p>A3: \u6307\u6a19\u7684\u4e0a\u5347\u901a\u5e38\u8868\u793a\u5e02\u5834\u53ef\u80fd\u5b58\u5728\u8cb7\u5165\u6a5f\u6703\uff0c\u800c\u6307\u6a19\u7684\u4e0b\u964d\u5247\u6697\u793a\u8457\u8ce3\u51fa\u4fe1\u865f\u3002\u6295\u8cc7\u8005\u9700\u7d50\u5408\u5176\u4ed6\u5e02\u5834\u4fe1\u606f\u9032\u884c\u7d9c\u5408\u5206\u6790\u3002<br \/>\n&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5e0c\u723e\u5c31\u5730\u6307\u6a19\u5e36(StochasticBands)\u4ea4\u6613\u6307\u6a19\u7684\u6642\u6a5f\u4ee5\u53caPython\u7bc4\u4f8b\uff0c\u8a72\u6307\u6a19\u53ef\u4ee5\u5e6b\u52a9\u6295\u8cc7\u8005\u66f4\u597d\u5730\u5224\u65b7\u5e02\u5834\u8da8\u52e2\uff0c\u4e26\u63d0\u4f9b\u66f4\u591a\u7684\u4ea4\u6613\u6a5f\u6703\u3002<\/p>\n","protected":false},"author":1,"featured_media":2518,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[18,189],"tags":[15,188],"class_list":["post-6272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-189","tag-python","tag-188"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2022\/12\/DALL\u00b7E-2022-12-28-14.25.55-\u62f7\u8c9d2.png","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1Da","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=6272"}],"version-history":[{"count":2,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6272\/revisions"}],"predecessor-version":[{"id":12738,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6272\/revisions\/12738"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media\/2518"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=6272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=6272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=6272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}