{"id":1810,"date":"2025-01-19T07:49:00","date_gmt":"2025-01-18T23:49:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=1810"},"modified":"2025-01-18T19:01:32","modified_gmt":"2025-01-18T11:01:32","slug":"%e3%80%82%e3%80%82%e3%80%82%e7%a7%91%e6%8a%80%e8%82%a1%e9%a2%84%e6%b5%8b%e6%96%b0%e5%88%a9%e5%99%a8%ef%bc%9anlp%e6%83%85%e7%bb%aa%e5%88%86%e6%9e%90%e4%b8%8e%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0","status":"publish","type":"post","link":"https:\/\/www.laoyulaoyu.com\/index.php\/2025\/01\/19\/%e3%80%82%e3%80%82%e3%80%82%e7%a7%91%e6%8a%80%e8%82%a1%e9%a2%84%e6%b5%8b%e6%96%b0%e5%88%a9%e5%99%a8%ef%bc%9anlp%e6%83%85%e7%bb%aa%e5%88%86%e6%9e%90%e4%b8%8e%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0\/","title":{"rendered":"\u79d1\u6280\u80a1\u9884\u6d4b\u65b0\u5229\u5668\uff1aNLP\u60c5\u7eea\u5206\u6790\u4e0e\u673a\u5668\u5b66\u4e60\u7684\u5b8c\u7f8e\u878d\u5408\uff08\u4e8c\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 decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/122502.png\" alt=\"\" class=\"wp-image-3559\"\/><\/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\u662f<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u63a2\u8ba8NLP\u60c5\u611f\u5206\u6790\u4e0e\u673a\u5668\u5b66\u4e60\u5982\u4f55\u5b8c\u7f8e\u878d\u5408\u7684\u7b2c\u4e8c\u7bc7<\/mark>\uff0c\u5728\u672c\u7bc7\u4e2d\u6211\u4eec\u5c06\u63a5\u7740\u4ecb\u7ecd<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">\u901a\u8fc7\u6293\u53d6\u6700\u65b0\u7684\u8c37\u6b4c\u65b0\u95fb\u548c\u4f7f\u7528Yahoo Finance API\u83b7\u53d6\u7684\u8d22\u52a1\u6570\u636e\uff0c<\/mark>\u4e3a\u6295\u8d44\u8005\u63d0\u4f9b\u5373\u65f6\u7684\u5e02\u573a\u6d1e\u5bdf\u548c\u8d22\u52a1\u4fe1\u606f\uff0c\u4ece\u800c\u66f4\u51c6\u786e\u5730\u8bc4\u4f30\u80a1\u7968\u7684\u4ef7\u503c\u3002<\/pre>\n<\/blockquote>\n\n\n\n<p>\u5728\u4e0a\u4e00\u7bc7\u4e2d\uff0c\u6211\u4eec\u4ecb\u7ecd\u4e86\u4ee5NVDA \u80a1\u7968\u4e3a\u4f8b\u7684\u5468\u6807\u91cf\u60c5\u7eea\u8bc4\u5206\u548c\u4ee5AMZN \u80a1\u7968\u4e3a\u4f8b\u7684\u5468\u77e2\u91cf\u60c5\u7eea\u8bc4\u5206\u3002\u73b0\u5728\u6211\u4eec\u5c06\u8fdb\u4e00\u6b65\u7684\u6df1\u5165\u63a2\u8ba8\u5173\u4e8e\u77e2\u91cf\u60c5\u7eea\u8bc4\u5206\u7684\u6280\u672f\u843d\u5730\u3002<\/p>\n\n\n\n<p>\u4e0a\u7bc7\u5730\u5740\uff1a<a href=\"https:\/\/blog.laoyulaoyu.top\/index.php\/2025\/01\/18\/%e7%a7%91%e6%8a%80%e8%82%a1%e9%a2%84%e6%b5%8b%e6%96%b0%e5%88%a9%e5%99%a8%ef%bc%9anlp%e6%83%85%e7%bb%aa%e5%88%86%e6%9e%90%e4%b8%8e%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%ae%8c%e7%be%8e\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u79d1\u6280\u80a1\u9884\u6d4b\u65b0\u5229\u5668\uff1aNLP\u60c5\u7eea\u5206\u6790\u4e0e\u673a\u5668\u5b66\u4e60\u7684\u5b8c\u7f8e\u878d\u5408\uff08\u4e00\uff09<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u6293\u53d6\u8fd1\u671f\u8c37\u6b4c\u65b0\u95fb\u83b7\u5f97\u7684\u77e2\u91cf\u60c5\u7eea\u8bc4\u5206<\/strong><\/h2>\n\n\n\n<p>\u5728\u672c\u8282\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u6293\u53d6\u7ed9\u5b9a\u80a1\u7968\u7684\u8fd1\u671f\u8c37\u6b4c\u65b0\u95fb\u3002\u76ee\u6807\u662f\u4ece\u89e3\u6790\u7684\u65b0\u95fb\u6587\u7ae0\u4e2d\u8861\u91cf\u80a1\u7968\u60c5\u7eea\u5f97\u5206\uff0c\u4e3a\u4e86\u5927\u5bb6\u66f4\u597d\u7406\u89e3\uff0c\u6211\u4eec\u8fd8\u662f\u4ee5AMZN \u80a1\u7968\u4e3a\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 1\uff1a\u57fa\u672c\u5bfc\u5165\u548c\u5b89\u88c5<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>!pip install newspaper3k\n!pip install GoogleNews\n!pip install nltk\n!pip install --upgrade lxml_html_clean\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport datetime as dt\nimport nltk\nfrom nltk.sentiment.vader import SentimentIntensityAnalyzer\nfrom GoogleNews import GoogleNews\nfrom newspaper import Article\nfrom newspaper import Config\nfrom wordcloud import WordCloud, STOPWORDS\n\nnltk.download('vader_lexicon') #required for Sentiment Analysis\nTrue<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 2\uff1a\u641c\u7d22AMZN \u80a1\u7968\u7684\u8c37\u6b4c\u65b0\u95fb<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">now = dt.date.today()\nnow = now.strftime('%m-%d-%Y')\nyesterday = dt.date.today() - dt.timedelta(days = 1)\nyesterday = yesterday.strftime('%m-%d-%Y')\n\nnltk.download('punkt')\nuser_agent = 'Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko\/20100101 Firefox\/78.0'\nconfig = Config()\nconfig.browser_user_agent = user_agent\nconfig.request_timeout = 10\n\n# save the company name in a variable\ncompany_name = input(\"Please provide the name of the Company or a Ticker: \")\n#As long as the company name is valid, not empty...\nif company_name != '':\n    print(f'Searching for and analyzing {company_name}, Please be patient, it might take a while...')\n\n    #Extract News with Google News\n    googlenews = GoogleNews(start=yesterday,end=now)\n    googlenews.search(company_name)\n    result = googlenews.result()\n    #store the results\n    df = pd.DataFrame(result)\n    print(df)\n\nPlease provide the name of the Company or a Ticker:  AMZN\nSearching for and analyzing AMZN, Please be patient, it might take a while...\n                                               title                  media  \\\n0  Exclusive survey: In response to Amazon\u2019s RTO ...           Fast Company   \n1  Amazon workers go on strike in US ahead of Chr...          Yahoo Finance   \n2  Amazon hit by Teamsters strikes during holiday...    The Washington Post   \n3  Will Amazon Shatter the $3 Trillion Ceiling by...  smartphonemagazine.nl   \n4  Teamsters union launches historic nationwide s...           Fox Business   \n5  Amazon workers plan \u2018largest strike\u2019 against c...         Retail Systems   \n6  Brigade Enterprises Could See Rental Gains As ...            NDTV Profit   \n7  Amazon workers to strike at multiple US wareho...                Reuters   \n8  Amazon exits India's Shoppers Stop by selling ...          Fibre2Fashion   \n9  Teamsters say Amazon workers will strike at mu...                    MSN   \n\n            date                   datetime  \\\n0  9 minutes ago 2024-12-19 12:10:44.812096   \n1  9 minutes ago 2024-12-19 12:10:44.828096   \n2  3 minutes ago 2024-12-19 12:16:44.831096   \n3  3 minutes ago 2024-12-19 12:16:44.833096   \n4  9 minutes ago 2024-12-19 12:10:44.835096   \n5  4 minutes ago 2024-12-19 12:15:44.837096   \n6  8 minutes ago 2024-12-19 12:11:44.840096   \n7  9 minutes ago 2024-12-19 12:10:44.842096   \n8  9 minutes ago 2024-12-19 12:10:44.844096   \n9  9 minutes ago 2024-12-19 12:10:44.846096   \n\n                                                desc  \\\n0  Amazon's RTO mandate takes effect in January. ...   \n1  Warehouse workers in cities including New York...   \n2  The coordinated strikes ahead of Christmas are...   \n3  Amazon, the global e-commerce giant, is on a t...   \n4  Amazon workers associated with the Teamsters u...   \n5  Thousands of Amazon workers are set to walk of...   \n6  Brigade Enterprises Ltd. is yet to confirm Ama...   \n7  Dec 18 (Reuters) - Thousands of Amazon.com (AM...   \n8  US-based Amazon yesterday exited Mumbai-headqu...   \n9  The International Brotherhood of Teamsters sai...   \n\n                                                link  \\\n0  https:\/\/www.fastcompany.com\/91248618\/exclusive...   \n1  https:\/\/finance.yahoo.com\/news\/amazon-workers-...   \n2  https:\/\/www.washingtonpost.com\/business\/2024\/1...   \n3  https:\/\/smartphonemagazine.nl\/en\/2024\/12\/19\/wi...   \n4  https:\/\/www.foxbusiness.com\/economy\/teamsters-...   \n5  https:\/\/retail-systems.com\/rs\/Amazon_Workers_P...   \n6  https:\/\/www.ndtvprofit.com\/business\/brigade-en...   \n7  https:\/\/www.reuters.com\/technology\/amazon-work...   \n8  https:\/\/www.fibre2fashion.com\/news\/e-commerce-...   \n9  https:\/\/www.msn.com\/en-us\/money\/companies\/team...   \n\n                                                 img  \n0  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n1  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n2  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n3  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n4  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n5  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n6  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n7  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n8  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  \n9  data:image\/gif;base64,R0lGODlhAQABAIAAAP\/\/\/\/\/\/...  <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 3\uff1a\u89e3\u6790\u6587\u7ae0\u5e76\u6267\u884c NLP<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    list =&#91;] #creating an empty list \n    for i in df.index:\n        dict = {} #creating an empty dictionary to append an article in every single iteration\n        article = Article(df&#91;'link']&#91;i],config=config) #providing the link\n        try:\n          article.download() #downloading the article \n          article.parse() #parsing the article\n          article.nlp() #performing natural language processing (nlp)\n        except:\n           pass \n        #storing results in our empty dictionary\n        dict&#91;'Date']=df&#91;'date']&#91;i] \n        dict&#91;'Media']=df&#91;'media']&#91;i]\n        dict&#91;'Title']=article.title\n        dict&#91;'Article']=article.text\n        dict&#91;'Summary']=article.summary\n        dict&#91;'Key_words']=article.keywords\n        list.append(dict)\n    check_empty = not any(list)\n    # print(check_empty)\n    if check_empty == False:\n      news_df=pd.DataFrame(list) #creating dataframe\n      print(news_df)\n\nexcept Exception as e:\n    #exception handling\n    print(\"exception occurred:\" + str(e))\n    print('Looks like, there is some error in retrieving the data, Please try again or try with a different ticker.' )\n\n Date                  Media  \\\n0  9 minutes ago           Fast Company   \n1  9 minutes ago          Yahoo Finance   \n2  3 minutes ago    The Washington Post   \n3  3 minutes ago  smartphonemagazine.nl   \n4  9 minutes ago           Fox Business   \n5  4 minutes ago         Retail Systems   \n6  8 minutes ago            NDTV Profit   \n7  9 minutes ago                Reuters   \n8  9 minutes ago          Fibre2Fashion   \n9  9 minutes ago                    MSN   \n\n                                               Title  \\\n0                                                      \n1                                                      \n2                                                      \n3                                Smartphone Magazine   \n4  Teamsters union launches historic nationwide s...   \n5                                                      \n6                                                      \n7                                                      \n8                                                      \n9                                                MSN   \n\n                                             Article  \\\n0                                                      \n1                                                      \n2                                                      \n3  Accessing precise market data can sometimes be...   \n4  Thousands of Amazon workers nationwide organiz...   \n5                                                      \n6                                                      \n7                                                      \n8                                                      \n9                                                      \n\n                                             Summary  \\\n0                                                      \n1                                                      \n2                                                      \n3  Accessing precise market data can sometimes be...   \n4  Thousands of Amazon workers nationwide organiz...   \n5                                                      \n6                                                      \n7                                                      \n8                                                      \n9                                                      \n\n                                           Key_words  \n0                                                 &#91;]  \n1                                                 &#91;]  \n2                                                 &#91;]  \n3  &#91;data, users, tailor, smartphone, switching, p...  \n4  &#91;price, historic, warehouse, teamsters, worker...  \n5                                                 &#91;]  \n6                                                 &#91;]  \n7                                                 &#91;]  \n8                                                 &#91;]  \n9                                              &#91;msn]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 4\uff1a\u5bf9 AMZN \u8fdb\u884c\u80a1\u7968\u60c5\u7eea\u5206\u6790<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#Sentiment Analysis\ndef percentage(part,whole):\n    return 100 * float(part)\/float(whole)\n\n#Assigning Initial Values\npositive = 0\nnegative = 0\nneutral = 0\n#Creating empty lists\nnews_list = &#91;]\nneutral_list = &#91;]\nnegative_list = &#91;]\npositive_list = &#91;]\n\n#Iterating over the tweets in the dataframe\nfor news in news_df&#91;'Summary']:\n    news_list.append(news)\n    analyzer = SentimentIntensityAnalyzer().polarity_scores(news)\n    neg = analyzer&#91;'neg']\n    neu = analyzer&#91;'neu']\n    pos = analyzer&#91;'pos']\n    comp = analyzer&#91;'compound']\n\n    if neg &gt; pos:\n        negative_list.append(news) #appending the news that satisfies this condition\n        negative += 1 #increasing the count by 1\n    elif pos &gt; neg:\n        positive_list.append(news) #appending the news that satisfies this condition\n        positive += 1 #increasing the count by 1\n    elif pos == neg:\n        neutral_list.append(news) #appending the news that satisfies this condition\n        neutral += 1 #increasing the count by 1 \n\npositive = percentage(positive, len(news_df)) #percentage is the function defined above\nnegative = percentage(negative, len(news_df))\nneutral = percentage(neutral, len(news_df))\n\n#Converting lists to pandas dataframe\nnews_list = pd.DataFrame(news_list)\nneutral_list = pd.DataFrame(neutral_list)\nnegative_list = pd.DataFrame(negative_list)\npositive_list = pd.DataFrame(positive_list)\n#using len(length) function for counting\nprint(\"Positive Sentiment:\", '%.2f' % len(positive_list), end='\\n')\nprint(\"Neutral Sentiment:\", '%.2f' % len(neutral_list), end='\\n')\nprint(\"Negative Sentiment:\", '%.2f' % len(negative_list), end='\\n')\n\n#Creating PieCart\nlabels = &#91;'Positive &#91;'+str(round(positive))+'%]' , 'Neutral &#91;'+str(round(neutral))+'%]','Negative &#91;'+str(round(negative))+'%]']\nsizes = &#91;positive, neutral, negative]\ncolors = &#91;'yellowgreen', 'blue','red']\npatches, texts = plt.pie(sizes,colors=colors, startangle=90)\nplt.style.use('default')\nplt.legend(labels)\nplt.title(\"Sentiment Analysis Result for stock= \"+company_name+\"\" )\nplt.axis('equal')\nplt.show()\n\n# Word cloud visualization\ndef word_cloud(text):\n    stopwords = set(STOPWORDS)\n    allWords = ' '.join(&#91;nws for nws in text])\n    wordCloud = WordCloud(background_color='black',width = 1600, height = 800,stopwords = stopwords,min_font_size = 20,max_font_size=150,colormap='prism').generate(allWords)\n    fig, ax = plt.subplots(figsize=(20,10), facecolor='k')\n    plt.imshow(wordCloud)\n    ax.axis(\"off\")\n    fig.tight_layout(pad=0)\n    plt.show()\n\nprint('Wordcloud for ' + company_name)\nword_cloud(news_df&#91;'Summary'].values)\n\n\nPositive Sentiment: 2.00\nNeutral Sentiment: 8.00\nNegative Sentiment: 0.00<\/code><\/pre>\n\n\n\n<p>AMZN \u80a1\u7968\u7684\u60c5\u611f\u5206\u6790\u7ed3\u679c\u5982\u4e0b\u56fe\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\/12\/image-193.png\" alt=\"\" class=\"wp-image-3574\"\/><\/figure>\n\n\n\n<p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u8f93\u51fa AMZN \u7684\u8bcd\u5e93\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\/12\/image-194.png\" alt=\"\" class=\"wp-image-3575\"\/><\/figure>\n\n\n\n<p>\u5f53\u6211\u4eec\u5b8c\u6210\u4e86\u5bf9\u67d0\u4e00\u79cd\u80a1\u7968\u7684\u60c5\u7eea\u5206\u6790\u540e\uff0c\u6211\u4eec\u80fd\u4e0d\u80fd\u8fdb\u4e00\u6b65\u7684\u53bb\u5206\u6790\u7c7b\u4f3c\u6027\u8d28\u7684\u4e00\u7c7b\u80a1\u7968\u5462\uff1f\u7b54\u6848\u662f\u53ef\u4ee5\u7684\uff0c\u8ba9\u6211\u4eec\u8fdb\u5165\u4e0b\u4e00\u7ae0\u8282\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u300111 \u79cd\u79d1\u6280\u80a1\u7684\u6bcf\u65e5\u5e73\u5747\u77e2\u91cf\u60c5\u7eea\u5f97\u5206<\/strong><\/h2>\n\n\n\n<p>\u8ba9\u6211\u4eec\u5bf9\u591a\u53ea\u79d1\u6280\u80a1\u7684\u65e5\u5e73\u5747\u60c5\u7eea\u5f97\u5206\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tickers = &#91;'NVDA','TSLA','AMZN','BABA','META','MSFT','GOOG','AMD','IBM','NFLX','ORCL']<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.1 \u5bfc\u5165\u7a0b\u5e8f\u5e93<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\nfrom bs4 import BeautifulSoup\nimport matplotlib.pyplot as plt\nfrom urllib.request import urlopen, Request\nfrom urllib.error import HTTPError\nfrom nltk.sentiment.vader import SentimentIntensityAnalyzer\nimport nltk\nimport time\nimport random\nfrom datetime import datetime, timedelta\n\n# Download the VADER lexicon\nnltk.download('vader_lexicon')\n\nTrue<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.2 \u83b7\u53d6\u76f8\u5173\u4fe1\u606f<\/strong><\/h3>\n\n\n\n<p>\u4ece https:\/\/finviz.com \u83b7\u53d6\u76f8\u5173\u6240\u9700\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># List of user agents to rotate\nuser_agents = &#91;\n    'Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/91.0.4472.124 Safari\/537.36',\n    'Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/605.1.15 (KHTML, like Gecko) Version\/14.1.1 Safari\/605.1.15',\n    'Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Firefox\/89.0'\n]\n\n# Function to parse date strings\ndef parse_date(date_str):\n    if date_str == \"Today\":\n        return datetime.now().date()\n    elif date_str == \"Yesterday\":\n        return datetime.now().date() - timedelta(1)\n    else:\n        return pd.to_datetime(date_str).date()\n\n# Get Data\nfinwiz_url = 'https:\/\/finviz.com\/quote.ashx?t='\nnews_tables = {}\n\nfor ticker in tickers:\n    url = finwiz_url + ticker\n    user_agent = random.choice(user_agents)\n    req = Request(url=url, headers={'user-agent': user_agent})\n    try:\n        resp = urlopen(req)\n        html = BeautifulSoup(resp, features=\"lxml\")\n        news_table = html.find(id='news-table')\n        news_tables&#91;ticker] = news_table\n    except HTTPError as e:\n        print(f\"HTTPError for {ticker}: {e}\")\n    time.sleep(random.uniform(1, 3))  # Add delay\n\n# Print Recent News Headlines\ntry:\n    for ticker in tickers:\n        df = news_tables&#91;ticker]\n        if df is None:\n            print(f\"No news for {ticker}\")\n            continue\n        df_tr = df.findAll('tr')\n\n        print('\\n')\n        print(f'Headers for {ticker}: ')\n\n        for i, table_row in enumerate(df_tr):\n            a_text = table_row.a.text\n            td_text = table_row.td.text.strip()\n            print(a_text, '(', td_text, ')')\n            if i == n-1:\n                break\nexcept KeyError:\n    pass\n\n# Iterate through the news\nparsed_news = &#91;]\nfor file_name, news_table in news_tables.items():\n    if news_table is None:\n        continue\n    for x in news_table.findAll('tr'):\n        text = x.a.get_text()\n        date_scrape = x.td.text.split()\n\n        if len(date_scrape) == 1:\n            time = date_scrape&#91;0]\n            date = \"Today\"  # Assuming single time means today's news\n        else:\n            date = date_scrape&#91;0]\n            time = date_scrape&#91;1]\n\n        ticker = file_name\n        parsed_news.append(&#91;ticker, date, time, text])\n\n# Sentiment Analysis\nanalyzer = SentimentIntensityAnalyzer()\n\ncolumns = &#91;'Ticker', 'Date', 'Time', 'Headline']\nnews = pd.DataFrame(parsed_news, columns=columns)\n\nHeaders for NVDA: \nApple Just Exposed a Massive Risk for Nvidia Stock ( Today 06:15AM )\n\nHeaders for TSLA: \nLike Tesla? You'll Love This AI Autonomy Stock ( Today 05:53AM )\n1 Unfavorable Trend Explains Why Tesla Stock Is Trading 43% Below Its All-Time High ( 04:49AM )\n.................<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.3 \u521b\u5efa\u6570\u636e\u5e27<\/strong><\/h3>\n\n\n\n<p>\u521b\u5efa\u5e26\u6709\u5e73\u5747\u60c5\u7eea\u3001neg\u3001neu \u548c pos \u5217\u7684\u6570\u636e\u5e27\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Convert 'Date' column to actual dates\nnews&#91;'Date'] = news&#91;'Date'].apply(parse_date)\n\nscores = news&#91;'Headline'].apply(analyzer.polarity_scores).tolist()\ndf_scores = pd.DataFrame(scores)\nnews = news.join(df_scores, rsuffix='_right')\n\n# View Data \nunique_ticker = news&#91;'Ticker'].unique().tolist()\nnews_dict = {name: news.loc&#91;news&#91;'Ticker'] == name] for name in unique_ticker}\n\ndf.tail()\n\n                     Avg Sentiment\nTicker \nGOOG {'neg': 0.0, 'neu': 0.852, 'pos': 0.148, 'comp...\nAMD {'neg': 0.0, 'neu': 0.625, 'pos': 0.375, 'comp...\nIBM {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound...\nNFLX {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound...\nORCL {'neg': 0.0, 'neu': 0.69, 'pos': 0.31, 'compou...\n\n\ndef extract_values(dictionary):\n    age = dictionary&#91;'neg']\n    gender = dictionary&#91;'neu']\n    posval = dictionary&#91;'pos']\n    return age, gender,posval\n\ndf&#91;&#91;'neg', 'neu','pos']] = df&#91;'Avg Sentiment'].apply(lambda x: pd.Series(extract_values(x)))\nprint(df)\n\n                           Avg Sentiment                   neg    neu    pos\nTicker                                                                        \nNVDA    {'neg': 0.362, 'neu': 0.638, 'pos': 0.0, 'comp...  0.362  0.638  0.000\nTSLA    {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound...  0.000  1.000  0.000\nAMZN    {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound...  0.000  1.000  0.000\nBABA    {'neg': 0.0, 'neu': 0.769, 'pos': 0.231, 'comp...  0.000  0.769  0.231\nMETA    {'neg': 0.174, 'neu': 0.682, 'pos': 0.144, 'co...  0.174  0.682  0.144\nMSFT    {'neg': 0.0, 'neu': 0.909, 'pos': 0.091, 'comp...  0.000  0.909  0.091\nGOOG    {'neg': 0.0, 'neu': 0.852, 'pos': 0.148, 'comp...  0.000  0.852  0.148\nAMD     {'neg': 0.0, 'neu': 0.625, 'pos': 0.375, 'comp...  0.000  0.625  0.375\nIBM     {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound...  0.000  1.000  0.000\nNFLX    {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound...  0.000  1.000  0.000\nORCL    {'neg': 0.0, 'neu': 0.69, 'pos': 0.31, 'compou...  0.000  0.690  0.310<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.4 \u60c5\u7eea\u6bd4\u8f83<\/strong><\/h3>\n\n\n\n<p>11 \u53ea\u79d1\u6280\u80a1\u7684<strong>\u8d1f\u9762\u60c5\u7eea<\/strong>\u6bd4\u8f83\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.bar(df.index,df&#91;'neg'])\nplt.grid()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-195.png\" alt=\"\" class=\"wp-image-3576\"\/><\/figure>\n\n\n\n<p>11 \u53ea\u79d1\u6280\u80a1\u7684<strong>\u79ef\u6781\u60c5\u7eea<\/strong>\u6bd4\u8f83\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.bar(df.index,df&#91;'pos'])\nplt.grid()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-196.png\" alt=\"\" class=\"wp-image-3577\"\/><\/figure>\n\n\n\n<p>11 \u53ea\u79d1\u6280\u80a1\u7684<strong>\u4e2d\u6027\u60c5\u7eea<\/strong>\u6bd4\u8f83<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.bar(df.index,df&#91;'neu'])\nplt.grid()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-197.png\" alt=\"\" class=\"wp-image-3578\"\/><\/figure>\n\n\n\n<p>11 \u79cd\u79d1\u6280\u80a1\u7684<strong>\u590d\u5408\u60c5\u7eea<\/strong>\u6bd4\u8f83<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>t=df&#91;'Avg Sentiment']\nnew_list = &#91;i&#91;\"compound\"] for i in t]\n\nprint(new_list)\n\n&#91;-0.34, 0.0, 0.0, 0.5859, -0.1027, 0.0772, 0.3818, 0.765, 0.0, 0.0, 0.743]\n\nplt.bar(df.index,new_list)\nplt.grid()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-198.png\" alt=\"\" class=\"wp-image-3579\"\/><\/figure>\n\n\n\n<p>\u901a\u8fc7\u4e0a\u8ff0\u60c5\u611f\u5206\u6790\uff0c\u5206\u6790\u5e08\u53ef\u4ee5\u89e3\u8bfb\u65b0\u95fb\u6807\u9898\u7684\u60c5\u611f\u57fa\u8c03\u3002\u8fd9\u4e00\u989d\u5916\u7684\u4fe1\u606f\u5c42\u6709\u52a9\u4e8e\u66f4\u51c6\u786e\u5730\u9884\u6d4b\u5e02\u573a\u8d8b\u52bf\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u5982\u4f55\u5229\u7528\u60c5\u7eea\u5206\u6790\u505a\u51fa\u660e\u667a\u7684\u6295\u8d44\u51b3\u7b56<\/strong><\/h2>\n\n\n\n<p>\u5728\u672c\u8282\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728\u884c\u4e1a\u548c\u4ea7\u4e1a\u7684\u6295\u8d44\u7ec4\u5408\u914d\u7f6e\u4e2d\u4f7f\u7528\u7ecf\u8fc7\u89e3\u6790\u548c\u8bc4\u5206\u7684\u8d22\u7ecf\u65b0\u95fb\uff0c\u4e00\u76ee\u4e86\u7136\u3002\u6211\u4eec\u7684\u76ee\u6807\u662f\u5b9e\u73b0\u4ee5\u4e0b NLP \u60c5\u611f\u5206\u6790\u5de5\u4f5c\u6d41\u7a0b \uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u786e\u5b9a\u8de8\u884c\u4e1a\u7684\u591a\u5143\u5316\u6295\u8d44\u7ec4\u5408\u3002<\/li>\n\n\n\n<li>\u4ece finviz.com \u6293\u53d6\u5e76\u89e3\u6790\u5f97\u5206\u65b0\u95fb\u6807\u9898\u3002<\/li>\n\n\n\n<li>\u6bd4\u8f83\u8d1f\u9762\u3001\u4e2d\u6027\u3001\u6b63\u9762\u548c\u590d\u5408\u60c5\u7eea\u7684\u5e73\u5747\u5f97\u5206\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u96c5\u864e\u8d22\u7ecf API \u9605\u8bfb\u76f8\u5173\u516c\u53f8\u4fe1\u606f\u3002<\/li>\n\n\n\n<li>\u5c06\u6295\u8d44\u7ec4\u5408\u4e2d\u7684\u80a1\u7968\u603b\u4ef7\u503c\u4e0e\u80a1\u7968\u60c5\u7eea\u5f97\u5206\u8fdb\u884c\u6bd4\u8f83\u3002<\/li>\n\n\n\n<li>\u521b\u5efa\u4e92\u52a8\u5f0f\u80a1\u7968\u60c5\u7eea\u6811\u72b6\u56fe\u3002<\/li>\n\n\n\n<li>\u5229\u7528\u65b0\u95fb\u60c5\u7eea\u8bc4\u5206\uff0c\u4ece\u98ce\u9669\/\u6536\u76ca\u7684\u89d2\u5ea6\u4f18\u5316\u6211\u4eec\u7684\u884c\u4e1a\u548c\u4ea7\u4e1a\u6295\u8d44\u7ec4\u5408\u914d\u7f6e\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 1\uff1a\u5bfc\u5165 Python \u5e93\u5e76\u521d\u59cb\u5316\u6211\u4eec\u7684\u6295\u8d44\u7ec4\u5408<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>from urllib.request import urlopen, Request\nfrom bs4 import BeautifulSoup\nimport yfinance as yf\n\n# for plotting and data manipulation\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport plotly\nimport plotly.express as px\n\n# NLTK VADER for sentiment analysis\nimport nltk\nnltk.downloader.download('vader_lexicon')\nfrom nltk.sentiment.vader import SentimentIntensityAnalyzer\n\ntickers_dict = {'AMZN': 5, 'TSLA': 1, 'GOOG': 3, 'META': 3, 'KO': 10, 'PEP': 5,  # amazon, tesla, google, meta, coke, pepsi\n                'BA': 5, 'XOM': 5, 'CVX': 4, 'UNH': 1, 'JNJ': 3, 'JPM': 3, # boeing, exxon mobil, chevron, united health, johnson&amp;johnson, jp morgan\n                'BAC': 5, 'C': 5, 'SPG': 10, 'AAPL': 6, 'MSFT': 5, 'WMT': 6} # world fuel services, advanced micro devices, intuitive surgical, intel\n                \ntickers = tickers_dict.keys()\nnumber_of_shares = tickers_dict.values()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 2\uff1a\u83b7\u53d6\u548c\u89e3\u6790\u65e5\u671f\u3001\u65f6\u95f4\u548c\u65b0\u95fb\u6807\u9898\u6570\u636e\uff0c\u5229\u7528 Vader \u8fdb\u884c\u60c5\u7eea\u5206\u6790<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>##### Scrape the Date, Time and News Headlines Data\nfinwiz_url = 'https:\/\/finviz.com\/quote.ashx?t='\nnews_tables = {}\n\nfor ticker in tickers:\n    print(ticker)\n    url = finwiz_url + ticker\n    req = Request(url=url,headers={'User-Agent': 'Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko\/20100101 Firefox\/20.0'}) \n    response = urlopen(req)    \n    # Read the contents of the file into 'html'\n    html = BeautifulSoup(response)\n    # Find 'news-table' in the Soup and load it into 'news_table'\n    news_table = html.find(id='news-table')\n    # Add the table to our dictionary\n    news_tables&#91;ticker] = news_table\n    \n    \n##### Parse the Date, Time and News Headlines into a Python List\nparsed_news = &#91;]\n# Iterate through the news\nfor file_name, news_table in news_tables.items():\n    # Iterate through all tr tags in 'news_table'\n    for x in news_table.findAll('tr'):\n        # read the text from each tr tag into text\n        # get text from a only\n        text = x.a.get_text() \n        # splite text in the td tag into a list \n        date_scrape = x.td.text.split()\n        # if the length of 'date_scrape' is 1, load 'time' as the only element\n        if len(date_scrape) == 1:\n            time = date_scrape&#91;0]\n            \n        # else load 'date' as the 1st element and 'time' as the second    \n        else:\n            date = date_scrape&#91;0]\n            time = date_scrape&#91;1]\n        # Extract the ticker from the file name, get the string up to the 1st '_'  \n        ticker = file_name.split('_')&#91;0]\n        \n        # Append ticker, date, time and headline as a list to the 'parsed_news' list\n        parsed_news.append(&#91;ticker, date, time, text])\n\n\n##### Perform Sentiment Analysis with Vader\n# Instantiate the sentiment intensity analyzer\nvader = SentimentIntensityAnalyzer()\n# Set column names\ncolumns = &#91;'ticker', 'date', 'time', 'headline']\n# Convert the parsed_news list into a DataFrame called 'parsed_and_scored_news'\nparsed_and_scored_news = pd.DataFrame(parsed_news, columns=columns)\n\n# Iterate through the headlines and get the polarity scores using vader\nscores = parsed_and_scored_news&#91;'headline'].apply(vader.polarity_scores).tolist()\n# Convert the 'scores' list of dicts into a DataFrame\nscores_df = pd.DataFrame(scores)\n\n# Join the DataFrames of the news and the list of dicts\nparsed_and_scored_news = parsed_and_scored_news.join(scores_df, rsuffix='_right')\n\nAMZN\nTSLA\nGOOG\nMETA\nKO\nPEP\nBA\nXOM\nCVX\nUNH\nJNJ\nJPM\nBAC\nC\nSPG\nAAPL\nMSFT\nWMT<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 3\uff1a\u5e73\u5747\u60c5\u7eea\u5f97\u5206\u6bd4\u8f83\u5206\u6790<\/strong><\/h3>\n\n\n\n<p>\u68c0\u67e5\u6570\u636e\u5e27 parsed_and_scored_news<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>parsed_and_scored_news.info()\n\n&lt;class 'pandas.core.frame.DataFrame'&gt;\nRangeIndex: 1800 entries, 0 to 1799\nData columns (total 8 columns):\n #   Column    Non-Null Count  Dtype  \n---  ------    --------------  -----  \n 0   ticker    1800 non-null   object \n 1   date      1800 non-null   object \n 2   time      1800 non-null   object \n 3   headline  1800 non-null   object \n 4   neg       1800 non-null   float64\n 5   neu       1800 non-null   float64\n 6   pos       1800 non-null   float64\n 7   compound  1800 non-null   float64\ndtypes: float64(4), object(4)\nmemory usage: 112.6+ KB\n\nparsed_and_scored_news.tail()\n\n   ticker date     time     headline                                         neg neu    pos compound\n1795 WMT Dec-09-24 01:13PM Omnicom to Acquire Interpublic in Deal That Wi... 0.0 1.000 0.000 0.0000\n1796 WMT Dec-09-24 11:28AM Walmart wraps up holiday promotion with omnich... 0.0 0.722 0.278 0.4019\n1797 WMT Dec-09-24 10:48AM Muted growth expected in U.S. consumer spendin... 0.0 0.794 0.206 0.3818\n1798 WMT Dec-09-24 10:42AM Here's Why $7 Goods Have Been Good Business fo... 0.0 0.775 0.225 0.4404\n1799 WMT Dec-09-24 05:50AM Sams Club says customer input on private label... 0.0 1.000 0.000 0.0000<\/code><\/pre>\n\n\n\n<p>\u8ba1\u7b97\u5e73\u5747\u60c5\u611f\u5f97\u5206<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Group by each ticker and get the mean of all sentiment scores\nmean_scores = parsed_and_scored_news.groupby(&#91;'ticker']).mean(numeric_only=True)\nmean_scores\n\n      neg     neu    pos    compound\nticker    \nAAPL 0.06559 0.82944 0.10495 0.073693\nAMZN 0.08187 0.79159 0.12657 0.078206\nBA   0.07512 0.87364 0.05122 -0.033472\nBAC  0.05074 0.83878 0.11048 0.119623\nC    0.05724 0.82534 0.11741 0.117026\nCVX  0.04481 0.83620 0.11901 0.163593\nGOOG 0.02228 0.85410 0.12364 0.178386\nJNJ  0.03506 0.85808 0.10685 0.144027\nJPM  0.03035 0.87529 0.09436 0.129621\nKO   0.02631 0.84148 0.13222 0.201402\nMETA 0.05247 0.82028 0.12726 0.145169\nMSFT 0.03381 0.83642 0.12977 0.178756\nPEP  0.06595 0.83772 0.09633 0.062241\nSPG  0.02559 0.90227 0.07214 0.085266\nTSLA 0.02877 0.88962 0.08162 0.110656\nUNH  0.20654 0.73346 0.06002 -0.257733\nWMT  0.04239 0.83688 0.12075 0.131448\nXOM  0.04290 0.83830 0.11881 0.151074<\/code><\/pre>\n\n\n\n<p>\u7ed8\u5236<strong>\u8d1f\u9762\u60c5\u7eea<\/strong>\u5e73\u5747\u5f97\u5206\u56fe<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.figure(figsize=(12,6))\nplt.bar(mean_scores.index,mean_scores&#91;'neg'])\nplt.grid()\nplt.title('Mean Negative Sentiment Score')\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u6295\u8d44\u7ec4\u5408\u5e73\u5747\u8d1f\u9762\u60c5\u7eea\u5f97\u5206\u5982\u4e0b\u56fe\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\/12\/image-199.png\" alt=\"\" class=\"wp-image-3580\"\/><\/figure>\n\n\n\n<p>\u7ed8\u5236<strong>\u79ef\u6781\u60c5\u7eea<\/strong>\u5e73\u5747\u5f97\u5206\u56fe<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.figure(figsize=(12,6))\nplt.bar(mean_scores.index,mean_scores&#91;'pos'])\nplt.grid()\nplt.title('Mean Positive Sentiment Score')\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u6295\u8d44\u7ec4\u5408\u5e73\u5747\u79ef\u6781\u60c5\u7eea\u5f97\u5206\u5982\u4e0b\u56fe\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\/12\/image-200.png\" alt=\"\" class=\"wp-image-3581\"\/><\/figure>\n\n\n\n<p>\u7ed8\u5236<strong>\u4e2d\u6027\u60c5\u7eea<\/strong>\u5e73\u5747\u5f97\u5206\u56fe<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.figure(figsize=(12,6))\nplt.bar(mean_scores.index,mean_scores&#91;'neu'])\nplt.grid()\nplt.title('Mean Neutral Sentiment Score')\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u6295\u8d44\u7ec4\u5408<strong>\u5e73\u5747\u4e2d\u6027\u60c5\u7eea<\/strong>\u5f97\u5206\u5982\u4e0b\u56fe\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\/12\/image-201.png\" alt=\"\" class=\"wp-image-3582\"\/><\/figure>\n\n\n\n<p>\u7ed8\u5236<strong>\u5e73\u5747\u590d\u5408\u60c5\u7eea<\/strong>\u5f97\u5206\u56fe<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.figure(figsize=(12,6))\nplt.bar(mean_scores.index,mean_scores&#91;'compound'])\nplt.grid()\nplt.title('Mean Compound Sentiment Score')\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u6295\u8d44\u7ec4\u5408<strong>\u5e73\u5747\u590d\u5408\u60c5\u7eea<\/strong>\u5f97\u5206\u5982\u4e0b\u56fe\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\/12\/image-202.png\" alt=\"\" class=\"wp-image-3583\"\/><\/figure>\n\n\n\n<p>\u6211\u4eec\u89c2\u5bdf\u5230\u4ee5\u4e0b\u4e09\u70b9\uff1a(1) BA \u548c UNH \u7684\u590d\u5408\u60c5\u7eea\u5f97\u5206\u5f02\u5e38\u6d88\u6781\uff1b(2) \u5e73\u5747\u79ef\u6781\u60c5\u7eea\u5f97\u5206\u8f83\u4f4e\uff1b(3) \u4e0e\u5176\u4ed6\u8d44\u4ea7\u76f8\u6bd4\uff0c\u8fd9\u4e24\u53ea\u80a1\u7968\u7684\u5e73\u5747\u6d88\u6781\u60c5\u7eea\u5f97\u5206\u8f83\u9ad8\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa44\uff1a\u4f7f\u7528\u96c5\u864e\u8d22\u7ecf API \u9605\u8bfb\u76f8\u5173\u516c\u53f8\u4fe1\u606f<\/strong><\/h3>\n\n\n\n<p>\u8ba9\u6211\u4eec\u4ece\u96c5\u864e\u8d22\u7ecf API \u83b7\u53d6\u8d22\u52a1\u6570\u636e\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5b83\u83b7\u53d6\u516c\u53f8\u8d22\u52a1\u4fe1\u606f\uff08\u5982\u8d22\u52a1\u6bd4\u7387\uff09\u548c\u5386\u53f2\u5e02\u573a\u6570\u636e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># get the price, sector and industry of each ticker using the yahoo finance api\n# as an example this is the information that the api returns for TSLA\ntickerdata = yf.Ticker('TSLA')\ntickerdata.info\n\n{'address1': '1 Tesla Road',\n 'city': 'Austin',\n 'state': 'TX',\n 'zip': '78725',\n 'country': 'United States',\n 'phone': '512 516 8177',\n 'website': 'https:\/\/www.tesla.com',\n 'industry': 'Auto Manufacturers',\n 'industryKey': 'auto-manufacturers',\n 'industryDisp': 'Auto Manufacturers',\n 'sector': 'Consumer Cyclical',\n 'sectorKey': 'consumer-cyclical',\n 'sectorDisp': 'Consumer Cyclical',\n 'longBusinessSummary': 'Tesla, Inc. designs, develops, manufactures, leases, and sells electric vehicles, and energy generation and storage systems in the United States, China, and internationally. The company operates in two segments, Automotive, and Energy Generation and Storage. The Automotive segment offers electric vehicles, as well as sells automotive regulatory credits; and non-warranty after-sales vehicle, used vehicles, body shop and parts, supercharging, retail merchandise, and vehicle insurance services. This segment also provides sedans and sport utility vehicles through direct and used vehicle sales, a network of Tesla Superchargers, and in-app upgrades; purchase financing and leasing services; services for electric vehicles through its company-owned service locations and Tesla mobile service technicians; and vehicle limited warranties and extended service plans. The Energy Generation and Storage segment engages in the design, manufacture, installation, sale, and leasing of solar energy generation and energy storage products, and related services to residential, commercial, and industrial customers and utilities through its website, stores, and galleries, as well as through a network of channel partners; and provision of service and repairs to its energy product customers, including under warranty, as well as various financing options to its solar customers. The company was formerly known as Tesla Motors, Inc. and changed its name to Tesla, Inc. in February 2017. Tesla, Inc. was incorporated in 2003 and is headquartered in Austin, Texas.',\n 'fullTimeEmployees': 140473,\n 'companyOfficers': &#91;{'maxAge': 1,\n   'name': 'Mr. Elon R. Musk',\n   'age': 51,\n   'title': 'Co-Founder, Technoking of Tesla, CEO &amp; Director',\n   'yearBorn': 1972,\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Mr. Vaibhav  Taneja',\n   'age': 45,\n   'title': 'Chief Financial Officer',\n   'yearBorn': 1978,\n   'fiscalYear': 2023,\n   'totalPay': 278000,\n   'exercisedValue': 8517957,\n   'unexercisedValue': 202075632},\n  {'maxAge': 1,\n   'name': 'Mr. Xiaotong  Zhu',\n   'age': 43,\n   'title': 'Senior Vice President of Automotive',\n   'yearBorn': 1980,\n   'fiscalYear': 2023,\n   'totalPay': 926877,\n   'exercisedValue': 0,\n   'unexercisedValue': 344144320},\n  {'maxAge': 1,\n   'name': 'Travis  Axelrod',\n   'title': 'Head of Investor Relations',\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Brian  Scelfo',\n   'title': 'Senior Director of Corporate Development',\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Mr. Franz  von Holzhausen',\n   'title': 'Chief Designer',\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Mr. John  Walker',\n   'age': 60,\n   'title': 'Vice President of Sales - North America',\n   'yearBorn': 1963,\n   'fiscalYear': 2023,\n   'totalPay': 121550,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Mr. Peter  Bannon',\n   'title': 'Chip Architect',\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Mr. Turner  Caldwell',\n   'title': 'Engineering Manager',\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0},\n  {'maxAge': 1,\n   'name': 'Mr. Rodney D. Westmoreland Jr.',\n   'title': 'Director of Construction Management',\n   'fiscalYear': 2023,\n   'exercisedValue': 0,\n   'unexercisedValue': 0}],\n 'auditRisk': 7,\n 'boardRisk': 9,\n 'compensationRisk': 10,\n 'shareHolderRightsRisk': 9,\n 'overallRisk': 10,\n 'governanceEpochDate': 1733011200,\n 'compensationAsOfEpochDate': 1703980800,\n 'maxAge': 86400,\n 'priceHint': 2,\n 'previousClose': 479.86,\n 'open': 466.36,\n 'dayLow': 427.02,\n 'dayHigh': 488.5399,\n 'regularMarketPreviousClose': 479.86,\n 'regularMarketOpen': 466.36,\n 'regularMarketDayLow': 427.02,\n 'regularMarketDayHigh': 488.5399,\n 'beta': 2.295,\n 'trailingPE': 120.58356,\n 'forwardPE': 134.58151,\n 'volume': 144545960,\n 'regularMarketVolume': 144545960,\n 'averageVolume': 90840046,\n 'averageVolume10days': 93393990,\n 'averageDailyVolume10Day': 93393990,\n 'bid': 430.02,\n 'ask': 441.62,\n 'bidSize': 300,\n 'askSize': 200,\n 'marketCap': 1412843700224,\n 'fiftyTwoWeekLow': 138.8,\n 'fiftyTwoWeekHigh': 488.5399,\n 'priceToSalesTrailing12Months': 14.54291,\n 'fiftyDayAverage': 309.1128,\n 'twoHundredDayAverage': 227.16154,\n 'currency': 'USD',\n 'enterpriseValue': 1392757571584,\n 'profitMargins': 0.13075,\n 'floatShares': 2793105010,\n 'sharesOutstanding': 3210060032,\n 'sharesShort': 77192871,\n 'sharesShortPriorMonth': 77944508,\n 'sharesShortPreviousMonthDate': 1730332800,\n 'dateShortInterest': 1732838400,\n 'sharesPercentSharesOut': 0.024,\n 'heldPercentInsiders': 0.12911001,\n 'heldPercentInstitutions': 0.47903,\n 'shortRatio': 0.77,\n 'shortPercentOfFloat': 0.0276,\n 'impliedSharesOutstanding': 3210060032,\n 'bookValue': 21.806,\n 'priceToBook': 20.183895,\n 'lastFiscalYearEnd': 1703980800,\n 'nextFiscalYearEnd': 1735603200,\n 'mostRecentQuarter': 1727654400,\n 'earningsQuarterlyGrowth': 0.169,\n 'netIncomeToCommon': 12743000064,\n 'trailingEps': 3.65,\n 'forwardEps': 3.24,\n 'lastSplitFactor': '3:1',\n 'lastSplitDate': 1661385600,\n 'enterpriseToRevenue': 14.336,\n 'enterpriseToEbitda': 105.161,\n '52WeekChange': 0.885501,\n 'SandP52WeekChange': 0.2746848,\n 'exchange': 'NMS',\n 'quoteType': 'EQUITY',\n 'symbol': 'TSLA',\n 'underlyingSymbol': 'TSLA',\n 'shortName': 'Tesla, Inc.',\n 'longName': 'Tesla, Inc.',\n 'firstTradeDateEpochUtc': 1277818200,\n 'timeZoneFullName': 'America\/New_York',\n 'timeZoneShortName': 'EST',\n 'uuid': 'ec367bc4-f92c-397c-ac81-bf7b43cffaf7',\n 'messageBoardId': 'finmb_27444752',\n 'gmtOffSetMilliseconds': -18000000,\n 'currentPrice': 440.13,\n 'targetHighPrice': 528.0,\n 'targetLowPrice': 116.0,\n 'targetMeanPrice': 278.18643,\n 'targetMedianPrice': 272.485,\n 'recommendationMean': 2.76596,\n 'recommendationKey': 'hold',\n 'numberOfAnalystOpinions': 42,\n 'totalCash': 33648001024,\n 'totalCashPerShare': 10.482,\n 'ebitda': 13244000256,\n 'totalDebt': 12782999552,\n 'quickRatio': 1.214,\n 'currentRatio': 1.844,\n 'totalRevenue': 97150001152,\n 'debtToEquity': 18.078,\n 'revenuePerShare': 30.457,\n 'returnOnAssets': 0.04759,\n 'returnOnEquity': 0.20389,\n 'freeCashflow': 676625024,\n 'operatingCashflow': 14478999552,\n 'earningsGrowth': 0.17,\n 'revenueGrowth': 0.078,\n 'grossMargins': 0.18229,\n 'ebitdaMargins': 0.13633001,\n 'operatingMargins': 0.107889995,\n 'financialCurrency': 'USD',\n 'trailingPegRatio': 12.203}<\/code><\/pre>\n\n\n\n<p>\u83b7\u53d6\u6211\u4eec\u80a1\u7968\u7684\u5f00\u76d8\u4ef7\u3001\u677f\u5757\u548c\u884c\u4e1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sectors = &#91;]\nindustries = &#91;]\nprices = &#91;]\nfor ticker in tickers:\n    print(ticker)\n    tickerdata = yf.Ticker(ticker)\n    prices.append(tickerdata.info&#91;'open'])\n    sectors.append(tickerdata.info&#91;'sector'])\n    industries.append(tickerdata.info&#91;'industry'])\n\nAMZN\nTSLA\nGOOG\nMETA\nKO\nPEP\nBA\nXOM\nCVX\nUNH\nJNJ\nJPM\nBAC\nC\nSPG\nAAPL\nMSFT\nWMT<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa45\uff1a\u521b\u5efa\u6295\u8d44\u7ec4\u5408\u6c47\u603b\u8868<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># dictionary {'column name': list of values for column} to be converted to dataframe\nd = {'Sector': sectors, 'Industry': industries, 'Price': prices, 'No. of Shares': number_of_shares}\n# create dataframe from \ndf_info = pd.DataFrame(data=d, index = tickers)\ndf_info<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-203.png\" alt=\"\" class=\"wp-image-3584\"\/><\/figure>\n\n\n\n<p>\u8ba1\u7b97\u6295\u8d44\u7ec4\u5408\u4e2d\u7684\u80a1\u7968\u603b\u4ef7\u503c\uff08\u7f8e\u5143\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_info&#91;'Total Stock Value in Portfolio'] = df_info&#91;'Price']*df_info&#91;'No. of Shares']\ndf_info<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-204.png\" alt=\"\" class=\"wp-image-3585\"\/><\/figure>\n\n\n\n<p>\u5c06\u56db\u4e2a\u5e73\u5747\u60c5\u611f\u5206\u6570\u63d2\u5165\u4e0a\u8ff0\u6c47\u603b\u8868\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df = mean_scores.join(df_info)\ndf = df.rename(columns={\"compound\": \"Sentiment Score\", \"neg\": \"Negative\", \"neu\": \"Neutral\", \"pos\": \"Positive\"})\ndf = df.reset_index()\ndf<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-205.png\" alt=\"\" class=\"wp-image-3586\"\/><\/figure>\n\n\n\n<p>\u6253\u5370\u6570\u636e\u5e27 df \u7684\u5185\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df.info()\n\n&lt;class 'pandas.core.frame.DataFrame'&gt;\nRangeIndex: 18 entries, 0 to 17\nData columns (total 10 columns):\n #   Column                          Non-Null Count  Dtype  \n---  ------                          --------------  -----  \n 0   ticker                          18 non-null     object \n 1   Negative                        18 non-null     float64\n 2   Neutral                         18 non-null     float64\n 3   Positive                        18 non-null     float64\n 4   Sentiment Score                 18 non-null     float64\n 5   Sector                          18 non-null     object \n 6   Industry                        18 non-null     object \n 7   Price                           18 non-null     float64\n 8   No. of Shares                   18 non-null     int64  \n 9   Total Stock Value in Portfolio  18 non-null     float64\ndtypes: float64(6), int64(1), object(3)\nmemory usage: 1.5+ KB<\/code><\/pre>\n\n\n\n<p>\u7ed8\u5236\u6295\u8d44\u7ec4\u5408\u4e2d\u7684\u80a1\u7968\u603b\u4ef7\u503c\u56fe<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plt.figure(figsize=(12,6))\nplt.bar(df&#91;'ticker'], df&#91;'Total Stock Value in Portfolio'])\nplt.title('Total Stock Value in Portfolio')\nplt.xlabel('Stock')\nplt.ylabel('USD')\nplt.grid()\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-206.png\" alt=\"\" class=\"wp-image-3587\"\/><\/figure>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u5c06\u6295\u8d44\u7ec4\u5408\u4e2d\u7684\u80a1\u7968\u603b\u4ef7\u503c\u4e0e 4 \u4e2a\u5e73\u5747\u60c5\u7eea\u5f97\u5206\u8fdb\u884c\u6bd4\u8f83\uff08\u6b65\u9aa4 3\uff09\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 6\uff1a\u4f7f\u7528 Plotly \u521b\u5efa\u4ea4\u4e92\u5f0f\u80a1\u7968\u60c5\u7eea\u6811\u72b6\u56fe <\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>fig = px.treemap(df, path=&#91;px.Constant(\"Sectors\"), 'Sector', 'Industry', 'ticker'], values='Total Stock Value in Portfolio',\n                  color='Sentiment Score', hover_data=&#91;'Price', 'Negative', 'Neutral', 'Positive', 'Sentiment Score'],\n                  color_continuous_scale=&#91;'#FF0000', \"#000000\", '#00FF00'],\n                  color_continuous_midpoint=0)\n\nfig.data&#91;0].customdata = df&#91;&#91;'Price', 'Negative', 'Neutral', 'Positive', 'Sentiment Score']].round(3) # round to 3 decimal places\nfig.data&#91;0].texttemplate = \"%{label}&lt;br&gt;%{customdata&#91;4]}\"\n\nfig.update_traces(textposition=\"middle center\")\nfig.update_layout(margin = dict(t=30, l=10, r=10, b=10), font_size=20)\n\nplotly.offline.plot(fig, filename='stock_sentiment.html') # this writes the plot into a html file and opens it\nfig.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-207.png\" alt=\"\" class=\"wp-image-3588\"\/><\/figure>\n\n\n\n<p>\u4e92\u52a8\u5f0f\u80a1\u7968\u60c5\u7eea\u6811\u72b6\u56fe&nbsp;\u5982\u4e0a\u56fe\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7b2c 7 \u6b65\uff1a\u5229\u7528\u65b0\u95fb\u60c5\u7eea\u8bc4\u5206\uff08\u7b2c 3-6 \u6b65\uff09\uff0c\u4ece\u98ce\u9669\/\u6536\u76ca\u7684\u89d2\u5ea6\u4f18\u5316\u884c\u4e1a\u548c\u4ea7\u4e1a\u7684\u6295\u8d44\u7ec4\u5408\u914d\u7f6e\u3002<\/strong><\/h3>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u8c03\u7528 Backtrader \u8fdb\u884c\u56de\u6eaf\u6d4b\u8bd5\uff0c\u4ee5\u8fdb\u4e00\u6b65\u589e\u5f3a\u51b3\u7b56\u8fc7\u7a0b\uff08\u6b65\u9aa4 7\uff09\uff0c\u5982\u4e0b\u6240\u793a\u7684 SPY \u6570\u636e\u793a\u4f8b \uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import backtrader as bt\nimport yfinance as yf\nfrom datetime import datetime\n\nclass firstStrategy(bt.Strategy):\n    def __init__(self):\n        # initializing rsi, slow and fast sma\n        self.rsi = bt.indicators.RSI(self.data.close, period=21)\n        self.fast_sma = bt.indicators.SMA(self.data.close, period=50)\n        self.slow_sma = bt.indicators.SMA(self.data.close, period=100)\n        self.crossup = bt.ind.CrossUp(self.fast_sma, self.slow_sma)\n\n    def next(self):\n        if not self.position:\n            # BUYING Condition\n            if self.rsi &gt; 30 and self.fast_sma &gt; self.slow_sma:  # when rsi &gt; 30 and fast_sma cuts slow_sma\n                self.buy(size=100)  # buying 10 quantities of equity\n        else:\n            # SELLING Condition\n            if self.rsi &lt; 70:  # when rsi is below 70 line\n                self.sell(size=100)  # selling 10 quantities of equity\n\n     \n# Variable for our starting cash\nstartcash = 1000000\n\n# Create an instance of cerebro\ncerebro = bt.Cerebro()\n\n# Add our strategy\ncerebro.addstrategy(firstStrategy)\n\nimport yfinance as yf\n# 1.) Online data download\nticker='SPY'\nstart=datetime(2020,11,1)\nend=datetime(2021,11,1)\ndata1 = bt.feeds.PandasData(dataname=yf.download(ticker, start=start, end=end))\n\ncerebro.adddata(data1)\n\n# setting broker commission to 0.2%\ncerebro.broker.setcommission(commission=0.002)\n\n# Set our desired cash start\ncerebro.broker.setcash(startcash)\n\n# Run over everything\nresult=cerebro.run()\n\n# Get final portfolio Value\nportvalue = cerebro.broker.getvalue()\npnl = portvalue - startcash\n\n# Print out the final result\nprint('Final Portfolio Value: ${}'.format(portvalue))\nprint('P\/L: ${}'.format(pnl))\n\nFinal Portfolio Value: $988687.5916992191\nP\/L: $-11312.408300780924<\/code><\/pre>\n\n\n\n<p>\u5728\u4e0b\u4e00\u7bc7\u4e2d\u6211\u5c06\u5b8c\u6210\u672c\u6587\uff0c\u5176\u4e3b\u8981\u5185\u5bb9\u662f<strong> GRU \u80a1\u7968\u4ef7\u683c\u9884\u6d4b\uff0c\u4ee5\u53ca\u4f7f\u7528 MLBC \u8fdb\u884c\u5e02\u573a\u60c5\u7eea\u5206\u6790\u4e0e\u8fdb\u4e00\u6b65\u63d0\u5347\u9884\u6d4b\u7684\u51c6\u786e\u6027\u548c\u53ca\u65f6\u6027<\/strong>\u3002<\/p>\n\n\n\n<p><em>\u611f\u8c22\u60a8\u9605\u8bfb\u5230\u6700\u540e\uff0c\u5e0c\u671b\u672c\u6587\u80fd\u7ed9\u60a8\u5e26\u6765\u65b0\u7684\u6536\u83b7\u3002\u7801\u5b57\u4e0d\u6613\uff0c\u8bf7\u5e2e\u6211\u70b9\u8d5e\u3001\u5206\u4eab\u3002\u795d\u60a8\u6295\u8d44\u987a\u5229\uff01\u5982\u679c\u5bf9\u6587\u4e2d\u7684\u5185\u5bb9\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u8bf7\u7ed9\u6211\u7559\u8a00\uff0c\u5fc5\u590d\u3002<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\" id=\"a1c6\">\u672c\u6587\u5185\u5bb9\u4ec5\u9650\u6280\u672f\u63a2\u8ba8\u548c\u5b66\u4e60\uff0c\u4e0d\u6784\u6210\u4efb\u4f55\u6295\u8d44\u5efa\u8bae<\/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:\/\/www.laoyulaoyu.com\/index.php\/2025\/01\/19\/%e3%80%82%e3%80%82%e3%80%82%e7%a7%91%e6%8a%80%e8%82%a1%e9%a2%84%e6%b5%8b%e6%96%b0%e5%88%a9%e5%99%a8%ef%bc%9anlp%e6%83%85%e7%bb%aa%e5%88%86%e6%9e%90%e4%b8%8e%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0\/\">Continue reading<span class=\"screen-reader-text\">\u79d1\u6280\u80a1\u9884\u6d4b\u65b0\u5229\u5668\uff1aNLP\u60c5\u7eea\u5206\u6790\u4e0e\u673a\u5668\u5b66\u4e60\u7684\u5b8c\u7f8e\u878d\u5408\uff08\u4e8c\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":[5,6],"class_list":["post-1810","post","type-post","status-publish","format-standard","hentry","category-aiinvest","tag-ai","tag-6","entry"],"_links":{"self":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/comments?post=1810"}],"version-history":[{"count":2,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1810\/revisions"}],"predecessor-version":[{"id":1909,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1810\/revisions\/1909"}],"wp:attachment":[{"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=1810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=1810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}