{"id":6398,"date":"2025-06-01T15:04:02","date_gmt":"2025-06-04T07:08:01","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=6398"},"modified":"2025-06-04T15:04:02","modified_gmt":"2025-06-04T07:08:01","slug":"%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e5%b8%8c%e7%88%be%e8%b6%a8%e5%90%91%e6%8c%87%e6%a8%99%e5%b8%b6ccibands%e4%ba%a4%e6%98%93%e6%8c%87%e6%a8%99","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/python\/%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e5%b8%8c%e7%88%be%e8%b6%a8%e5%90%91%e6%8c%87%e6%a8%99%e5%b8%b6ccibands%e4%ba%a4%e6%98%93%e6%8c%87%e6%a8%99\/","title":{"rendered":"2025\u5e74\u6700\u65b0\u7684Python\u7a0b\u5f0f\u6559\u5b78\uff1a\u4f7f\u7528\u5e0c\u723e\u8da8\u5411\u6307\u6a19\u5e36(CCI Bands)\u9032\u884c\u4ea4\u6613\u5206\u6790"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Python, CCI Bands, \u4ea4\u6613\u6307\u6a19, \u5e0c\u723e\u8da8\u5411\u6307\u6a19\u5e36, \u6280\u8853\u5206\u6790, \u6295\u8cc7\u7b56\u7565\"><\/p>\n<h1>2025\u5e74\u6700\u65b0\u7684Python\u7a0b\u5f0f\u6559\u5b78\uff1a\u4f7f\u7528\u5e0c\u723e\u8da8\u5411\u6307\u6a19\u5e36(CCI Bands)\u9032\u884c\u4ea4\u6613\u5206\u6790<\/h1>\n<p>\u5e0c\u723e\u8da8\u5411\u6307\u6a19\u5e36(CCI Bands)\u662f\u4e00\u7a2e\u7528\u65bc\u6280\u8853\u5206\u6790\u7684\u6307\u6a19\uff0c\u80fd\u5e6b\u52a9\u6295\u8cc7\u8005\u66f4\u597d\u5730\u4e86\u89e3\u5e02\u5834\u8da8\u52e2\u4e26\u63d0\u4f9b\u4ea4\u6613\u6a5f\u6703\u3002CCI Bands\u662f\u57fa\u65bc\u5546\u54c1\u901a\u9053\u6307\u6a19(Commodity Channel Index, CCI)\u7684\u6280\u8853\u6307\u6a19\uff0c\u80fd\u6709\u6548\u6aa2\u6e2c\u5e02\u5834\u7684\u8da8\u52e2\u4e26\u63d0\u4f9b\u8cb7\u8ce3\u4fe1\u865f\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662fCCI Bands\uff1f<\/h2>\n<p>CCI Bands\u7531CCI\u503c\u8a08\u7b97\u5f97\u51fa\uff0c\u4e0a\u4e0b\u5169\u500b\u5e36\u72c0\u5340\u57df\u5206\u5225\u7528\u65bc\u6307\u793a\u5e02\u5834\u7684\u8d85\u8cb7\u548c\u8d85\u8ce3\u72c0\u614b\u3002\u7576CCI\u503c\u8d85\u904e\u4e0a\u9650\u6642\uff0c\u5e02\u5834\u53ef\u80fd\u904e\u71b1\uff1b\u7576CCI\u503c\u4f4e\u65bc\u4e0b\u9650\u6642\uff0c\u5e02\u5834\u53ef\u80fd\u904e\u51b7\u3002\u9019\u4e9b\u6307\u6a19\u80fd\u5e6b\u52a9\u4ea4\u6613\u8005\u5728\u9069\u7576\u7684\u6642\u6a5f\u9032\u884c\u4ea4\u6613\u3002<\/p>\n<h2>CCI Bands\u7684\u4f7f\u7528\u6642\u6a5f<\/h2>\n<p>\u4f7f\u7528CCI Bands\u9032\u884c\u4ea4\u6613\u6642\uff0c\u4ee5\u4e0b\u5e7e\u7a2e\u60c5\u6cc1\u503c\u5f97\u95dc\u6ce8\uff1a<\/p>\n<ul>\n<li>\u7576CCI\u6307\u6a19\u8d85\u904e\u4e0a\u9650\u6642\uff0c\u8868\u793a\u5e02\u5834\u8da8\u52e2\u6b63\u5728\u4e0a\u5347\uff0c\u53ef\u4ee5\u8003\u616e\u8cb7\u5165\u3002<\/li>\n<li>\u7576CCI\u6307\u6a19\u4f4e\u65bc\u4e0b\u9650\u6642\uff0c\u8868\u793a\u5e02\u5834\u8da8\u52e2\u6b63\u5728\u4e0b\u964d\uff0c\u53ef\u4ee5\u8003\u616e\u8ce3\u51fa\u3002<\/li>\n<li>\u7576CCI\u6307\u6a19\u5728\u4e0a\u4e0b\u9650\u4e4b\u9593\u6642\uff0c\u8868\u793a\u5e02\u5834\u8da8\u52e2\u4e0d\u660e\uff0c\u53ef\u4ee5\u8003\u616e\u6301\u6709\u6216\u8005\u7b49\u5f85\u9032\u4e00\u6b65\u7684\u4fe1\u865f\u3002<\/li>\n<\/ul>\n<h2>\u5982\u4f55\u4f7f\u7528Python\u8a08\u7b97CCI Bands<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528Python\u8a08\u7b97CCI Bands\u7684\u5b8c\u6574\u7bc4\u4f8b\uff0c\u5305\u62ec\u5b8c\u5584\u7684\u8a3b\u89e3\u8207\u6700\u4f73\u5be6\u8e10\uff0c\u5e6b\u52a9\u8b80\u8005\u66f4\u597d\u5730\u7406\u89e3\u6bcf\u4e00\u6b65\u9a5f\uff1a<\/p>\n<p>&#8220;`python<br \/>\nimport pandas as pd<\/p>\n<p># \u8a08\u7b97CCI\u6307\u6a19<br \/>\ndef cci(data, n):<br \/>\n    TP = (data[&#8216;high&#8217;] + data[&#8216;low&#8217;] + data[&#8216;close&#8217;]) \/ 3  # \u8a08\u7b97\u5178\u578b\u50f9\u683c<br \/>\n    CCI = pd.Series((TP &#8211; TP.rolling(n).mean()) \/ (0.015 * TP.rolling(n).std()), name=&#8217;CCI_&#8217; + str(n))<br \/>\n    data = data.join(CCI)  # \u5c07CCI\u6307\u6a19\u52a0\u5165\u6578\u64da\u6846<br \/>\n    return data<\/p>\n<p># \u8a08\u7b97CCI Bands<br \/>\ndef cci_bands(data, n):<br \/>\n    cci = data[&#8216;CCI_&#8217; + str(n)]\n    cci_upper = cci.rolling(n).mean() + 2 * cci.rolling(n).std()  # \u4e0a\u5e36<br \/>\n    cci_lower = cci.rolling(n).mean() &#8211; 2 * cci.rolling(n).std()  # \u4e0b\u5e36<br \/>\n    data = data.join(cci_upper.rename(&#8216;CCI_Upper&#8217;))  # \u52a0\u5165\u4e0a\u5e36<br \/>\n    data = data.join(cci_lower.rename(&#8216;CCI_Lower&#8217;))  # \u52a0\u5165\u4e0b\u5e36<br \/>\n    return data<\/p>\n<p># \u4f7f\u7528\u7bc4\u4f8b<br \/>\ndata = pd.DataFrame({<br \/>\n    &#8216;high&#8217;: [1.2, 1.3, 1.4, 1.5, 1.6],  # \u7bc4\u4f8b\u9ad8\u50f9<br \/>\n    &#8216;low&#8217;: [1.1, 1.2, 1.3, 1.4, 1.5],   # \u7bc4\u4f8b\u4f4e\u50f9<br \/>\n    &#8216;close&#8217;: [1.15, 1.25, 1.35, 1.45, 1.55]  # \u7bc4\u4f8b\u6536\u76e4\u50f9<br \/>\n})<\/p>\n<p>data = cci(data, 14)  # \u8a08\u7b97CCI\u6307\u6a19<br \/>\ndata = cci_bands(data, 14)  # \u8a08\u7b97CCI Bands<br \/>\nprint(data)  # \u8f38\u51fa\u7d50\u679c<br \/>\n&#8220;`<\/p>\n<p>\u7d93\u904e\u4e0a\u8ff0\u7a0b\u5f0f\u78bc\u7684\u904b\u884c\uff0c\u6211\u5011\u53ef\u4ee5\u8a08\u7b97\u51faCCI Bands\u4e26\u7372\u5f97\u76f8\u61c9\u7684\u8cb7\u8ce3\u4fe1\u865f\u3002<\/p>\n<h2>\u932f\u8aa4\u6392\u9664\u8207\u5e38\u898b\u554f\u984c<\/h2>\n<p>\u5728\u4f7f\u7528\u4e0a\u8ff0\u7a0b\u5f0f\u78bc\u6642\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u5e38\u898b\u7684\u932f\u8aa4\uff0c\u4f8b\u5982\u6578\u64da\u9577\u5ea6\u4e0d\u8db3\u3002\u78ba\u4fdd\u60a8\u7684\u6578\u64da\u5305\u542b\u8db3\u5920\u7684\u6b77\u53f2\u50f9\u683c\uff0c\u4ee5\u4fbf\u6b63\u78ba\u8a08\u7b97CCI\u6307\u6a19\u3002<\/p>\n<p>\u82e5\u9700\u8981\u9032\u4e00\u6b65\u4e86\u89e3Python\u8207\u6280\u8853\u5206\u6790\u7684\u7d50\u5408\uff0c\u5efa\u8b70\u53c3\u8003[\u9019\u7bc7\u6559\u5b78\u6587\u7ae0](https:\/\/vocus.cc\/article\/608e4cf1fd8978000687d1f5)\uff0c\u6df1\u5165\u4e86\u89e3Python\u5728\u91d1\u878d\u4ea4\u6613\u4e2d\u7684\u61c9\u7528\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5e0c\u723e\u8da8\u5411\u6307\u6a19\u5e36(CCI Bands)\u662f\u4e00\u7a2e\u6709\u6548\u7684\u6280\u8853\u5206\u6790\u5de5\u5177\uff0c\u80fd\u5e6b\u52a9\u6295\u8cc7\u8005\u66f4\u597d\u5730\u4e86\u89e3\u5e02\u5834\u8da8\u52e2\u4e26\u63d0\u4f9b\u4ea4\u6613\u6a5f\u6703\u3002\u901a\u904ePython\u7de8\u7a0b\uff0c\u6211\u5011\u53ef\u4ee5\u8f15\u9b06\u8a08\u7b97CCI Bands\u4e26\u7372\u5f97\u8cb7\u8ce3\u4fe1\u865f\uff0c\u9032\u4e00\u6b65\u63d0\u5347\u4ea4\u6613\u7b56\u7565\u7684\u6709\u6548\u6027\u3002<\/p>\n<h2>Q&#038;A\uff08\u5e38\u898b\u554f\u984c\u89e3\u7b54\uff09<\/h2>\n<p>**Q1: CCI Bands\u9069\u5408\u6240\u6709\u5e02\u5834\u55ce\uff1f**<br \/>\nA1: \u662f\u7684\uff0cCCI Bands\u53ef\u4ee5\u61c9\u7528\u65bc\u5404\u7a2e\u5e02\u5834\uff0c\u5305\u62ec\u80a1\u7968\u3001\u5916\u532f\u548c\u671f\u8ca8\u5e02\u5834\uff0c\u4f46\u9700\u6839\u64da\u4e0d\u540c\u5e02\u5834\u7279\u6027\u9032\u884c\u8abf\u6574\u3002<\/p>\n<p>**Q2: \u6211\u8a72\u5982\u4f55\u9078\u64c7CCI\u7684\u8a08\u7b97\u671f\u6578\uff1f**<br \/>\nA2: \u5e38\u898b\u7684\u8a08\u7b97\u671f\u6578\u70ba14\u65e5\uff0c\u4f46\u6839\u64da\u60a8\u7684\u4ea4\u6613\u7b56\u7565\u548c\u5e02\u5834\u6ce2\u52d5\u6027\uff0c\u53ef\u4ee5\u8abf\u6574\u671f\u6578\u4ee5\u7372\u5f97\u6700\u4f73\u6548\u679c\u3002<\/p>\n<p>**Q3: \u5982\u4f55\u89e3\u8b80CCI Bands\u7684\u4fe1\u865f\uff1f**<br \/>\nA3: \u7576CCI\u503c\u8d85\u904e\u4e0a\u9650\u6642\uff0c\u8868\u793a\u5e02\u5834\u904e\u71b1\uff0c\u53ef\u80fd\u51fa\u73fe\u56de\u8abf\uff0c\u800c\u4f4e\u65bc\u4e0b\u9650\u5247\u8868\u793a\u5e02\u5834\u904e\u51b7\uff0c\u53ef\u80fd\u51fa\u73fe\u53cd\u5f48\u3002\u4ea4\u6613\u8005\u61c9\u6839\u64da\u9019\u4e9b\u4fe1\u865f\u505a\u51fa\u76f8\u61c9\u7684\u4ea4\u6613\u6c7a\u7b56\u3002<\/p>\n<p>&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5229\u7528\u5e0c\u723e\u8da8\u5411\u6307\u6a19\u5e36(CCIBands)\u4ea4\u6613\u6307\u6a19\uff0c\u4e26\u63d0\u4f9bPython\u7bc4\u4f8b\u4f86\u89e3\u91cb\u5982\u4f55\u4f7f\u7528\u5b83\u4f86\u505a\u51fa\u6b63\u78ba\u7684\u4ea4\u6613\u6c7a\u7b56\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-6398","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-1Fc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6398","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=6398"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6398\/revisions"}],"predecessor-version":[{"id":6399,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6398\/revisions\/6399"}],"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=6398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=6398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=6398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}