30 Years of Korean Won Exchange Rate Graphs: The Volatility of the Korean Economy at a Glance!
The KRW exchange rate is an important indicator of the interaction between the Korean economy and the global economy. Dollar exchange rate graph Looking at the 30-year change, you can see that there were dramatic swings at certain times.
In this post, we'll use the Pythonand the Yahoo Finance API to get 30 years of data for a graph of the dollar exchange rate and plot the major fluctuations. This will help us visually understand the impact of economic shocks.

1. Prepare to collect data
To get Yahoo Finance data in Python, you can use the yfinance library. These libraries provide historical data for free, and you can get started with a simple setup. Additionally pandas-datareaderI FinanceDataReader You can also utilize other libraries like
pip install yfinance matplotlibAfter installation, use the code below to import exchange rate data from 1994 to 2024 (My goal is to get and visualize 30 years of graphs of the USD exchange rate, but unfortunately Yahoo Finance doesn't seem to have data back to 2004 or so.)
2. collect and visualize exchange rate data (full code)
import yfinance as yf
import matplotlib.pyplot as plt
from datetime import datetime
# Define currency pair and date range
currency_pair = "USDKRW=X"
start_date = "1994-01-01"
end_date = "2024-12-31"
# Download data from Yahoo Finance
data = yf.download(currency_pair, start=start_date, end=end_date)
# Plot exchange rate data
plt.figure(figsize=(14, 7))
plt.plot(data.index, data['Close'], label="KRW/USD Exchange Rate", color="steelblue")
# Highlight major economic events
events = {
"1997-12-01": "IMF Crisis",
"2008-09-15": "Global Financial Crisis",
"2020-03-01": "COVID-19 Pandemic",
"2022-02-24": "Russia-Ukraine War"
}
for date, label in events.items():
plt.axvline(datetime.strptime(date, "%Y-%m-%d"), color="red", linestyle="--", alpha=0.7)
plt.text(datetime.strptime(date, "%Y-%m-%d"), plt.ylim()[1] * 0.9, label, color="red")
# Add moving average line
data['MA50'] = data['Close'].rolling(window=50).mean()
plt.plot(data.index, data['MA50'], label="50-Day Moving Average", color="orange")
# Highlight max and min exchange rates
max_rate = data['Close'].max()
min_rate = data['Close'].min()
max_date = data['Close'].idxmax()
min_date = data['Close'].idxmin()
plt.scatter(max_date, max_rate.item(), color='green', label=f'Max Rate: {max_rate.item():.2f}', zorder=5)
plt.scatter(min_date, min_rate.item(), color='purple', label=f'Min Rate: {min_rate.item():.2f}', zorder=5)
# Customize plot
plt.title("KRW/USD Exchange Rate Over 30 Years", fontsize=16)
plt.xlabel("Year", fontsize=12)
plt.ylabel("Exchange Rate (KRW/USD)", fontsize=12)
plt.legend()
plt.grid(True)
plt.show()3. Analyze key times of change

IMF foreign exchange crisis (1997-1998):
- At the end of 1997, the IMF foreign exchange crisis caused the exchange rate to skyrocket, with the value of the Korean won plummeting to over 2,000 won.
Global Financial Crisis (2008):
- In 2008, the bankruptcy of Lehman Brothers and the onset of the global financial crisis caused the value of the Korean Won to fall again.
Coronavirus pandemic (2020):
- In early 2020, the coronavirus pandemic destabilized financial markets around the world, and the exchange rate of the Korean Won fluctuated dramatically.
Russia-Ukraine War (2022):
- The outbreak of the Russia-Ukraine war in 2022 created uncertainty in the global economy, and the value of the Korean won weakened again.
4. 30-year visualization results for the USD exchange rate graph
Running the code above will generate the graph at the beginning of this post, which displays data on the exchange rate of the Korean Won against the US Dollar from 2004 to 2024. The graph shows when major events occurred as red lines to help you visually understand the reasons for the fluctuations. It also shows the maximum and minimum exchange rates as green and purple dots, respectively, so you can see the corresponding numbers.
5. Organize
The 30-year data for the Korean won-dollar exchange rate graph provides an important resource for understanding the past and predicting the future of the Korean economy. The main causes of exchange rate fluctuations have been foreign exchange crises, financial crises, pandemics, and geopolitical events.
Python and the Yahoo Finance API make it easy to collect and analyze historical data. We recommend using this code to analyze longer periods of data or other currency data.
# Code Explained: Collect and visualize exchange rate data
import yfinance as yf
import matplotlib.pyplot as plt
from datetime import datetimeyfinancelibrary to theyfto import Yahoo Finance data.matplotlib.pyplottopltto draw graphs for data visualization.datetimemodule to cover date formats.
currency_pair = "USDKRW=X"
start_date = "1994-01-01"
end_date = "2024-12-31"currency_pairvariable to store the symbol for the yuan-dollar exchange rate.start_dateandend_dateto set the start and end dates of the data collection period.
data = yf.download(currency_pair, start=start_date, end=end_date)yfinanceThedownloadfunction to download exchange rate data for a set period of time.
plt.figure(figsize=(14, 7))
plt.plot(data.index, data['Close'], label="KRW/USD Exchange Rate", color="steelblue")- Create a new graph and set its size.
- The date of the exchange rate data (
index) and the closing price (Close) to draw a line graph.
events = {
"1997-12-01": "IMF Crisis",
"2008-09-15": "Global Financial Crisis",
"2020-03-01": "COVID-19 Pandemic",
"2022-02-24": "Russia-Ukraine War"
}- Define major economic events and their dates as a dictionary.
for date, label in events.items():
plt.axvline(datetime.strptime(date, "%Y-%m-%d"), color="red", linestyle="--", alpha=0.7)
plt.text(datetime.strptime(date, "%Y-%m-%d"), plt.ylim()[1] * 0.9, label, color="red")- Draw a vertical line to the date of each event to display it on the graph.
- Add the case name as text in the appropriate location.
data['MA50'] = data['Close'].rolling(window=50).mean()
plt.plot(data.index, data['MA50'], label="50-Day Moving Average", color="orange")- Calculate a 50-day moving average line and add it to the data.
- Add a moving average line to the graph to visualize the trend.
max_rate = data['Close'].max()
min_rate = data['Close'].min()
max_date = data['Close'].idxmax()
min_date = data['Close'].idxmin()
plt.scatter(max_date, max_rate.item(), color='green', label=f'Max Rate: {max_rate.item():.2f}', zorder=5)
plt.scatter(min_date, min_rate.item(), color='purple', label=f'Min Rate: {min_rate.item():.2f}', zorder=5)- Calculate the maximum and minimum exchange rate values and find the corresponding dates.
- The maximum value is highlighted with a green dot and the minimum with a purple dot.
plt.title("KRW/USD Exchange Rate Over 30 Years", fontsize=16)
plt.xlabel("Year", fontsize=12)
plt.ylabel("Exchange Rate (KRW/USD)", fontsize=12)
plt.legend()
plt.grid(True)
plt.show()- Set the graph title and axis labels.
- Add a legend and enable the grid to make it more readable.
- Display the graph on the screen.






