{"id":1584,"date":"2024-10-31T07:58:00","date_gmt":"2024-10-30T23:58:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=1584"},"modified":"2024-10-06T14:02:11","modified_gmt":"2024-10-06T06:02:11","slug":"%e5%80%9f-ai-%e4%b9%8b%e5%8a%9b%ef%bc%8c%e5%b0%86%e5%90%84%e7%b1%bb%e9%87%8f%e5%8c%96%e9%87%91%e8%9e%8d%e8%ae%ba%e6%96%87%e8%87%aa%e5%8a%a8%e8%bd%ac%e6%88%90%e5%8f%af%e6%89%a7%e8%a1%8c%e4%ba%a4","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2024\/10\/31\/%e5%80%9f-ai-%e4%b9%8b%e5%8a%9b%ef%bc%8c%e5%b0%86%e5%90%84%e7%b1%bb%e9%87%8f%e5%8c%96%e9%87%91%e8%9e%8d%e8%ae%ba%e6%96%87%e8%87%aa%e5%8a%a8%e8%bd%ac%e6%88%90%e5%8f%af%e6%89%a7%e8%a1%8c%e4%ba%a4\/","title":{"rendered":"\u501f AI \u4e4b\u529b\uff0c\u5c06\u5404\u7c7b\u91cf\u5316\u91d1\u878d\u8bba\u6587\u81ea\u52a8\u8f6c\u6210\u53ef\u6267\u884c\u4ea4\u6613\u7b97\u6cd5"},"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 decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/10\/1_Y3OUoSp.png\" alt=\"\" class=\"wp-image-2417\"\/><\/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>\u672c\u6587\u4ecb\u7ecd\u4e86\u4e00\u79cd\u901a\u8fc7 AI \u6280\u672f\u9a71\u52a8\u7684\u81ea\u52a8\u5316\u5de5\u4f5c\u6d41\uff0c\u7528\u4e8e<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u5c06\u5404\u7c7b\u91cf\u5316\u91d1\u878d\u8bba\u6587\u81ea\u52a8\u8f6c\u5316\u4e3a\u53ef\u6267\u884c\u7684\u4ea4\u6613\u7b97\u6cd5<\/mark>\u53ca\u9644\u5e26\u56de\u6eaf\u6d4b\u8bd5\u4ee3\u7801\uff0c\u672c\u6587\u6700\u540e\u8fd8\u8bf4\u660e\u4e86\u8be5\u5de5\u5177\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u521d\u6b65\u6d4b\u8bd5\u7ed3\u679c\u3002<\/pre>\n<\/blockquote>\n\n\n\n<p>\u91cf\u5316\u91d1\u878d\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u4f9d\u8d56\u4e8e\u4ece\u5927\u91cf\u7814\u7a76\u4e2d\u5f97\u51fa\u7684\u6570\u636e\u9a71\u52a8\u7b56\u7565\u3002\u7136\u800c\uff0c\u5c06\u5bc6\u96c6\u7684\u5b66\u672f\u8bba\u6587\u4e2d\u7684\u89c1\u89e3\u8f6c\u5316\u4e3a\u53ef\u6267\u884c\u7684\u4ea4\u6613\u7b97\u6cd5\u65e2\u8017\u65f6\u53c8\u5bb9\u6613\u51fa\u9519\u3002\u867d\u7136\u521b\u5efa\u4e00\u4e2a\u53ef\u7acb\u5373\u6295\u5165\u751f\u4ea7\u7684\u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u65e0\u6cd5\u7acb\u5373\u5b9e\u73b0\uff0c\u4f46\u6211\u4eec\u7684<strong>\u76ee\u6807\u662f\u5728\u51e0\u79d2\u949f\u5185\u4e3a QuantConnect \u751f\u6210\u6a21\u677f\u4ee3\u7801<\/strong>\u3002\u8fd9\u4e9b\u521d\u59cb\u4ee3\u7801\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u786e\u5b9a\u8fd9\u7bc7\u8bba\u6587\u662f\u5426\u63d0\u51fa\u4e86\u6709\u524d\u9014\u7684\u7b56\u7565\uff0c\u662f\u503c\u5f97\u8fdb\u4e00\u6b65\u7814\u7a76\uff0c\u8fd8\u662f\u5e94\u8be5\u653e\u5f03\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u4f1a\u8be6\u7ec6\u8bf4\u660e\u5982\u4f55\u8fd0\u884c\u8fd9\u6bb5\u4ee3\u7801\uff08<strong>\u53ef\u5728\u6211\u7684 <a href=\"https:\/\/github.com\/alexyu2013\/Article_to_Code\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a> \u4e0a\u83b7\u53d6<\/strong>\uff09\uff0c\u5e76\u4ecb\u7ecd\u6211\u4eec\u7684\u521d\u6b65\u6d4b\u8bd5\u7ed3\u679c\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u6211\u4eec\u7684\u65b9\u6cd5\u91c7\u7528\u4e86\u7ebf\u6027\u5de5\u4f5c\u6d41\u7a0b\uff0c\u6682\u65f6\u6401\u7f6e\u4e86\u53cc\u4ee3\u7406\u67b6\u6784\u3002\u8be5\u5de5\u5177\u4e0d\u4ec5\u80fd\u4ece PDF \u6587\u7ae0\u4e2d\u63d0\u53d6\u548c\u603b\u7ed3\u5173\u952e\u4ea4\u6613\u7b56\u7565\u548c\u98ce\u9669\u7ba1\u7406\u6280\u672f\uff0c\u8fd8\u80fd\u751f\u6210\u8bed\u6cd5\u6b63\u786e\u7684 QuantConnect Python \u4ee3\u7801\uff0c\u5e76\u5e26\u6709\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\uff0c\u4fbf\u4e8e\u67e5\u770b\u3002<\/p>\n\n\n\n<p>\u521d\u6b65\u6d4b\u8bd5\u663e\u793a\uff0c\u751f\u6210\u7684\u4ee3\u7801\u65e0\u8bef\uff0c\u4f46\u5c1a\u672a\u5728\u6240\u6709\u6d4b\u8bd5\u4e2d\u8fbe\u6210 100%\u7684\u51c6\u786e\u7387\u3002\u8be5\u5de5\u5177\u7684 NLP \u90e8\u5206\u8fd0\u7528\u4e86\u57fa\u7840\u6280\u672f\uff0c\u4ecd\u6709\u63d0\u5347\u7a7a\u95f4\u3002\u5373\u4fbf\u5982\u6b64\uff0c\u6211\u4ecd\u51b3\u5b9a\u8fc5\u901f\u53d1\u5e03\u4ee3\u7801\uff0c\u4f5c\u4e3a\u8fd9\u4e00\u5feb\u901f\u53d1\u5c55\u9886\u57df\u7684\u6982\u5ff5\u9a8c\u8bc1\u3002\u8be5\u9879\u76ee\u4ecd\u5728\u63a8\u8fdb\uff0c\u4e14\u4f1a\u968f\u65f6\u95f4\u63a8\u79fb\u6301\u7eed\u5b8c\u5584\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u4eca\u5929\u6211\u5728\u8fd9\u91cc\u4ecb\u7ecd\u7684\u662f\u5b83\u7684<strong>\u6d4b\u8bd5\u7248<\/strong>\u3002\u8fd9\u4e2a\u81ea\u52a8\u5316\u5de5\u5177\u7684\u6838\u5fc3\u5728\u4e8e ArticleProcessor \u7c7b\uff0c\u5b83\u534f\u8c03\u4e86\u4ece PDF \u63d0\u53d6\u5230\u4ee3\u7801\u751f\u6210\u7684\u6574\u4e2a\u5de5\u4f5c\u6d41\u7a0b\u3002\u4e0b\u9762\u662f\u5b83\u7684\u529f\u80fd\u5206\u89e3\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e00\u3001\u4f7f\u7528 pdfplumber \u63d0\u53d6 PDF \u6587\u672c<\/strong><\/h3>\n\n\n\n<p>\u6211\u4eec\u4ece\u4f7f\u7528 pdfplumber \u5e93\u52a0\u8f7d\u548c\u63d0\u53d6\u91cf\u5316\u91d1\u878d\u8bba\u6587 PDF \u683c\u5f0f\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u5f00\u59cb\u3002\u4e0e\u5176\u4ed6 PDF \u89e3\u6790\u5de5\u5177\u4e0d\u540c\uff0cpdfplumber \u5177\u6709\u8d85\u9ad8\u7684\u51c6\u786e\u6027\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u5b66\u672f\u6587\u7ae0\u4e2d\u5e38\u89c1\u7684\u590d\u6742\u5e03\u5c40\u65f6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def load_pdf(self, pdf_path: str) -&gt; str:\n    try:\n        text = \"\"\n        with pdfplumber.open(pdf_path) as pdf:\n            for page in pdf.pages:\n                page_text = page.extract_text()\n                if page_text:\n                    text += page_text + \"\\n\"\n        logging.info(\"PDF loaded successfully.\")\n        return text\n    except Exception as e:\n        logging.error(f\"Failed to load PDF: {e}\")\n        return \"\"<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u6587\u672c\u9884\u5904\u7406<\/strong><\/h3>\n\n\n\n<p>\u63d0\u53d6\u6587\u672c\u540e\uff0c\u5fc5\u987b\u5bf9\u5176\u8fdb\u884c\u6e05\u6d17\u548c\u9884\u5904\u7406\u3002\u8fd9\u5305\u62ec\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5220\u9664 URL\u3001\u9875\u7709\u3001\u9875\u811a\u3001\u72ec\u7acb\u6570\u5b57\uff08\u5982\u9875\u7801\uff09\u548c\u5176\u4ed6\u65e0\u5173\u5185\u5bb9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def preprocess_text(self, text: str) -&gt; str:\n    try:\n        text = re.sub(r'https?:\/\/\\S+', '', text)\n        text = re.sub(r'Electronic copy available at: .*', '', text)\n        text = re.sub(r'^\\d+\\s*$', '', text, flags=re.MULTILINE)\n        text = re.sub(r'\\n+', '\\n', text)\n        text = re.sub(r'^\\s*(Author|Title|Abstract)\\s*$', '', text, flags=re.MULTILINE | re.IGNORECASE)\n        text = text.strip()\n        logging.info(\"Text preprocessed successfully.\")\n        return text\n    except Exception as e:\n        logging.error(f\"Failed to preprocess text: {e}\")\n        return \"\"<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e09\u3001\u5229\u7528 SpaCy \u8fdb\u884c\u5206\u6790<\/strong><\/h3>\n\n\n\n<p>\u4e86\u89e3\u6587\u7ae0\u7ed3\u6784\u81f3\u5173\u91cd\u8981\u3002\u5229\u7528 SpaCy \u7684 NLP \u529f\u80fd\uff0c\u8be5\u5de5\u5177\u53ef\u6839\u636e\u53e5\u5b50\u957f\u5ea6\u548c\u6807\u9898\u683c\u5f0f\u7b49\u542f\u53d1\u5f0f\u65b9\u6cd5\u8bc6\u522b\u7ae0\u8282\u6807\u9898\u3002\u8fd9\u79cd\u7ec6\u5206\u6709\u52a9\u4e8e\u7ec4\u7ec7\u5185\u5bb9\uff0c\u8fdb\u884c\u66f4\u6709\u6548\u7684\u5206\u6790\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def detect_headings(self, text: str) -&gt; List&#91;str]:\n    try:\n        doc = self.nlp(text)\n        headings = &#91;]\n        for sent in doc.sents:\n            sent_text = sent.text.strip()\n            if len(sent_text.split()) &lt; 10 and sent_text.istitle():\n                headings.append(sent_text)\n        logging.info(f\"Detected {len(headings)} headings.\")\n        return headings\n    except Exception as e:\n        logging.error(f\"Failed to detect headings: {e}\")\n        return &#91;]<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u56db\u3001\u5206\u6bb5\u548c\u5173\u952e\u8bcd\u5206\u6790<\/strong><\/h3>\n\n\n\n<p>\u786e\u5b9a\u6807\u9898\u540e\uff0c\u6587\u672c\u5c06\u88ab\u5206\u6210\u76f8\u5e94\u7684\u90e8\u5206\u3002\u7136\u540e\uff0c\u8be5\u5de5\u5177\u4f1a\u6267\u884c\u5173\u952e\u5b57\u5206\u6790\uff0c\u5c06\u53e5\u5b50\u5f52\u7c7b\u4e3a<strong>trading_signal<\/strong>\uff08\u4ea4\u6613\u4fe1\u53f7\uff09\u548c <strong>risk_management<\/strong>\uff08\u98ce\u9669\u7ba1\u7406\uff09\u3002\u8fd9\u79cd\u5206\u7c7b\u4ee5\u9884\u5b9a\u4e49\u7684\u76f8\u5173\u5173\u952e\u8bcd\u5217\u8868\u4e3a\u57fa\u7840\uff0c\u786e\u4fdd\u53ea\u5bf9\u76f8\u5173\u4fe1\u606f\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def keyword_analysis(self, sections: Dict&#91;str, str]) -&gt; Dict&#91;str, List&#91;str]]:\n    keyword_map = defaultdict(list)\n    \n    risk_management_keywords = &#91;\n        \"drawdown\", \"volatility\", \"reduce\", \"limit\", \"risk\", \"risk-adjusted\", \n        \"maximal drawdown\", \"market volatility\", \"bear markets\", \"stability\", \n        \"sidestep\", \"reduce drawdown\", \"stop-loss\", \"position sizing\", \"hedging\"\n    ]\n    trading_signal_keywords = &#91;\n        \"buy\", \"sell\", \"signal\", \"indicator\", \"trend\", \"SMA\", \"moving average\", \n        \"momentum\", \"RSI\", \"MACD\", \"bollinger bands\", \"Rachev ratio\", \"stay long\", \n        \"exit\", \"market timing\", \"yield curve\", \"recession\", \"unemployment\", \n        \"housing starts\", \"Treasuries\", \"economic indicator\"\n    ]\n    \n    irrelevant_patterns = &#91;\n        r'figure \\d+',  \n        r'\\&#91;\\d+\\]',     \n        r'\\(.*?\\)',     \n        r'chart',       \n        r'\\bfigure\\b',  \n        r'performance chart',  \n        r'\\d{4}-\\d{4}',  \n        r'^\\s*$'        \n    ]\n    \n    processed_sentences = set()\n    \n    for section, content in sections.items():\n        doc = self.nlp(content)\n        for sent in doc.sents:\n            sent_text = sent.text.lower().strip()\n            \n            if any(re.search(pattern, sent_text) for pattern in irrelevant_patterns):\n                continue\n            if sent_text in processed_sentences:\n                continue\n            processed_sentences.add(sent_text)\n            \n            if any(kw in sent_text for kw in trading_signal_keywords):\n                keyword_map&#91;'trading_signal'].append(sent.text.strip())\n            elif any(kw in sent_text for kw in risk_management_keywords):\n                keyword_map&#91;'risk_management'].append(sent.text.strip())\n    \n    for category, sentences in keyword_map.items():\n        unique_sentences = list(set(sentences))\n        keyword_map&#91;category] = sorted(unique_sentences, key=len)\n    \n    logging.info(\"Keyword analysis completed.\")\n    return keyword_map<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e94\u3001\u4f7f\u7528 OpenAI \u7684 GPT-4o \u751f\u6210\u6458\u8981\u548c QuantConnect \u4ee3\u7801<\/strong><\/h3>\n\n\n\n<p>\u5229\u7528 OpenAI \u7684 GPT-4o \u53ef\u751f\u6210\u63d0\u53d6\u7b56\u7565\u548c\u98ce\u9669\u7ba1\u7406\u6280\u672f\u7684\u7b80\u660e\u6458\u8981\u3002\u5b83\u80fd\u5c06\u8fd9\u4e9b\u89c1\u89e3\u8f6c\u5316\u4e3a\u529f\u80fd\u5b8c\u5907\u7684 QuantConnect Python \u7b97\u6cd5\uff0c\u786e\u4fdd\u8fd9\u4e9b\u7b97\u6cd5\u7b26\u5408\u6700\u4f73\u5b9e\u8df5\u548c\u8bed\u6cd5\u6b63\u786e\u6027\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def generate_qc_code(self, extracted_data: Dict&#91;str, List&#91;str]]) -&gt; str:\n    trading_signals = '\\n'.join(extracted_data.get('trading_signal', &#91;]))\n    risk_management = '\\n'.join(extracted_data.get('risk_management', &#91;]))\n\n    prompt = f\"\"\"\n    You are an expert QuantConnect algorithm developer. Convert the following trading strategy and risk management descriptions into a complete, error-free QuantConnect Python algorithm.\n\n    ### Trading Strategy:\n    {trading_signals}\n\n    ### Risk Management:\n    {risk_management}\n\n    ### Requirements:\n    1. **Initialize Method**:\n        - Set the start and end dates.\n        - Set the initial cash.\n        - Define the universe selection logic.\n        - Initialize required indicators.\n    2. **OnData Method**:\n        - Implement buy\/sell logic based on indicators.\n        - Ensure indicators are updated correctly.\n    3. **Risk Management**:\n        - Implement drawdown limit of 15%.\n        - Apply position sizing or stop-loss mechanisms as described.\n    4. **Ensure Compliance**:\n        - Use only QuantConnect's supported indicators and methods.\n        - The code must be syntactically correct and free of errors.\n\n    ### Example Structure:\n    ```python\n    from AlgorithmImports import *\n\n    class MyAlgorithm(QCAlgorithm):\n        def Initialize(self):\n            self.SetStartDate(2020, 1, 1)\n            self.SetEndDate(2023, 1, 1)\n            self.SetCash(100000)\n            # Define universe, indicators, etc.\n\n        def OnData(self, data):\n            # Trading logic\n\n        def OnEndOfDay(self):\n            # Risk management\n    ```\n\n    ### Generated Code:\n    ```\n    # The LLM will generate the code after this line\n    ```\n    \"\"\"\n\n    try:\n        response = openai.ChatCompletion.create(\n            model=\"gpt-4o\",\n            messages=&#91;\n                {\"role\": \"system\", \"content\": \"You are a helpful assistant specialized in generating QuantConnect algorithms in Python.\"},\n                {\"role\": \"user\", \"content\": prompt}\n            ],\n            max_tokens=2500,\n            temperature=0.3,\n            n=1\n        )\n        generated_code = response&#91;'choices']&#91;0]&#91;'message']&#91;'content'].strip()\n        code_match = re.search(r'```python(.*?)```', generated_code, re.DOTALL)\n        if code_match:\n            generated_code = code_match.group(1).strip()\n        logging.info(\"Code generated by LLM.\")\n        return generated_code\n    except Exception as e:\n        logging.error(f\"Failed to generate code: {e}\")\n        return \"\"<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u516d\u3001\u7528 Tkinter \u548c Pygments \u663e\u793a\u7ed3\u679c<\/strong><\/h3>\n\n\n\n<p>\u4e3a\u4e86\u63d0\u4f9b\u53cb\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff0c\u8be5\u5de5\u5177\u4f7f\u7528 <strong>Tkinter<\/strong> \u5728\u5355\u72ec\u7684\u7a97\u53e3\u4e2d\u663e\u793a\u6587\u7ae0\u6458\u8981\u548c\u751f\u6210\u7684\u4ee3\u7801\u3002<strong>Pygments <\/strong>\u5e93\u901a\u8fc7\u4e3a Python \u4ee3\u7801\u6dfb\u52a0\u8bed\u6cd5\u9ad8\u4eae\u6765\u63d0\u9ad8\u53ef\u8bfb\u6027\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>def display_summary_and_code(self, summary: str, code: str):\n    # Create the main Tkinter root\n    root = tk.Tk()\n    root.withdraw()  # Hide the root window\n\n    # Summary Window\n    summary_window = tk.Toplevel()\n    summary_window.title(\"Article Summary\")\n    summary_window.geometry(\"800x600\")\n\n    summary_text = scrolledtext.ScrolledText(summary_window, wrap=tk.WORD, font=(\"Arial\", 12))\n    summary_text.pack(expand=True, fill='both')\n    summary_text.insert(tk.END, summary)\n    summary_text.configure(state='disabled')  # Make it read-only\n\n    # Code Window\n    code_window = tk.Toplevel()\n    code_window.title(\"Generated QuantConnect Code\")\n    code_window.geometry(\"1000x800\")\n\n    code_text = scrolledtext.ScrolledText(code_window, wrap=tk.NONE, font=(\"Consolas\", 12), bg=\"#2B2B2B\", fg=\"#F8F8F2\")\n    code_text.pack(expand=True, fill='both')\n\n    # Apply syntax highlighting\n    self.apply_syntax_highlighting(code, code_text)\n\n    code_text.configure(state='disabled')  # Make it read-only. \n\n    # Start the Tkinter event loop\n    root.mainloop()<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e03\u3001\u56de\u6eaf\u6d4b\u8bd5<\/strong><\/h3>\n\n\n\n<p>\u6211\u4eec\u4f7f\u7528 Quantpedia \u4e2d L. Durian \u548c R. Vojtko \u7684\u6587\u7ae0 &#8220;\u5229\u7528\u5e02\u573a\u65f6\u673a\u7b56\u7565\u907f\u5f00\u718a\u5e02&#8221;\u8fdb\u884c\u6d4b\u8bd5\uff0c\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/10\/image-13.png\" alt=\"\" class=\"wp-image-2419\"\/><\/figure>\n\n\n\n<p>\u7b2c\u4e00\u6b21\u8fd0\u884c\u65f6\u751f\u6210\u7684\u4ee3\u7801\u4f1a\u751f\u6210\u4ee5\u4e0b\u56de\u6eaf\u6d4b\u8bd5 \uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/10\/image-14.png\" alt=\"\" class=\"wp-image-2420\"\/><\/figure>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u8be5\u7b97\u6cd5\u5728 2020 \u5e74\u5904\u4e8e\u95f2\u7f6e\u72b6\u6001\uff0c\u8fd9\u6b63\u662f\u89c4\u907f\u79d1\u7ef4\u5fb7\u718a\u5e02\u7684\u7b56\u7565\u6240\u671f\u671b\u7684\u3002\u8fd9\u7bc7\u6587\u7ae0\u4f3c\u4e4e\u786e\u5b9e\u5728\u8bbe\u6cd5\u907f\u514d\u718a\u5e02\uff0c\u7edd\u5bf9\u503c\u5f97\u8fdb\u4e00\u6b65\u7814\u7a76\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u516b\u3001\u89c2\u70b9\u56de\u987e<\/strong><\/h3>\n\n\n\n<p>\u5c06\u5b9a\u91cf\u91d1\u878d\u7814\u7a76\u81ea\u52a8\u8f6c\u5316\u4e3a\u53ef\u6267\u884c\u7684\u4ea4\u6613\u7b97\u6cd5\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u6548\u7387\u3002\u901a\u8fc7\u96c6\u6210 pdfplumber\u3001SpaCy\u3001OpenAI \u7684 GPT-4o\u3001Tkinter \u548c Pygments \u7b49\u5f3a\u5927\u7684\u5e93\uff0c\u8fd9\u6b3e\u57fa\u4e8e Python \u7684\u5de5\u5177\u63d0\u4f9b\u4e86\u4e00\u4e2a\u65e0\u7f1d\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u5728\u7814\u7a76\u548c\u6267\u884c\u4e4b\u95f4\u67b6\u8d77\u4e86\u4e00\u5ea7\u6865\u6881\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u81ea\u52a8\u5316\u5de5\u4f5c\u6d41\u7a0b\u7684\u91cd\u8981\u6027<\/strong>\uff1a\u5c06\u91d1\u878d\u8bba\u6587\u4e2d\u7684\u89c1\u89e3\u81ea\u52a8\u8f6c\u5316\u4e3a\u4ea4\u6613\u7b97\u6cd5\u80fd\u663e\u8457\u63d0\u9ad8\u6548\u7387\uff0c\u51cf\u5c11\u4eba\u4e3a\u9519\u8bef\u3002<\/li>\n\n\n\n<li><strong>\u6280\u672f\u5b9e\u73b0\u7684\u8be6\u7ec6\u6b65\u9aa4<\/strong>\uff1a\u672c\u6587\u8be6\u7ec6\u63cf\u8ff0\u4e86\u4ecePDF\u63d0\u53d6\u5230\u4ee3\u7801\u751f\u6210\u7684\u6574\u4e2a\u6280\u672f\u6d41\u7a0b\uff0c\u5305\u62ec\u4f7f\u7528\u7684\u5e93\u548c\u5de5\u5177\uff0c\u5982<code>pdfplumber<\/code>\u3001SpaCy\u3001GPT-4o\u3001Tkinter\u548cPygments\u3002<\/li>\n\n\n\n<li><strong>\u5173\u952e\u8bcd\u5206\u6790\u7684\u4f5c\u7528<\/strong>\uff1a\u901a\u8fc7\u5173\u952e\u8bcd\u5206\u6790\uff0c\u81ea\u52a8\u5316\u5de5\u5177\u80fd\u591f\u6709\u6548\u5730\u4ece\u6587\u7ae0\u4e2d\u63d0\u53d6\u4ea4\u6613\u7b56\u7565\u548c\u98ce\u9669\u7ba1\u7406\u6280\u672f\uff0c\u786e\u4fdd\u751f\u6210\u7684\u4ee3\u7801\u4ec5\u5305\u542b\u76f8\u5173\u4fe1\u606f\u3002<\/li>\n\n\n\n<li><strong>GPT-4o \u5728\u4ee3\u7801\u751f\u6210\u4e2d\u7684\u5e94\u7528<\/strong>\uff1aGPT-4o \u88ab\u7528\u4e8e\u5c06\u63d0\u53d6\u7684\u7b56\u7565\u548c\u98ce\u9669\u7ba1\u7406\u6280\u672f\u8f6c\u5316\u4e3a\u5b8c\u6574\u3001\u65e0\u8bef\u7684QuantConnect Python\u7b97\u6cd5\u3002<\/li>\n\n\n\n<li><strong>\u7528\u6237\u4f53\u9a8c\u7684\u4f18\u5316<\/strong>\uff1a\u4f7f\u7528Tkinter\u521b\u5efa\u7528\u6237\u53cb\u597d\u7684\u754c\u9762\uff0c\u5e76\u901a\u8fc7Pygments\u5bf9\u4ee3\u7801\u8fdb\u884c\u8bed\u6cd5\u9ad8\u4eae\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/li>\n\n\n\n<li><strong>\u521d\u6b65\u6d4b\u8bd5\u7684\u5c55\u793a<\/strong>\uff1a\u901a\u8fc7\u5bf9\u4e00\u7bc7\u5177\u4f53\u6587\u7ae0\u7684\u6d4b\u8bd5\uff0c\u5c55\u793a\u4e86\u81ea\u52a8\u5316\u5de5\u5177\u7684\u5b9e\u9645\u5e94\u7528\u548c\u6548\u679c\uff0c\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7QuantConnect\u5e73\u53f0\u8fdb\u884c\u56de\u6eaf\u6d4b\u8bd5\u3002<\/li>\n\n\n\n<li><strong>\u7ed3\u8bba\u548c\u672a\u6765\u5c55\u671b<\/strong>\uff1a\u5f3a\u8c03\u81ea\u52a8\u5316\u5de5\u5177\u5728\u91cf\u5316\u91d1\u878d\u7814\u7a76\u548c\u5b9e\u8df5\u4e2d\u7684\u6f5c\u529b\uff0c\u5e76\u9f13\u52b1\u8bfb\u8005\u8fdb\u4e00\u6b65\u63a2\u7d22\u548c\u6539\u8fdb\u8be5\u5de5\u5177\u3002<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"e7bc\"><strong>\u53c2\u8003\u8d44\u6599<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u010eurian, Ladislav and Vojtko, Radovan, Avoid Equity Bear Markets with a Market Timing Strategy (March 23, 2023)<\/strong>. Available at SSRN:&nbsp;<a href=\"https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=4397638\">https:\/\/ssrn.com\/abstract=4397638<\/a>&nbsp;or&nbsp;<a href=\"http:\/\/dx.doi.org\/10.2139\/ssrn.4397638\">http:\/\/dx.doi.org\/10.2139\/ssrn.4397638<\/a><\/li>\n\n\n\n<li><strong>\u6211\u7684 GitHub \u4e0a\u6709\u8be5\u9879\u76ee\u7684\u4ee3\u7801\uff0c\u6b22\u8fce\u4e0b\u8f7d\u5e76\u53c2\u4e0e\u7814\u7a76<\/strong><br><a href=\"https:\/\/github.com\/alexyu2013\/Article_to_Code\">https:\/\/github.com\/alexyu2013\/Article_to_Code<\/a><\/li>\n\n\n\n<li><strong>\u4f60\u4eec\u4f1a\u7528\u5230\u7684QuantConnect \u5e73\u53f0\u5730\u5740<\/strong><br><a href=\"https:\/\/www.quantconnect.com\/\">https:\/\/www.quantconnect.com\/<\/a><\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u611f\u8c22\u60a8\u9605\u8bfb\u5230\u6700\u540e\u3002\u5982\u679c\u5bf9\u6587\u4e2d\u7684\u5185\u5bb9\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u8bf7\u7ed9\u6211\u7559\u8a00\uff0c\u5fc5\u590d\u3002<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u672c<\/mark><\/strong><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\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<\/mark><\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u8f6c\u53d1\u8bf7\u6ce8\u660e\u539f\u4f5c\u8005\u548c\u51fa\u5904\u3002<\/mark><\/strong><\/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\/2024\/10\/31\/%e5%80%9f-ai-%e4%b9%8b%e5%8a%9b%ef%bc%8c%e5%b0%86%e5%90%84%e7%b1%bb%e9%87%8f%e5%8c%96%e9%87%91%e8%9e%8d%e8%ae%ba%e6%96%87%e8%87%aa%e5%8a%a8%e8%bd%ac%e6%88%90%e5%8f%af%e6%89%a7%e8%a1%8c%e4%ba%a4\/\">Continue reading<span class=\"screen-reader-text\">\u501f AI \u4e4b\u529b\uff0c\u5c06\u5404\u7c7b\u91cf\u5316\u91d1\u878d\u8bba\u6587\u81ea\u52a8\u8f6c\u6210\u53ef\u6267\u884c\u4ea4\u6613\u7b97\u6cd5<\/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":[3,5,7],"class_list":{"0":"post-1584","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-aiinvest","7":"tag-ai","9":"tag-7","10":"entry"},"_links":{"self":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1584","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=1584"}],"version-history":[{"count":1,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1584\/revisions"}],"predecessor-version":[{"id":1585,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1584\/revisions\/1585"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=1584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=1584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}