{"id":3883,"date":"2024-12-09T14:09:10","date_gmt":"2024-12-09T05:09:10","guid":{"rendered":"https:\/\/secondlife.lol\/?p=3883"},"modified":"2024-12-07T14:37:40","modified_gmt":"2024-12-07T05:37:40","slug":"martial-law-exchange-rate-r-visualization","status":"publish","type":"post","link":"https:\/\/secondlife.lol\/en\/martial-law-exchange-rate-r-visualization\/","title":{"rendered":"Exchange rate shock after 45 years of martial law: Graphing the USD exchange rate with R visualization"},"content":{"rendered":"<p class=\"wp-block-paragraph\">On December 3, 2024, at 10:27 p.m., South Korea declared martial law, which threw financial markets into turmoil. Martial law is a measure used by governments to maintain order through military control in times of national emergency, and can have a severe impact on the economy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this post, we'll share the process of analyzing the impact of martial law on exchange rates using R visualization methods and generating a graph of the exchange rate of the Korean Won. This will help you quantitatively understand the economic impact of martial law and how to respond in the future.<\/p>\n\n\n<style>.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{padding-top:var(--global-kb-spacing-sm, 1.5rem);padding-right:var(--global-kb-spacing-sm, 1.5rem);padding-bottom:var(--global-kb-spacing-sm, 1.5rem);padding-left:var(--global-kb-spacing-sm, 1.5rem);border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title-wrap{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title-wrap{color:var(--global-palette2, #2B6CB0);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{color:var(--global-palette2, #2B6CB0);font-size:28px;font-weight:regular;font-style:normal;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap .kb-table-of-content-list{color:var(--global-palette1, #3182CE);line-height:2em;font-weight:regular;font-style:normal;margin-top:var(--global-kb-spacing-sm, 1.5rem);margin-right:0px;margin-bottom:0px;margin-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap .kb-table-of-content-list .kb-table-of-contents__entry:hover{color:var(--global-palette6, #718096);}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);}}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{font-size:28px;}}@media all and (max-width: 767px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{font-size:28px;}}<\/style>\n\n<style>.kb-image3883_223fbd-74 .kb-image-has-overlay:after{opacity:0.3;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;}.kb-image3883_223fbd-74 img.kb-img, .kb-image3883_223fbd-74 .kb-img img{border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}<\/style>\n<div class=\"wp-block-kadence-image kb-image3883_223fbd-74\"><figure class=\"aligncenter size-medium_large\"><img decoding=\"async\" width=\"768\" height=\"415\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/826AD1E9-32BE-4487-A3ED-00BEB5E35CA7-768x415.jpg\" alt=\"R\ub85c \uc2dc\uac01\ud654\ud55c \uacc4\uc5c4\ub839 \ubc1c\ud45c\ud6c4 \uc6d0\ub2ec\ub7ec \ud658\uc728 \uadf8\ub798\ud504\" class=\"kb-img wp-image-3886\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/826AD1E9-32BE-4487-A3ED-00BEB5E35CA7-768x415.jpg 768w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/826AD1E9-32BE-4487-A3ED-00BEB5E35CA7-300x162.jpg 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/826AD1E9-32BE-4487-A3ED-00BEB5E35CA7-600x325.jpg 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/826AD1E9-32BE-4487-A3ED-00BEB5E35CA7-18x10.jpg 18w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/826AD1E9-32BE-4487-A3ED-00BEB5E35CA7.jpg 1200w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><figcaption>(A graph of the USD exchange rate visualized in R)<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">1. Install and load the required packages<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, we install and load the R packages we need to import and visualize the data. If you don't have these packages installed before loading them, the console will tell you that you need to install them when you run the code. Most likely, you don't have alphavantager installed, so you can use the install.packages command in the source code below to install the missing packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Install and load the required packages\n# install.packages(\"alphavantager\") # install.packages When installing packages, you will see \" Required!\nlibrary(alphavantager)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(lubridate)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/www.alphavantage.co\/\" target=\"_blank\" rel=\"noopener\">Alpha Vantage<\/a><\/strong>The <strong>Free APIs for stock, forex, and cryptocurrency data<\/strong>for users. Users can utilize the data by registering with an email and receiving a free API key. The API provides data in JSON and CSV formats and includes time series data on stocks, basic information on companies, technical indicators, and more. The free API allows up to 500 requests per day and up to 5 requests per minute, and real-time data is limited to forex and cryptocurrencies.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. Set up Alpha Vantage API and download data<\/h2>\n\n\n<style>.kb-image3883_0a3ce2-14 .kb-image-has-overlay:after{opacity:0.3;}<\/style>\n<div class=\"wp-block-kadence-image kb-image3883_0a3ce2-14\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.alphavantage.co\/\" class=\"kb-advanced-image-link\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"600\" height=\"725\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/Screenshot_20241207-1431102-1-600x725.jpg\" alt=\"Alpha Vantage website\" class=\"kb-img wp-image-3916\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/Screenshot_20241207-1431102-1-600x725.jpg 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/Screenshot_20241207-1431102-1-300x362.jpg 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/Screenshot_20241207-1431102-1-768x927.jpg 768w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/Screenshot_20241207-1431102-1-10x12.jpg 10w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/Screenshot_20241207-1431102-1.jpg 1200w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption>( <a href=\"https:\/\/www.alphavantage.co\/\" target=\"_blank\" rel=\"noopener\">Alpha Vantage website<\/a> )<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Use the Alpha Vantage API to download minute-by-minute exchange rate data. To use this API <a href=\"https:\/\/secondlife.lol\/en\/alpha-vantage-api-key-guide\/\">Requires an issued API key<\/a>in the file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Alpha Vantage API Key Setup\nav_api_key(\"YOUR_ALPHA_VANTAGE_API_KEY\") # Enter your issued API key\n\n# Download minute-by-minute data\nsymbol &lt;- &quot;USDKRW&quot; # Korean won-dollar exchange rate symbol\ndata &lt;- av_get(\n  symbol = symbol,\n  av_fun = &quot;TIME_SERIES_INTRADAY&quot;, # Settings to get Intraday data\n  interval = &quot;1min&quot;, # Interval in 1 minute increments\n  outputsize = &quot;full&quot; # Request full data\n)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. data preprocessing<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Preprocess the downloaded data and convert it into a form suitable for analysis. This includes time zone conversion and selecting the columns you need.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Preprocessing # data (including UTC \u2192 KST conversion)\ndata_filtered %\n  select(timestamp, open, high, low, close) %&gt;% # Select the columns you need\n  mutate(timestamp = with_tz(timestamp, tzone = \"Asia\/Seoul\")) %&gt;% # Convert UTC to KST\n  filter(\n    timestamp &gt;= as.POSIXct(\"2024-12-03 00:00:00\", tz = \"Asia\/Seoul\") &amp; # December 3, 2024 after 0:00 KST\n      timestamp %\n  arrange(timestamp) # sort by timestamp\n\nHandle if # data is empty\nif (nrow(data_filtered) == 0) {\n  stop(\"No data available for the selected time range. Please check the API or time range.\")\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. calculate the average, best, and worst exchange rates<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Calculate the average, best, and worst exchange rates based on the preprocessed data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Calculate # average, high, low exchange rate\navg_rate &lt;- mean(data_filtered$close, na.rm = TRUE) # to calculate the average rate\nmax_rate &lt;- max(data_filtered$high, na.rm = TRUE) # to calculate the highest exchange rate\nmin_rate &lt;- min(data_filtered$low, na.rm = TRUE) # to calculate the lowest rate<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">5. Visualize a graph of the USD exchange rate<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/secondlife.lol\/en\/ggplot2-intro\/\" data-type=\"post\" data-id=\"3055\">ggplot<\/a>2 to visualize exchange rate fluctuations.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Visualize #\nggplot(data_filtered, aes(x = timestamp, y = close)) +\n  geom_line(color = \"steelblue\", size = 1.2) + # Rate Change Line Graph\n  geom_hline(yintercept = avg_rate, color = \"darkgreen\", linetype = \"dashed\", size = 1) + # Average exchange rate horizontal line\n  geom_hline(yintercept = max_rate, color = \"red\", linetype = \"dotted\", size = 1) + # maximum rate horizontal line\n  geom_hline(yintercept = min_rate, color = \"blue\", linetype = \"dotted\", size = 1) + # lowest exchange rate horizontal line\n  annotate(\"text\", x = max(data_filtered$timestamp), y = avg_rate,\n           label = paste0(\"Average: \", round(avg_rate, 2)), vjust = -1, color = \"darkgreen\") +\n  annotate(\"text\", x = max(data_filtered$timestamp), y = max_rate,\n           label = paste0(\"Max: \", round(max_rate, 2)), vjust = -1, color = \"red\") +\n  annotate(\"text\", x = max(data_filtered$timestamp), y = min_rate,\n           label = paste0(\"Min: \", round(min_rate, 2)), vjust = 2, color = \"blue\") +\n  labs(\n    title = \"KRW\/USD Exchange Rate from Midnight, Dec 3, 2024 (KST)\",\n    subtitle = \"1-Minute Interval Data via Alpha Vantage API\",\n    x = \"Time (KST)\",\n    y = \"Exchange Rate (KRW per USD)\"\n  ) + \u0392\n  theme_minimal() +\n  theme(\n    plot.title = element_text(size = 18, face=\"bold\"),\n    plot.subtitle= element_text(size=14),\n    axis.title= element_text(size=12),\n    axis.text= element_text(size=10),\n    axis.text.x= element_text(angle=45,hjust=1)         <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6. Martial Law and Financial Markets: What the Data Means<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The declaration of martial law had a huge psychological and practical impact on financial markets. R can be used to quantitatively analyze this data and help inform investment decisions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The code in this post to generate a graph of the dollar exchange rate shows how to take exchange rate data directly and analyze and visualize changes. These methods are very useful for getting a comprehensive understanding of economic conditions beyond just the numbers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"># Full Code &amp; Detailed Code Explanation<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Install and load the required packages\n# install.packages(\"alphavantager\")\nlibrary(alphavantager)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(lubridate)\n\nSet the # Alpha Vantage API key\nav_api_key(\"YOUR_ALPHA_VANTAGE_API_KEY\") # Enter your issued API key\n\n# Download minute-by-minute data\nsymbol &lt;- &quot;USDKRW&quot; # Korean won-dollar exchange rate symbol\ndata &lt;- av_get(\n  symbol = symbol,\n  av_fun = &quot;TIME_SERIES_INTRADAY&quot;, # Settings to get Intraday data\n  interval = &quot;1min&quot;, # Interval in 1 minute increments\n  outputsize = &quot;full&quot; # Request full data\n)\n\nPreprocess # data (including UTC \u2192 KST conversion)\ndata_filtered %\n  select(timestamp, open, high, low, close) %&gt;% # Select the required columns\n  mutate(timestamp = with_tz(timestamp, tzone = \"Asia\/Seoul\")) %&gt;% # Convert UTC to KST\n  filter(\n    timestamp &gt;= as.POSIXct(\"2024-12-03 00:00:00\", tz = \"Asia\/Seoul\") &amp; # December 3, 2024 after 0:00 KST\n      timestamp %\n  arrange(timestamp) # sort by timestamp\n\nHandle if # data is empty\nif (nrow(data_filtered) == 0) {\n  stop(\"No data available for the selected time range. Please check the API or time range.\")\n}\n\nCalculate the average, highest, and lowest exchange rate for #\navg_rate &lt;- mean(data_filtered$close, na.rm = TRUE) Calculate the average rate for #\nmax_rate &lt;- max(data_filtered$high, na.rm = TRUE) # to calculate the highest exchange rate\nmin_rate &lt;- min(data_filtered$low, na.rm = TRUE) # to calculate the lowest rate\n\nVisualize #\nggplot(data_filtered, aes(x = timestamp, y = close)) +\n  geom_line(color = &quot;steelblue&quot;, size = 1.2) + # Exchange Rate Change Line Graph\n  geom_hline(yintercept = avg_rate, color = &quot;darkgreen&quot;, linetype = &quot;dashed&quot;, size = 1) +\n  geom_hline(yintercept = max_rate, color = &quot;red&quot;, linetype = &quot;dotted&quot;, size = 1) +\n  geom_hline(yintercept = min_rate, color = &quot;blue&quot;, linetype = &quot;dotted&quot;, size = 1) +\n  annotate(&quot;text&quot;, x = max(data_filtered$timestamp), y = avg_rate,\n           label = paste0(&quot;Average: &quot;, round(avg_rate, 2)), vjust = -1, color = &quot;darkgreen&quot;) +\n  annotate(&quot;text&quot;, x = max(data_filtered$timestamp), y = max_rate,\n           label = paste0(&quot;Max: &quot;, round(max_rate, 2)), vjust = -1, color = &quot;red&quot;) +\n  annotate(&quot;text&quot;, x = max(data_filtered$timestamp), y = min_rate,\n           label = paste0(&quot;Min: &quot;, round(min_rate, 2)), vjust = 2, color = &quot;blue&quot;) +\n  labs(\n    title = &quot;KRW\/USD Exchange Rate from Midnight, Dec 3, 2024 (KST)&quot;,\n    subtitle = &quot;1-Minute Interval Data via Alpha Vantage API&quot;,\n    x = &quot;Time (KST)&quot;,\n    y = &quot;Exchange Rate (KRW per USD)&quot;\n  ) + \u0392\n  theme_minimal() +\n  theme(\n    plot.title=element_text(size=18, face=&quot;bold&quot;),\n    plot.subtitle=element_text(size=14),\n    axis.title=element_text(size=12),\n    axis.text=element_text(size=10),\n    axis.text.x=element_text(angle=45,hjust=1)\n)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Interpreting code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. <strong>Installing and loading packages<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   library(alphavantager)\n   library(dplyr)\n   library(ggplot2)\n   library(lubridate)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>alphavantager<\/code>Used to get financial data through the Alpha Vantage API.<\/li>\n\n\n\n<li><code>dplyr<\/code>: Packages for preprocessing and manipulating data.<\/li>\n\n\n\n<li><code>ggplot2<\/code>: A package for data visualization.<\/li>\n\n\n\n<li><code>lubridate<\/code>: Package for date and time manipulation.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">2. <strong>Set up your Alpha Vantage API key<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   av_api_key(\"YOUR_ALPHA_VANTAGE_API_KEY\")<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set up a private API key to use the Alpha Vantage API.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">3. <strong>Downloading data<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   symbol &lt;- &quot;USDKRW&quot;\n   data &lt;- av_get(\n     symbol=symbol,\n     av_fun=&quot;TIME_SERIES_INTRADAY&quot;,\n     interval=&quot;1min&quot;,\n     outputsize=&quot;full&quot;\n   )<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>symbol<\/code>Sets the symbol for the won-dollar exchange rate.<\/li>\n\n\n\n<li><code>av_get<\/code>: Get the won-dollar exchange rate data from Alpha Vantage on a minute-by-minute basis.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">4. <strong>Data preprocessing<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   data_filtered %\n     select(timestamp, open, high, low, close) %&gt;%\n     mutate(timestamp=with_tz(timestamp, tzone=\"Asia\/Seoul\")) %&gt;%\n     filter(\n       timestamp &gt;= as.POSIXct(\"2024-12-03 00:00:00\", tz=\"Asia\/Seoul\") &amp;\n       timestamp %\n     arrange(timestamp)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>select<\/code>: Select only the columns you need.<\/li>\n\n\n\n<li><code>mutate<\/code>: Converts UTC time to Korean Standard Time (KST).<\/li>\n\n\n\n<li><code>filter<\/code>: Filters data within a specified date range.<\/li>\n\n\n\n<li><code>arrange<\/code>: Sort the data in chronological order.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">5. <strong>Handling when data is empty<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   if (nrow(data_filtered) == 0) {\n     stop(\"No data available for the selected time range. Please check the API or time range.\")\n   }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the filtered data is empty, output an error message and abort execution.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">6. <strong>Calculate average, best, and worst exchange rates<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   avg_rate &lt;- mean(data_filtered$close, na.rm=TRUE)\n   max_rate &lt;- max(data_filtered$high, na.rm=TRUE)\n   min_rate &lt;- min(data_filtered$low, na.rm=TRUE)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Average (<code>avg_rate<\/code>), highest (<code>max_rate<\/code>), lowest (<code>min_rate<\/code>) Calculate the exchange rate for each.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">7. graph of the USD exchange rate <strong>Visualization<\/strong> \u4e0b\u8f09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   ggplot(data_filtered, aes(x=timestamp, y=close)) +\n     geom_line(color=\"steelblue\", size=1.2) +\n     geom_hline(yintercept=avg_rate,color=\"darkgreen\",linetype=\"dashed\",size=1)+\n     geom_hline(yintercept=max_rate,color=\"red\",linetype=\"dotted\",size=1)+\n     geom_hline(yintercept=min_rate,color=\"blue\",linetype=\"dotted\",size=1)+\n     annotate(\"text\",x=max(data_filtered$timestamp),y=avg_rate,\n              label=paste0(\"Average: \",round(avg_rate,2)),vjust=-1,color=\"darkgreen\")+\n     annotate(\"text\",x=max(data_filtered$timestamp),y=max_rate,\n              label=paste0(\"Max: \",round(max_rate,2)),vjust=-1,color=\"red\")+\n     annotate(\"text\",x=max(data_filtered$timestamp),y=min_rate,\n              label=paste0(\"Min: \",round(min_rate,2)),vjust=2,color=\"blue\")+\n     labs(\n       title=\"KRW\/USD Exchange Rate from Midnight, Dec3,2024(KST)\",\n       subtitle=\"1-Minute Interval Data via Alpha Vantage API\",\n       x=\"Time (KST)\",\n       y=\"Exchange Rate (KRW per USD)\"\n     ) + \u0392\n     theme_minimal() +\n     theme(\n       plot.title=element_text(size=18, face=\"bold\"),\n       plot.subtitle=element_text(size=14),\n       axis.title=element_text(size=12),\n       axis.text=element_text(size=10),\n       axis.text.x=element_text(angle=45,hjust=1)\n     )<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>geom_line<\/code>: Shows the change in the exchange rate as a line graph.<\/li>\n\n\n\n<li><code>geom_hline<\/code>Displays the average (green dotted line), highest (red dotted line), and lowest (blue dotted line) exchange rates as horizontal lines.<\/li>\n\n\n\n<li><code>annotate<\/code>: Adds a text annotation of each figure to the graph.<\/li>\n\n\n\n<li><code>labs<\/code>: Set the graph title and axis labels.<\/li>\n\n\n\n<li><code>theme_minimal<\/code> and <code>theme<\/code>: Sets the style and text size of the graph.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This code demonstrates the process of using R visualization methods to get data from the Alpha Vantage API, analyze it, and generate a graph of the Korean Won exchange rate. (The generated graph is a bit off in terms of dates, but this is likely due to the timezone, so I'll do a little more research and change it to match your local time).<\/p>","protected":false},"excerpt":{"rendered":"<p>On December 3, 2024, at 10:27 p.m., martial law was declared in South Korea, causing financial markets to...<\/p>","protected":false},"author":3,"featured_media":3906,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6],"tags":[581,174,582,249,164,583,580],"class_list":["post-3883","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r-coding","tag-alpha-vantage-api","tag-r-","tag-582","tag-249","tag-164","tag-583","tag-580"],"taxonomy_info":{"category":[{"value":6,"label":"\uc54c(R)"}],"post_tag":[{"value":581,"label":"Alpha Vantage API"},{"value":174,"label":"R \ud504\ub85c\uadf8\ub798\ubc0d"},{"value":582,"label":"\uacc4\uc5c4\ub839"},{"value":249,"label":"\uae08\uc735 \ub370\uc774\ud130"},{"value":164,"label":"\ub370\uc774\ud130 \uc2dc\uac01\ud654"},{"value":583,"label":"\ud658\uc728 \uadf8\ub798\ud504"},{"value":580,"label":"\ud658\uc728 \ubd84\uc11d"}]},"featured_image_src_large":["https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/12\/\uc6d0\ub2ec\ub7ec-\ud658\uc728-\uadf8\ub798\ud504-\uc0dd\uc131-\ud3ec\uc2a4\ud2b8-\uc378\ub124\uc77c-600x600.jpg",600,600,true],"author_info":{"display_name":"TERE","author_link":"https:\/\/secondlife.lol\/en\/author\/tere\/"},"comment_info":0,"category_info":[{"term_id":6,"name":"\uc54c(R)","slug":"r-coding","term_group":0,"term_taxonomy_id":6,"taxonomy":"category","description":"","parent":20,"count":61,"filter":"raw","cat_ID":6,"category_count":61,"category_description":"","cat_name":"\uc54c(R)","category_nicename":"r-coding","category_parent":20}],"tag_info":[{"term_id":581,"name":"Alpha Vantage API","slug":"alpha-vantage-api","term_group":0,"term_taxonomy_id":581,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":174,"name":"R \ud504\ub85c\uadf8\ub798\ubc0d","slug":"r-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%98%eb%b0%8d","term_group":0,"term_taxonomy_id":174,"taxonomy":"post_tag","description":"","parent":0,"count":15,"filter":"raw"},{"term_id":582,"name":"\uacc4\uc5c4\ub839","slug":"%ea%b3%84%ec%97%84%eb%a0%b9","term_group":0,"term_taxonomy_id":582,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":249,"name":"\uae08\uc735 \ub370\uc774\ud130","slug":"%ea%b8%88%ec%9c%b5-%eb%8d%b0%ec%9d%b4%ed%84%b0","term_group":0,"term_taxonomy_id":249,"taxonomy":"post_tag","description":"","parent":0,"count":3,"filter":"raw"},{"term_id":164,"name":"\ub370\uc774\ud130 \uc2dc\uac01\ud654","slug":"%eb%8d%b0%ec%9d%b4%ed%84%b0-%ec%8b%9c%ea%b0%81%ed%99%94","term_group":0,"term_taxonomy_id":164,"taxonomy":"post_tag","description":"","parent":0,"count":52,"filter":"raw"},{"term_id":583,"name":"\ud658\uc728 \uadf8\ub798\ud504","slug":"%ed%99%98%ec%9c%a8-%ea%b7%b8%eb%9e%98%ed%94%84","term_group":0,"term_taxonomy_id":583,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":580,"name":"\ud658\uc728 \ubd84\uc11d","slug":"%ed%99%98%ec%9c%a8-%eb%b6%84%ec%84%9d","term_group":0,"term_taxonomy_id":580,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts\/3883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/comments?post=3883"}],"version-history":[{"count":14,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts\/3883\/revisions"}],"predecessor-version":[{"id":3917,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts\/3883\/revisions\/3917"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/media\/3906"}],"wp:attachment":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/media?parent=3883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/categories?post=3883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/tags?post=3883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}