Impact of exchange rates in companies

Currency exposure may be one of the biggest headaches for big companies.

Jose Manu (CodingFun)
Towards Data Science

--

From an investor’s perspective, it is important to understand the implications that changes in exchange rates have in company financials. In this post, we will first understand how exchange rates affect company profits. Then, we will analyse and plot multiple currency exchange rates with Python.

Photo by Disha Sheta from Pexels

How exchange rates impact companies

Exchange rates are an important factor to take into account when analysing a company. A company may have USD as functional currency (i.e. currency that a company prepares financial results) but have operations (e.g. sales, loans, suppliers, etc.) in a different currency.

When presenting financial results, firms must distinguish between monetary and non-monetary assets/liabilities:

  • Monetary assets/liabilities are those assets that are readily convertible to cash. These assets are retranslated from other currencies to the functional currency of the company at the reporting date. Any gains or losses on the revaluation will impact the profits of the company. For instance, receivables, payables, cash balances and loans are considered as monetary assets/liabilities.
  • Non-monetary assets/liabilities are those that are not retranslated at the reporting date. They are shown in the financial statements using the historical rate (i.e. rate used when the asset was acquired). For instance, inventory, PP&E and intangible assets are considered as non-monetary assets.

Exchange rate impact on Accounts Payables

Account Payables are amounts that companies own to their creditors or suppliers. To understand the impact of exchange rates in a company accounts payables, let's use company ABCD as an example.

Imagine that company ABCD, which reports their numbers in USD is:

  • Buying 10,000€ in materials from an European supplier.
  • The exchange rate at the transaction date is EURUSD = 1.10. Meaning that $1.10 are needed to buy 1€.
  • The purchase will only be payable in 4 months time

At the time of the purchase, company ABCD shows $11,000 (10,000€ *1,10) as account payables in the balance sheet.

Suppose that three months later, when company ABCD is preparing the financial statements, the exchange rate EURUSD has gone down from 1.10 to 0.90. Meaning that we only need $0.90 to buy 1€. Due to the exchange rate change, company ABCD bottom line will be impacted. Now, it only requires $9,000 (10,000€ *0.90) to pay back the initial 10,000€.

Therefore, company ABCD will reduce the liability account payables in the balance sheet by $2,000 and show a $2,000 increase in profits through an unrealised gain.

Exchange rate impact on Loans

Similarly, if a company has a loan denominated in foreign currency and the exchange rates fluctuates, there will be an impact on the company profit and loss.

Suppose that company ABCD has a 10,000€ loan. When the EURUSD exchange rates were 1.10, the company was showing $11,000 as loan in the Balance Sheet. However, when the EURUSD moves from 1.10 to 0.90, company ABCD will report a loan of only 9,000$ in the balance sheet. At the same time, it will report an unrealised gain of $2,000 in profit and losses.

The gain will be realised once the loan is paid back to the bank.

Impact on Exchange Rates in Sales

Interesting, right? Based on the previous two examples, it seems that a company reporting in USD will always benefit when the USD appreciates against other currencies.

Well, this is not always true. Companies selling to countries where currencies are losing value (i.e. depreciating) makes them less competitive. The impact of a firm losing competitive power may be translated into a significant drop in sales volumes.

Imagine company ABCD in the scenario where the USD has appreciated against the EUR. Now a European company will need to pay a higher price in euros to buy 1 product from ABCD. This may lead to the European firm to stop buying from company ABCD and find an alternative supplier in Europe.

Exchange Rates with Python

Now we understand why exchange rates are so important when analysing a company. Next, let’s learn how to calculate and plot exchange rates with Python.

We will build a Python script to retrieve historical forex data from multiple currencies and plot them using matplotlib. I will be using a free financial API, financialmodelingprep, offering a great variety of free financial data.

In the following link is possible to find all currencies for which data is available. For our example, we will extract exchange rates for below four currencies:

First, we import all require packages and make a get request to the API end point returning historical exchange rates for the last few years. Note that we loop through each of the currencies. In each loop, we get the historical prices for a single currency pair.

import requests
import pandas as pd
import matplotlib.pyplot as plt

exchange_rates_Python = {}
currencies = ['EURUSD','CHFUSD=X','AUDUSD','GBPUSD']

for currency in currencies:
forex = requests.get(f'https://financialmodelingprep.com/api/v3/historical-price-full/forex/{currency}')

forex = forex.json()
print(forex)

#outcome example of USDGBP:
{'historical': [{'adjClose': 0.8029,
'change': -0.00032,
'changeOverTime': -0.0004,
'changePercent': -0.04,
'close': 0.8029,
'date': '2020-04-10',
'high': 0.80324,
'label': 'April 10, 20',
'low': 0.80076,
'open': 0.80258},
{'adjClose': 0.8069,
'change': 9e-05,
'changeOverTime': 0.00011,
'changePercent': 0.011,
...

The response contains a dictionary with historical prices. Note that the key historical includes a list with all closing prices from the last few years. Therefore, we can loop through it in order to parse the date and the adj. close for each of the currency pairs. We store the values in an empty dictionary called exchange_rates_Python:

import requests
import pandas as pd
import matplotlib.pyplot as plt

exchange_rates_Python = {}
currencies = ['EURUSD','CHFUSD=X','AUDUSD','USDGBP']

for currency in currencies:
forex = requests.get(f'https://financialmodelingprep.com/api/v3/historical-price-full/forex/{currency}')

forex = forex.json()
exchange_rates_Python[currency] = {}

for item in forex['historical']:
adj_close = item['adjClose']
trade_date = item['date']
exchange_rates_Python[currency][trade_date] = adj_close

Finally, we convert the dictionary into a Pandas DataFrame so that is easy to plot the data using matplotlib. In addition, we convert the index (i.e. dates) into a datetime object:

import requests
import pandas as pd
import matplotlib.pyplot as plt

exchange_rates_Python = {}
currencies = ['EURUSD','CHFUSD=X','AUDUSD','GBPUSD']

for currency in currencies:
forex = requests.get(f'https://financialmodelingprep.com/api/v3/historical-price-full/forex/{currency}')

forex = forex.json()
exchange_rates_Python[currency] = {}

for item in forex['historical']:
adj_close = item['adjClose']
trade_date = item['date']
exchange_rates_Python[currency][trade_date] = adj_close

currencies_df = pd.DataFrame.from_dict(exchange_rates_Python, orient='index')
currencies_df=currencies_df.T
currencies_df.index = pd.to_datetime(currencies_df.index)

Plotting Exchange Rates with Python

Now that we have the exchange rates in a nice Pandas DataFrame, we are ready to plot them. We will use the library matplotlib to create a subplot for each of the currencies.

We will only plot the exchange rate for the last 90 days:

#List of symbols https://financialmodelingprep.com/api/v3/quotes/forex

import requests
import pandas as pd
import matplotlib.pyplot as plt

exchange_rates_Python = {}
currencies = ['EURUSD','CHFUSD=X','AUDUSD','GBPUSD']

for currency in currencies:
forex = requests.get(f'https://financialmodelingprep.com/api/v3/historical-price-full/forex/{currency}')

forex = forex.json()
exchange_rates_Python[currency] = {}

for item in forex['historical']:
adj_close = item['adjClose']
trade_date = item['date']
exchange_rates_Python[currency][trade_date] = adj_close


currencies_df = pd.DataFrame.from_dict(exchange_rates_Python, orient='index')
currencies_df=currencies_df.T
currencies_df.index = pd.to_datetime(currencies_df.index)


#take last 30 days
currencies_df = currencies_df.iloc[:90,:]

fig, axes = plt.subplots(nrows=2, ncols=2)

currencies_df[currencies[0]].plot(ax=axes[0,0])
axes[0,0].set_title(currencies[0])

currencies_df[currencies[1]].plot(ax=axes[0,1])
axes[0,1].set_title(currencies[1])

currencies_df[currencies[2]].plot(ax=axes[1,0])
axes[1,0].set_title(currencies[2])

currencies_df[currencies[3]].plot(ax=axes[1,1])
axes[1,1].set_title(currencies[3])

plt.tight_layout()
plt.show()

Wrapping Up

Just with a few lines of code, we are able to retrieve and plot exchange rates with Python.

We can see that for the last three months, USD is much stronger than for example GBP. In December 2019, we needed around $1.33 to buy 1£, however, in April of 2020, we only needed 1.22$ to buy 1£.

That means that companies having large amounts of open payables or loan in £ are in a much better position to repay the amounts than 4 months ago. However, sales may be affected if British companies decide not to buy products in USD due to the appreciation of the currency.

As we have seen during the post, it is very important to understand a firm’s currency exposure before making investment decisions. I recommend you to analyse company sales, loans and payables in terms of currency exposure.

If you have liked the article, feel free to have a look at my other posts on Python for Finance.

Originally published at https://codingandfun.com on April 30, 2020.

--

--

Python for Finance. Learn step by step how to automate cool financial analysis tools.