<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Casestudy on 格物堂</title><link>https://gewutang.cn/tags/casestudy/</link><description>Recent content in Casestudy on 格物堂</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><lastBuildDate>Sat, 26 Jul 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://gewutang.cn/tags/casestudy/index.xml" rel="self" type="application/rss+xml"/><item><title>如何根据事件研究来推测市场上涨幅度</title><link>https://gewutang.cn/2025/07/26/casestudy-etf-up/</link><pubDate>Sat, 26 Jul 2025 00:00:00 +0000</pubDate><guid>https://gewutang.cn/2025/07/26/casestudy-etf-up/</guid><description>&#10;&#10;&#10;&lt;p&gt;先获取稀土ETF（代码为516780）的历史行情数据：&lt;/p&gt;&#10;&lt;pre class="r"&gt;&lt;code&gt;library(quantmod)&#10;XT &amp;lt;- getSymbols(&amp;quot;516780.ss&amp;quot;, src = &amp;quot;yahoo&amp;quot;, auto.assign = FALSE)&#10;# 获取子集数据&#10;XT &amp;lt;- round(XT[&amp;quot;2025::&amp;quot;],2)&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;绘制蜡烛图：&lt;/p&gt;&#10;&lt;pre class="r"&gt;&lt;code&gt;chartSeries(XT, theme = &amp;quot;white&amp;quot;)&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;&lt;img src="https://gewutang.cn/2025/07/26/casestudy-etf-up/index_files/figure-html/unnamed-chunk-2-1.png" width="672" /&gt;&lt;/p&gt;&#10;&lt;p&gt;下面标记重大事件。包括：&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;2025年3月，份政府工作报告中提及要“整治行业内卷式竞争”。&lt;/li&gt;&#10;&lt;li&gt;2025年6月17日，全国人大公布修订后的《反不正当竞争法》。&lt;/li&gt;&#10;&lt;li&gt;2025年7月1日，中央财经委员会第七次会议公布要治理企业低价无序竞争。&lt;/li&gt;&#10;&lt;li&gt;2025年7月9日，工信部召开企业公平竞争座谈会。&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;在图上标记重大事件：&lt;/p&gt;&#10;&lt;pre class="r"&gt;&lt;code&gt;# 定义事件日期&#10;event_dates &amp;lt;- as.Date(c(&amp;quot;2025-03-07&amp;quot;, &#10; &amp;quot;2025-06-27&amp;quot;,&#10; &amp;quot;2025-07-01&amp;quot;,&#10; &amp;quot;2025-07-09&amp;quot;)&#10; )&#10;&#10;# 计算事件日期在子集中的相对索引&#10;event_index &amp;lt;- numeric(length(event_dates))&#10;for (i in seq_along(event_dates)) {&#10; event_index[i] &amp;lt;- which(index(XT) == event_dates[i])&#10;}&#10;&#10;# 添加标记点&#10;addPoints(&#10; x = event_index,&#10; y = Ad(XT[event_dates]),&#10; col = &amp;quot;blue&amp;quot;,&#10; pch = 24&#10;)&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;&lt;img src="https://gewutang.cn/2025/07/26/casestudy-etf-up/index_files/figure-html/unnamed-chunk-3-1.png" width="672" /&gt;&lt;/p&gt;&#10;&lt;pre class="r"&gt;&lt;code&gt;library(qmao)&#10;addVLine(index(XT[c(&amp;quot;2025-03-05::2025-03-12&amp;quot;,&#10; &amp;quot;2025-06-17::2025-06-30&amp;quot;,&#10; &amp;quot;2025-07-01::2025-07-25&amp;quot;)&#10; ]),&#10; col = &amp;quot;lightblue&amp;quot;,&#10; border = &amp;quot;lightblue&amp;quot;)&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;&lt;img src="https://gewutang.cn/2025/07/26/casestudy-etf-up/index_files/figure-html/unnamed-chunk-3-2.png" width="672" /&gt;&lt;/p&gt;&#10;</description></item></channel></rss>