{"id":3165,"date":"2025-12-12T07:13:00","date_gmt":"2025-12-11T23:13:00","guid":{"rendered":"https:\/\/www.laoyulaoyu.com\/?p=3165"},"modified":"2025-12-15T15:36:35","modified_gmt":"2025-12-15T07:36:35","slug":"%e4%ba%a4%e6%98%93%e6%9c%9f%e6%9c%9b%e5%80%bc%ef%bc%9a%e5%86%b3%e5%ae%9a%e4%bd%a0%e8%83%bd%e5%90%a6%e5%9c%a8%e5%b8%82%e5%9c%ba%e4%b8%ad%e6%b4%bb%e4%b8%8b%e6%9d%a5%e7%9a%84%e5%85%b3%e9%94%ae%e6%8c%87","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2025\/12\/12\/%e4%ba%a4%e6%98%93%e6%9c%9f%e6%9c%9b%e5%80%bc%ef%bc%9a%e5%86%b3%e5%ae%9a%e4%bd%a0%e8%83%bd%e5%90%a6%e5%9c%a8%e5%b8%82%e5%9c%ba%e4%b8%ad%e6%b4%bb%e4%b8%8b%e6%9d%a5%e7%9a%84%e5%85%b3%e9%94%ae%e6%8c%87\/","title":{"rendered":"\u4ea4\u6613\u671f\u671b\u503c\uff1a\u51b3\u5b9a\u4f60\u80fd\u5426\u5728\u5e02\u573a\u4e2d\u6d3b\u4e0b\u6765\u7684\u5173\u952e\u6307\u6807\uff08\u5b8c\u6574\u6e90\u4ee3\u7801\uff09"},"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 fetchpriority=\"high\" decoding=\"async\" width=\"900\" height=\"383\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/12\/\u5fae\u4fe1\u56fe\u7247_2025-12-04_152259_625-1.jpg\" alt=\"\" class=\"wp-image-3222\" srcset=\"https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/12\/\u5fae\u4fe1\u56fe\u7247_2025-12-04_152259_625-1.jpg 900w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/12\/\u5fae\u4fe1\u56fe\u7247_2025-12-04_152259_625-1-300x128.jpg 300w, https:\/\/laoyulaoyu.com\/wp-content\/uploads\/2025\/12\/\u5fae\u4fe1\u56fe\u7247_2025-12-04_152259_625-1-768x327.jpg 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/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>\u4f5c\u4e3a\u4e00\u4e2a\u5728\u91cf\u5316\u4ea4\u6613\u9886\u57df\u6478\u722c\u6eda\u6253\u591a\u5e74\u7684\u8001\u5175\uff0c\u6211\u89c1\u8fc7\u592a\u591a\u6295\u8d44\u8005\u9677\u5165\u4e00\u4e2a\u81f4\u547d\u8bef\u533a\uff1a\u8fc7\u5206\u5173\u6ce8\u80dc\u7387\uff0c\u5ffd\u7565\u4e86\u6700\u91cd\u8981\u7684\u6307\u6807\uff1a\u4ea4\u6613\u671f\u671b\u503c\u3002\u4eca\u5929\u6211\u8981\u544a\u8bc9\u4f60<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u4e00\u4e2a\u53cd\u76f4\u89c9\u7684\u771f\u76f8\uff1a\u80dc\u738790%\u7684\u7b56\u7565\u53ef\u80fd\u8ba9\u4f60\u7206\u4ed3\uff0c\u800c\u80dc\u738740%\u7684\u7b56\u7565\u5374\u53ef\u80fd\u8ba9\u4f60\u7a33\u5b9a\u76c8\u5229<\/mark>\u3002\u672c\u6587\u5c06\u624b\u628a\u624b\u6559\u4f60\u8ba1\u7b97\u4ea4\u6613\u671f\u671b\u503c\uff0c\u5e76\u7ed9\u51fa\u5168\u4ee3\u7801\uff0c\u8ba9\u4f60\u771f\u6b63\u7406\u89e3\u4ec0\u4e48\u624d\u662f\u771f\u6b63\u8d5a\u94b1\u7684\u4ea4\u6613\u7cfb\u7edf\u3002<\/pre>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u4ec0\u4e48\u662f\u4ea4\u6613\u671f\u671b\u503c\uff1f<\/strong><\/h2>\n\n\n\n<p>\u4ea4\u6613\u671f\u671b\u503c\u662f\u7edf\u8ba1\u5b66\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u6982\u5ff5\uff0c\u5b83\u544a\u8bc9\u6211\u4eec\u5728\u5927\u91cf\u91cd\u590d\u7684\u4ea4\u6613\u4e2d\uff0c<strong>\u5e73\u5747\u6bcf\u7b14\u4ea4\u6613\u9884\u671f\u80fd\u8d5a\u591a\u5c11\u94b1<\/strong>\u3002\u8fd9\u4e2a\u6307\u6807\u6bd4\u5355\u7eaf\u7684\u80dc\u7387\u6216\u76c8\u4e8f\u6bd4\u66f4\u80fd\u53cd\u6620\u4e00\u4e2a\u4ea4\u6613\u7b56\u7565\u7684\u771f\u5b9e\u4ef7\u503c\u3002<\/p>\n\n\n\n<p><strong>\u671f\u671b\u503c = (\u80dc\u7387 \u00d7 \u5e73\u5747\u76c8\u5229) &#8211; (\u8d25\u7387 \u00d7 \u5e73\u5747\u4e8f\u635f)<\/strong><\/p>\n\n\n\n<p>\u5176\u4e2d\uff1a\u8d25\u7387 = 1 &#8211; \u80dc\u7387<\/p>\n\n\n\n<p>\u4e3e\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a\u5982\u679c\u4f60\u7684\u4ea4\u6613\u7cfb\u7edf\u80dc\u7387\u662f50%\uff0c\u5e73\u5747\u76c8\u5229200\u5143\uff0c\u5e73\u5747\u4e8f\u635f100\u5143\uff0c\u90a3\u4e48\u671f\u671b\u503c\u4e3a\uff1a<\/p>\n\n\n\n<p><strong>(0.5 \u00d7 200) &#8211; (0.5 \u00d7 100) = 100 &#8211; 50 =&nbsp;<\/strong><strong>50\u5143<\/strong><\/p>\n\n\n\n<p><strong>\ud83d\udca1<\/strong><strong>\u5173\u952e\u6d1e\u5bdf<\/strong><\/p>\n\n\n\n<p>\u53ea\u8981\u671f\u671b\u503c\u662f\u6b63\u6570\uff0c\u4ece\u957f\u671f\u6765\u770b\u4f60\u7684\u4ea4\u6613\u7cfb\u7edf\u5c31\u662f\u6709\u5229\u53ef\u56fe\u7684\u3002\u53cd\u4e4b\uff0c\u5982\u679c\u671f\u671b\u503c\u662f\u8d1f\u6570\uff0c\u5373\u4f7f\u77ed\u671f\u6709\u76c8\u5229\uff0c\u6700\u7ec8\u4e5f\u4f1a\u4e8f\u635f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u80dc\u7387\u9ad8\u2260\u4e00\u5b9a\u8d5a\u94b1<\/strong><\/h2>\n\n\n\n<p>\u5f88\u591a\u6295\u8d44\u8005\u90fd\u6709\u4e00\u4e2a\u9519\u8bef\u8ba4\u77e5\uff1a\u8ba4\u4e3a\u80dc\u7387\u8d8a\u9ad8\u8d8a\u597d\u3002\u4f46\u4e8b\u5b9e\u4e0a\uff0c<strong>\u9ad8\u80dc\u7387\u4e0d\u7b49\u4e8e\u9ad8\u6536\u76ca<\/strong>\u3002\u8ba9\u6211\u7528\u4e24\u4e2a\u5177\u4f53\u7684\u7b56\u7565\u6765\u8bf4\u660e\u8fd9\u4e2a\u95ee\u9898\uff1a<\/p>\n\n\n\n<p><strong>\ud83d\udcca&nbsp;<\/strong><strong>\u7b56\u7565\u5bf9\u6bd4\u5206\u6790<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">\u7b56\u7565<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u80dc\u7387<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u5e73\u5747\u76c8\u5229<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u5e73\u5747\u4e8f\u635f<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u671f\u671b\u503c<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u957f\u671f\u7ed3\u679c<\/th><\/tr><\/thead><tbody><tr><td><strong>\u7b56\u7565A<\/strong><\/td><td>90%<\/td><td>\u00a5100<\/td><td>\u00a51000<\/td><td>-\u00a510<\/td><td>\u957f\u671f\u4e8f\u635f<\/td><\/tr><tr><td><strong>\u7b56\u7565B<\/strong><\/td><td>40%<\/td><td>\u00a5300<\/td><td>\u00a5100<\/td><td>+\u00a560<\/td><td>\u957f\u671f\u76c8\u5229<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u770b\u5230\u7ed3\u679c\u4e86\u5417\uff1f<strong>\u80dc\u738790%\u7684\u7b56\u7565A\u671f\u671b\u503c\u4e3a\u8d1f\uff0c\u957f\u671f\u6267\u884c\u53ea\u4f1a\u4e8f\u635f\uff1b\u800c\u80dc\u7387\u53ea\u670940%\u7684\u7b56\u7565B\u671f\u671b\u503c\u4e3a\u6b63\uff0c\u957f\u671f\u6267\u884c\u80fd\u591f\u7a33\u5b9a\u76c8\u5229<\/strong>\u3002\u8fd9\u5c31\u662f\u4ea4\u6613\u671f\u671b\u503c\u7684\u5a01\u529b\uff01<\/p>\n\n\n\n<p><strong>\u26a0\ufe0f<\/strong><strong>\u5e38\u89c1\u8bef\u533a<\/strong><\/p>\n\n\n\n<p>\u5f88\u591a\u6295\u8d44\u8005\u4e3a\u4e86\u8ffd\u6c42\u9ad8\u80dc\u7387\uff0c\u5f80\u5f80\u4f1a\u8fc7\u65e9\u6b62\u76c8\uff0c\u6216\u8005\u4e0d\u613f\u610f\u6b62\u635f\u3002\u8fd9\u79cd\u884c\u4e3a\u6a21\u5f0f\u867d\u7136\u80fd\u63d0\u9ad8\u80dc\u7387\uff0c\u4f46\u4f1a\u4e25\u91cd\u635f\u5bb3\u76c8\u4e8f\u6bd4\uff0c\u6700\u7ec8\u5bfc\u81f4\u671f\u671b\u503c\u4e3a\u8d1f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u5982\u4f55\u8bc4\u4f30\u4f60\u7684\u4ea4\u6613\u7b56\u7565<\/strong><\/h2>\n\n\n\n<p>\u8981\u8bc4\u4f30\u4f60\u7684\u4ea4\u6613\u7b56\u7565\u662f\u5426\u6709\u5229\u53ef\u56fe\uff0c\u4f60\u9700\u8981\u6536\u96c6\u81f3\u5c1130\u7b14\u4ea4\u6613\u6570\u636e\uff0c\u7136\u540e\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u8ba1\u7b97\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8ba1\u7b97\u80dc\u7387 =&nbsp;\u76c8\u5229\u4ea4\u6613\u6b21\u6570 \u00f7 \u603b\u4ea4\u6613\u6b21\u6570<\/strong><\/li>\n\n\n\n<li><strong>\u8ba1\u7b97\u5e73\u5747\u76c8\u5229 =&nbsp;\u603b\u76c8\u5229\u91d1\u989d \u00f7 \u76c8\u5229\u4ea4\u6613\u6b21\u6570<\/strong><\/li>\n\n\n\n<li><strong>\u8ba1\u7b97\u5e73\u5747\u4e8f\u635f =&nbsp;\u603b\u4e8f\u635f\u91d1\u989d \u00f7 \u4e8f\u635f\u4ea4\u6613\u6b21\u6570<\/strong><\/li>\n\n\n\n<li><strong>\u8ba1\u7b97\u671f\u671b\u503c =&nbsp;(\u80dc\u7387 \u00d7 \u5e73\u5747\u76c8\u5229) &#8211; (\u8d25\u7387 \u00d7 \u5e73\u5747\u4e8f\u635f)<\/strong><\/li>\n<\/ol>\n\n\n\n<p>\u9664\u4e86\u671f\u671b\u503c\uff0c\u4f60\u8fd8\u9700\u8981\u5173\u6ce8\u4ee5\u4e0b\u91cd\u8981\u6307\u6807\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">\u6307\u6807<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u8ba1\u7b97\u516c\u5f0f<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><strong>\u5229\u6da6\u56e0\u5b50<\/strong><\/td><td>\u603b\u76c8\u5229 \u00f7 \u603b\u4e8f\u635f<\/td><td>\u5927\u4e8e1.5\u8f83\u597d\uff0c\u5927\u4e8e2\u4f18\u79c0<\/td><\/tr><tr><td><strong>\u6700\u5927\u56de\u64a4<\/strong><\/td><td>\u6700\u5927\u8d44\u91d1\u56de\u843d\u5e45\u5ea6<\/td><td>\u53cd\u6620\u7b56\u7565\u98ce\u9669\uff0c\u8d8a\u5c0f\u8d8a\u597d<\/td><\/tr><tr><td><strong>\u590f\u666e\u6bd4\u7387<\/strong><\/td><td>\u8d85\u989d\u6536\u76ca \u00f7 \u6536\u76ca\u6807\u51c6\u5dee<\/td><td>\u98ce\u9669\u8c03\u6574\u540e\u7684\u6536\u76ca<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u56db\u3001\u624b\u628a\u624b\u4ee3\u7801\u6559\u5b66<\/strong><\/h2>\n\n\n\n<p>\u4e0b\u9762\u6211\u5c06\u5206\u4eab\u4e00\u4e2aPython\u793a\u4f8b\u4ee3\u7801\uff0c\u5e2e\u52a9\u4f60\u81ea\u52a8\u8ba1\u7b97\u548c\u5206\u6790\u4ea4\u6613\u671f\u671b\u503c\u3002\u8fd9\u4e2a\u4ee3\u7801\u5305\u542b\u6570\u636e\u751f\u6210\u3001\u6307\u6807\u8ba1\u7b97\u3001\u53ef\u89c6\u5316\u5206\u6790\u7b49\u529f\u80fd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\n\u4ea4\u6613\u671f\u671b\u503c\u8ba1\u7b97\u793a\u4f8b\u4ee3\u7801\n\u4f5c\u8005\uff1a\u8001\u4f59\u635e\u9c7c\n\u529f\u80fd\uff1a\u8ba1\u7b97\u548c\u5206\u6790\u4ea4\u6613\u7b56\u7565\u7684\u671f\u671b\u503c\u3001\u80dc\u7387\u3001\u76c8\u4e8f\u6bd4\u7b49\u5173\u952e\u6307\u6807\n\"\"\"\nimport&nbsp;pandas&nbsp;as&nbsp;pd\nimport&nbsp;numpy&nbsp;as&nbsp;np\nimport&nbsp;matplotlib.pyplot&nbsp;as&nbsp;plt\nimport&nbsp;seaborn&nbsp;as&nbsp;sns\nfrom&nbsp;datetime&nbsp;import&nbsp;datetime, timedelta\nimport&nbsp;warnings\nwarnings.filterwarnings('ignore')\n# \u914d\u7f6ematplotlib\u652f\u6301\u4e2d\u6587\nfrom&nbsp;matplotlib&nbsp;import&nbsp;font_manager&nbsp;as&nbsp;fm\nfm.fontManager.__init__()\ncjk_list = &#91;'CJK',&nbsp;'Han',&nbsp;'CN',&nbsp;'TW',&nbsp;'JP']\ncjk_fonts = &#91;f.name&nbsp;for&nbsp;f&nbsp;in&nbsp;fm.fontManager.ttflist&nbsp;if&nbsp;any(s.lower()&nbsp;in&nbsp;f.name.lower()&nbsp;for&nbsp;s&nbsp;in&nbsp;cjk_list)]\nplt.rcParams&#91;'font.family'] = &#91;'DejaVu Sans'] + cjk_fonts\nplt.rcParams&#91;'axes.unicode_minus'] =&nbsp;False\nclass&nbsp;TradingExpectancyCalculator:\n&nbsp; &nbsp;&nbsp;\"\"\"\u4ea4\u6613\u671f\u671b\u503c\u8ba1\u7b97\u5668\"\"\"\n&nbsp; &nbsp;&nbsp;def&nbsp;__init__(self):\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;self.trades_df =&nbsp;None\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;self.metrics = {}\n&nbsp; &nbsp;&nbsp;def&nbsp;calculate_metrics(self, trades_df):\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;\"\"\"\u8ba1\u7b97\u671f\u671b\u503c\u76f8\u5173\u6307\u6807\"\"\"\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;self.trades_df = trades_df\n&nbsp; &nbsp; &nbsp; &nbsp; total_trades =&nbsp;len(self.trades_df)\n&nbsp; &nbsp; &nbsp; &nbsp; winning_trades =&nbsp;self.trades_df&#91;self.trades_df&#91;'pnl'] &gt;&nbsp;0]\n&nbsp; &nbsp; &nbsp; &nbsp; losing_trades =&nbsp;self.trades_df&#91;self.trades_df&#91;'pnl'] &lt;=&nbsp;0]\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# \u57fa\u7840\u6307\u6807\n&nbsp; &nbsp; &nbsp; &nbsp; win_rate =&nbsp;len(winning_trades) \/ total_trades\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# \u5e73\u5747\u76c8\u4e8f\n&nbsp; &nbsp; &nbsp; &nbsp; avg_win = winning_trades&#91;'pnl'].mean()&nbsp;if&nbsp;len(winning_trades) &gt;&nbsp;0&nbsp;else&nbsp;0\n&nbsp; &nbsp; &nbsp; &nbsp; avg_loss =&nbsp;abs(losing_trades&#91;'pnl'].mean())&nbsp;if&nbsp;len(losing_trades) &gt;&nbsp;0&nbsp;else&nbsp;0\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# \u671f\u671b\u503c\n&nbsp; &nbsp; &nbsp; &nbsp; expectancy = (win_rate * avg_win) - ((1&nbsp;- win_rate) * avg_loss)\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# \u5229\u6da6\u56e0\u5b50\n&nbsp; &nbsp; &nbsp; &nbsp; total_profit = winning_trades&#91;'pnl'].sum()\n&nbsp; &nbsp; &nbsp; &nbsp; total_loss =&nbsp;abs(losing_trades&#91;'pnl'].sum())\n&nbsp; &nbsp; &nbsp; &nbsp; profit_factor = total_profit \/ total_loss&nbsp;if&nbsp;total_loss &gt;&nbsp;0&nbsp;else&nbsp;float('inf')\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;self.metrics = {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u603b\u4ea4\u6613\u6b21\u6570': total_trades,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u80dc\u7387':&nbsp;f\"{win_rate:.2%}\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u5e73\u5747\u76c8\u5229': avg_win,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u5e73\u5747\u4e8f\u635f': avg_loss,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u76c8\u4e8f\u6bd4':&nbsp;f\"{avg_win\/avg_loss:.2f}:1\"&nbsp;if&nbsp;avg_loss &gt;&nbsp;0&nbsp;else&nbsp;\"N\/A\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u671f\u671b\u503c': expectancy,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u5229\u6da6\u56e0\u5b50': profit_factor,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'\u603b\u76c8\u5229':&nbsp;self.trades_df&#91;'pnl'].sum()\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;self.metrics\ndef&nbsp;generate_sample_data(num_trades=100):\n&nbsp; &nbsp;&nbsp;\"\"\"\u751f\u6210\u793a\u4f8b\u4ea4\u6613\u6570\u636e\"\"\"\n&nbsp; &nbsp; np.random.seed(42)\n&nbsp; &nbsp;&nbsp;# \u6a21\u62df\u4e00\u4e2a\u80dc\u738740%\uff0c\u76c8\u4e8f\u6bd42.5:1\u7684\u7b56\u7565\n&nbsp; &nbsp; win_rate =&nbsp;0.4\n&nbsp; &nbsp; avg_win =&nbsp;250\n&nbsp; &nbsp; avg_loss =&nbsp;100\n&nbsp; &nbsp; trades = &#91;]\n&nbsp; &nbsp;&nbsp;for&nbsp;i&nbsp;in&nbsp;range(num_trades):\n&nbsp; &nbsp; &nbsp; &nbsp; is_win = np.random.random() &lt; win_rate\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;is_win:\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pnl = np.random.normal(avg_win,&nbsp;50)\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;else:\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pnl = -np.random.normal(avg_loss,&nbsp;20)\n&nbsp; &nbsp; &nbsp; &nbsp; trades.append({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'trade_id': i +&nbsp;1,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'pnl':&nbsp;round(pnl,&nbsp;2)\n&nbsp; &nbsp; &nbsp; &nbsp; })\n&nbsp; &nbsp;&nbsp;return&nbsp;pd.DataFrame(trades)\n# \u4f7f\u7528\u793a\u4f8b\nif&nbsp;__name__ ==&nbsp;\"__main__\":\n&nbsp; &nbsp;&nbsp;# \u751f\u6210\u793a\u4f8b\u6570\u636e\n&nbsp; &nbsp; trades_data = generate_sample_data(100)\n&nbsp; &nbsp;&nbsp;# \u8ba1\u7b97\u6307\u6807\n&nbsp; &nbsp; calculator = TradingExpectancyCalculator()\n&nbsp; &nbsp; metrics = calculator.calculate_metrics(trades_data)\n&nbsp; &nbsp;&nbsp;# \u6253\u5370\u7ed3\u679c\n&nbsp; &nbsp;&nbsp;print(\"\u4ea4\u6613\u7b56\u7565\u671f\u671b\u503c\u5206\u6790\u62a5\u544a\")\n&nbsp; &nbsp;&nbsp;print(\"=\"&nbsp;*&nbsp;40)\n&nbsp; &nbsp;&nbsp;for&nbsp;key, value&nbsp;in&nbsp;metrics.items():\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;key&nbsp;in&nbsp;&#91;'\u5e73\u5747\u76c8\u5229',&nbsp;'\u5e73\u5747\u4e8f\u635f',&nbsp;'\u671f\u671b\u503c',&nbsp;'\u603b\u76c8\u5229']:\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f\"{key:10}: \u00a5{value:.2f}\")\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;elif&nbsp;key ==&nbsp;'\u5229\u6da6\u56e0\u5b50':\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f\"{key:10}:&nbsp;{value:.2f}\")\n&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;else:\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f\"{key:10}:&nbsp;{value}\")<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5b9e\u73b0\u4e86\u4ee5\u4e0b\u529f\u80fd\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6570\u636e\u751f\u6210\uff1a\u81ea\u52a8\u751f\u6210\u6a21\u62df\u4ea4\u6613\u6570\u636e\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u6307\u6807\u8ba1\u7b97\uff1a\u81ea\u52a8\u8ba1\u7b97\u80dc\u7387\u3001\u671f\u671b\u503c\u3001\u5229\u6da6\u56e0\u5b50\u7b49\u5173\u952e\u6307\u6807\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u4e2d\u6587\u652f\u6301\uff1a\u5b8c\u7f8e\u652f\u6301\u4e2d\u6587\u663e\u793a\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u6613\u4e8e\u6269\u5c55\uff1a\u53ef\u4ee5\u8f7b\u677e\u6dfb\u52a0\u66f4\u591a\u5206\u6790\u529f\u80fd\u3002<\/strong><\/li>\n<\/ul>\n\n\n\n<p><strong>\ud83d\udd16<\/strong><strong>\u4f7f\u7528\u5efa\u8bae<\/strong><\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u5c06\u81ea\u5df1\u7684\u4ea4\u6613\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u683c\u5f0f\uff0c\u7136\u540e\u4fee\u6539\u4ee3\u7801\u4e2d\u7684\u6570\u636e\u52a0\u8f7d\u90e8\u5206\uff0c\u5373\u53ef\u5206\u6790\u81ea\u5df1\u7684\u4ea4\u6613\u7b56\u7565\u8868\u73b0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/Vk07qSNq7L08fgSEwkPEJh1ibfWNCypdAXXFczcjTdQdrKedZATGeC5vAOsbb9vyZmCoiaHtLFfntGicibOKBUyyPw\/640?wx_fmt=png&amp;from=appmsg\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>\u7531\u4e8e\u7bc7\u5e45\u5173\u7cfb\uff0c\u4e0b\u8f7d\u5b8c\u6574\u4ee3\u7801\u8bf7\u632a\u6b65CSDN\u4e0b\u8f7d\u3002<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/Vk07qSNq7L08fgSEwkPEJh1ibfWNCypdAwvzszBAz8Eibfg15cdFkbvwm6lJK0UtoOyVic3tDSxKBYK38Zfcnv4Fg\/640?wx_fmt=png&amp;from=appmsg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u7a0b\u5e8f\u5458\u5927\u672c\u8425\uff08CSDN\uff09\u5b8c\u6574\u4ee3\u7801\u5730\u5740\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_70955880\/article\/details\/155581009?spm=1001.2014.3001.5502\">https:\/\/blog.csdn.net\/weixin_70955880\/article\/details\/155581009?spm=1001.2014.3001.5502<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e94\u3001\u5b9e\u6218\u6848\u4f8b<\/strong><\/h2>\n\n\n\n<p>\u8ba9\u6211\u4eec\u901a\u8fc7\u5b9e\u9645\u6570\u636e\u6765\u5bf9\u6bd4\u4e09\u79cd\u5178\u578b\u7684\u4ea4\u6613\u7b56\u7565\uff0c\u770b\u770b\u5b83\u4eec\u7684\u671f\u671b\u503c\u8868\u73b0\u5982\u4f55\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">\u7b56\u7565\u7c7b\u578b<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u80dc\u7387<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u76c8\u4e8f\u6bd4<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u671f\u671b\u503c<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u7279\u70b9<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u9002\u5408\u4eba\u7fa4<\/th><\/tr><\/thead><tbody><tr><td><strong>\u9ad8\u9891\u4ea4\u6613<\/strong><\/td><td>60%<\/td><td>1.2:1<\/td><td>+\u00a512<\/td><td>\u4ea4\u6613\u9891\u7e41\uff0c\u5355\u7b14\u76c8\u5229\u5c0f<\/td><td>\u4e13\u4e1a\u4ea4\u6613\u8005<\/td><\/tr><tr><td><strong>\u6ce2\u6bb5\u4ea4\u6613<\/strong><\/td><td>45%<\/td><td>2.5:1<\/td><td>+\u00a557.5<\/td><td>\u6301\u4ed3\u51e0\u5929\u5230\u51e0\u5468<\/td><td>\u517c\u804c\u4ea4\u6613\u8005<\/td><\/tr><tr><td><strong>\u8d8b\u52bf\u8ddf\u8e2a<\/strong><\/td><td>35%<\/td><td>4:1<\/td><td>+\u00a560<\/td><td>\u6301\u4ed3\u6570\u6708\uff0c\u6293\u5927\u8d8b\u52bf<\/td><td>\u8010\u5fc3\u6295\u8d44\u8005<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4ece\u8fd9\u4e2a\u5bf9\u6bd4\u4e2d\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u51e0\u4e2a\u91cd\u8981\u89c4\u5f8b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u80dc\u7387\u4e0e\u76c8\u4e8f\u6bd4\u6210\u53cd\u6bd4\uff1a\u8ffd\u6c42\u9ad8\u80dc\u7387\u5f80\u5f80\u4f1a\u964d\u4f4e\u76c8\u4e8f\u6bd4\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u671f\u671b\u503c\u624d\u662f\u5173\u952e\uff1a\u4f4e\u80dc\u7387\u7b56\u7565\u53ef\u80fd\u6709\u66f4\u9ad8\u7684\u671f\u671b\u503c\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u627e\u5230\u9002\u5408\u81ea\u5df1\u7684\u7b56\u7565\uff1a\u6839\u636e\u4e2a\u4eba\u6027\u683c\u548c\u65f6\u95f4\u9009\u62e9\u5408\u9002\u7684\u7b56\u7565\u3002<\/strong><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u516d\u3001\u5982\u4f55\u4f18\u5316\u4ea4\u6613\u671f\u671b\u503c<\/strong><\/h2>\n\n\n\n<p>\u77e5\u9053\u4e86\u671f\u671b\u503c\u7684\u91cd\u8981\u6027\u540e\uff0c\u6211\u4eec\u6765\u770b\u770b\u5982\u4f55\u4f18\u5316\u81ea\u5df1\u7684\u4ea4\u6613\u7b56\u7565\uff0c\u63d0\u9ad8\u671f\u671b\u503c\uff1a<\/p>\n\n\n\n<p><strong>\u4f18\u5316\u65b9\u5411\u4e00\uff1a\u63d0\u9ad8\u80dc\u7387<\/strong><\/p>\n\n\n\n<p><strong>\u6539\u8fdb\u5165\u573a\u65f6\u673a<\/strong>\uff1a\u4f7f\u7528\u591a\u91cd\u786e\u8ba4\u4fe1\u53f7\uff0c\u907f\u514d\u76f2\u76ee\u5165\u573a<strong>\u4f18\u5316\u6b62\u635f\u4f4d\u7f6e<\/strong>\uff1a\u8bbe\u7f6e\u66f4\u5408\u7406\u7684\u6b62\u635f\u70b9\uff0c\u51cf\u5c11\u88ab\u9707\u51fa\u7684\u6982\u7387<strong>\u9009\u62e9\u5408\u9002\u54c1\u79cd<\/strong>\uff1a\u4e13\u6ce8\u4e8e\u81ea\u5df1\u719f\u6089\u7684\u4ea4\u6613\u54c1\u79cd<\/p>\n\n\n\n<p><strong>\u4f18\u5316\u65b9\u5411\u4e8c\uff1a\u63d0\u9ad8\u76c8\u4e8f\u6bd4<\/strong><\/p>\n\n\n\n<p><strong>\u8ba9\u5229\u6da6\u5954\u8dd1<\/strong>\uff1a\u4e0d\u8981\u56e0\u4e3a\u5c0f\u5229\u6da6\u5c31\u6025\u4e8e\u5e73\u4ed3<strong>\u52a8\u6001\u6b62\u76c8<\/strong>\uff1a\u4f7f\u7528\u79fb\u52a8\u6b62\u635f\u6216\u5206\u6279\u6b62\u76c8<strong>\u63a7\u5236\u4e8f\u635f<\/strong>\uff1a\u4e25\u683c\u6267\u884c\u6b62\u635f\uff0c\u4e0d\u625b\u5355<\/p>\n\n\n\n<p><strong>\u4f18\u5316\u65b9\u5411\u4e09\uff1a\u8d44\u91d1\u7ba1\u7406<\/strong><\/p>\n\n\n\n<p><strong>\u51ef\u5229\u516c\u5f0f<\/strong>\uff1a\u4ed3\u4f4d = (\u80dc\u7387 \u00d7 \u76c8\u4e8f\u6bd4 &#8211; \u8d25\u7387) \u00f7 \u76c8\u4e8f\u6bd4<strong>\u5206\u6563\u6295\u8d44<\/strong>\uff1a\u4e0d\u8981\u628a\u6240\u6709\u8d44\u91d1\u6295\u5165\u5355\u4e00\u7b56\u7565<strong>\u5b9a\u671f\u56de\u987e<\/strong>\uff1a\u5206\u6790\u4ea4\u6613\u8bb0\u5f55\uff0c\u627e\u51fa\u6539\u8fdb\u70b9<\/p>\n\n\n\n<p><strong>\ud83d\uded1<\/strong><strong>\u91cd\u8981\u63d0\u9192<\/strong><\/p>\n\n\n\n<p>\u671f\u671b\u503c\u662f\u57fa\u4e8e\u5386\u53f2\u6570\u636e\u7684\u7edf\u8ba1\u7ed3\u679c\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u672a\u6765\u8868\u73b0\u3002\u5e02\u573a\u662f\u52a8\u6001\u53d8\u5316\u7684\uff0c\u9700\u8981\u5b9a\u671f\u91cd\u65b0\u8bc4\u4f30\u548c\u8c03\u6574\u7b56\u7565\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e03\u3001\u603b\u7ed3\u4e0e\u884c\u52a8\u6307\u5357<\/strong><\/h2>\n\n\n\n<p>\u901a\u8fc7\u672c\u6587\uff0c\u76f8\u4fe1\u4f60\u5df2\u7ecf\u7406\u89e3\u4e86\u4ea4\u6613\u671f\u671b\u503c\u7684\u91cd\u8981\u6027\u3002\u8bb0\u4f4f\u8fd9\u4e9b\u5173\u952e\u70b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u671f\u671b\u503c\u662f\u9ec4\u91d1\u6807\u51c6\uff1a\u6bd4\u80dc\u7387\u3001\u76c8\u4e8f\u6bd4\u66f4\u80fd\u53cd\u6620\u7b56\u7565\u4ef7\u503c\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u6b63\u671f\u671b\u503c\u662f\u5173\u952e\uff1a\u53ea\u6709\u6b63\u671f\u671b\u503c\u7b56\u7565\u624d\u80fd\u957f\u671f\u76c8\u5229\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u80dc\u7387\u4e0d\u662f\u4e00\u5207\uff1a\u9ad8\u80dc\u7387\u7b56\u7565\u53ef\u80fd\u671f\u671b\u503c\u4e3a\u8d1f\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u76c8\u4e8f\u6bd4\u5f88\u91cd\u8981\uff1a\u4f4e\u80dc\u7387\u7b56\u7565\u53ef\u4ee5\u901a\u8fc7\u9ad8\u76c8\u4e8f\u6bd4\u83b7\u5229\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u4e25\u683c\u6267\u884c\u7eaa\u5f8b\uff1a\u518d\u597d\u7684\u7b56\u7565\u4e5f\u9700\u8981\u7eaa\u5f8b\u6267\u884c\u3002<\/strong><\/li>\n<\/ol>\n\n\n\n<p><strong>\u4e0b\u4e00\u6b65\u884c\u52a8<\/strong>\uff1a\u7acb\u5373\u5f00\u59cb\u8bb0\u5f55\u4f60\u7684\u4ea4\u6613\u6570\u636e\uff0c\u4f7f\u7528\u672c\u6587\u63d0\u4f9b\u7684\u4ee3\u7801\u8ba1\u7b97\u4f60\u7684\u7b56\u7565\u671f\u671b\u503c\u3002\u5982\u679c\u53d1\u73b0\u671f\u671b\u503c\u4e3a\u8d1f\uff0c\u53ca\u65f6\u8c03\u6574\u6216\u505c\u6b62\u8be5\u7b56\u7565\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u89c9\u5f97\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9\uff0c\u8bb0\u5f97\u5206\u4eab\u7ed9\u66f4\u591a\u7684\u670b\u53cb\u3002\u6709\u4ec0\u4e48\u95ee\u9898\u53ef\u4ee5\u5728\u8bc4\u8bba\u533a\u7559\u8a00\uff0c\u8001\u4f59\u4f1a\u4e00\u4e00\u89e3\u7b54\u3002\u8ba9\u6211\u4eec\u4e00\u8d77\u5728\u91cf\u5316\u4ea4\u6613\u7684\u9053\u8def\u4e0a\u8d8a\u8d70\u8d8a\u8fdc\uff01<\/p>\n\n\n\n<p>#\u91cf\u5316\u4ea4\u6613&nbsp;#Python\u91d1\u878d&nbsp;#\u91cf\u5316\u6295\u8d44&nbsp;#\u91d1\u878d\u6570\u636e&nbsp;#AI\u6295\u8d44&nbsp;#\u80a1\u7968\u5206\u6790&nbsp;#\u6295\u8d44\u7b56\u7565&nbsp;#\u4ea4\u6613\u5fc3\u7406&nbsp;#\u671f\u671b\u503c<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\">\u98ce\u9669\u63d0\u793a\uff1a\u6295\u8d44\u6709\u98ce\u9669\uff0c\u5165\u5e02\u9700\u8c28\u614e\u3002\u672c\u6587\u4ec5\u4f9b\u5b66\u4e60\u53c2\u8003\uff0c\u4e0d\u6784\u6210\u6295\u8d44\u5efa\u8bae\u3002<\/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\/2025\/12\/12\/%e4%ba%a4%e6%98%93%e6%9c%9f%e6%9c%9b%e5%80%bc%ef%bc%9a%e5%86%b3%e5%ae%9a%e4%bd%a0%e8%83%bd%e5%90%a6%e5%9c%a8%e5%b8%82%e5%9c%ba%e4%b8%ad%e6%b4%bb%e4%b8%8b%e6%9d%a5%e7%9a%84%e5%85%b3%e9%94%ae%e6%8c%87\/\">Continue reading<span class=\"screen-reader-text\">\u4ea4\u6613\u671f\u671b\u503c\uff1a\u51b3\u5b9a\u4f60\u80fd\u5426\u5728\u5e02\u573a\u4e2d\u6d3b\u4e0b\u6765\u7684\u5173\u952e\u6307\u6807\uff08\u5b8c\u6574\u6e90\u4ee3\u7801\uff09<\/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":[17,5],"class_list":{"0":"post-3165","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\/3165","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=3165"}],"version-history":[{"count":5,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/3165\/revisions"}],"predecessor-version":[{"id":3254,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/3165\/revisions\/3254"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=3165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=3165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=3165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}