Subscribe to RSS feed Better handling of FX in StocksCafe - FX 2.0

By evankoh posted on 12 Oct 2020  -  18,000 views


Note: If you are investing only in stocks that are denominated in your base currency (e.g. SGD), you can skip this article.

The old way of handling FX

Previously, StocksCafe handled portfolio with multiple currencies very simplistically. It would directly convert any non-base currency using the latest FX rate when needed (except for dividends where the FX rate used is the one on ex-date).

While this is an easy to understand and implement approach, there were several issues with it which lead to inaccurate representation of your actual returns in your base currency. e.g. Many users have asked why is it that their Total in SGD cost is constantly changing. In addition, not being able to determine the FX rate for a transaction especially frustrated a few users.

The improved FX 2.0

I spent a good amount of time over the last few weeks working on improving how StocksCafe handles FX.

1) Determine your own FX rate
You can now enter your own FX when you are creating/editing transactions. Note that the field will stay hidden at first but will appear when it detects that the transaction currency is different from your base currency.

2) Accurate Representation in Base Currency
Whenever, there is a need to convert to the base currency either for display or computation purposes, StocksCafe will use the correct FX. For example, if we need to use the base currency cost of a transaction, it will be converted with the FX rate you provided, or StocksCafe's FX rate on the transaction date if you did not provide one.

This actually led to a few questions by users who have noticed that their portfolio values in base currency have changed. As such, I think it is worth mentioning here how the different values are computed.

For example, in Current Portfolio, Total in Base Currency (e.g. Total in SGD)
- Current Cost: uses the FX rates of different transactions fixed on transaction date or given by user
- Current Value: uses the latest FX rate
- Day Change: uses the latest FX rate
- Current P&L: is actually Current Value - Current Cost
- Dividends: uses the FX rate fixed on the ex-dates

One question that seems to pop up with high frequency is "How can P&L for USD be higher than P&L for Total in SGD?". Yes, this is possible due to FX loss.

This is why it is important to track all these as accurately as possible so that we know our actual gain (or loss) in the currency that matters to us.

Example (extreme but not impossible)
If you buy a stock at USD1 when USD to SGD is at 2.
Total cost in USD = 1
Total cost in SGD = 2

Then if the stock now is worth USD1.5 but USD to SGD has weakened to 1.
Total value in USD now = 1.5
Total Value in SGD = 1.5

Therefore:
P&L in USD = 1.5 - 1 = 0.5, but
P&L in SGD = 1.5 - 2 = -0.5

3) Debug Page
As the above can be confusing to many (including myself at times) and we often would like to understand it more in depth, I have created a debug page where details such as the FX rate used will be displayed for anyone to investigate further. As always, please let me know if you spot any errors.

4) Columns related to FX in Portfolio
- A.FX (Average FX): Weighted average of the FX used of transaction currency to base currency
- L.FX (Latest FX): Latest FX of transaction currency to base currency
- FX%: (Latest FX / Average FX - 1) in percentage

To allow us to track our FX rates better, I have added these columns that you can choose to add to your Portfolio page if you like.

Significant changes have been made to the backend to enable all these. Due to the scale of it, I might have missed a thing or two so if you see any irregularities after going through the debug pages, please let me know.

Happy investing (in different currencies)!


Like
22 likes
0 comments



Next Article > < Previous Article
30% off Backtesting Tool Last Chance to get Free StocksCafe ...



List All Articles Other articles by evankoh

Dividends Collected is Back, and Better Than Before
These days, I have been preoccupied with making the switch to using properly licensed data from data I used to crawl from all over the internet. There are still some issues to iron out, but otherwise it is progressing quite well. Due to the switch, I had to take down several features temporarily, and one of the features that went offline was "Dividends Collected". "Dividends Collected" essentially ...

Easily Scan for Trending Stocks
Many Stock Screeners (including the one on SGXcafe previously) only allows you to screen for stocks based on the current value of metrics. However, we are sometimes more interested in the trend of the metric than its current value. Hence, I have recently added more than 50 metrics trends to SGXcafe. At the moment, you are able to use them in two main places. 1) In Screener You can now use SGXcafe screener ...

Upcoming Pricing Changes in 2019
Note: If you are already Friend of StocksCafe (when your subscription ends), price changes does not affect you. It will always be fixed at the rate (your personalized rate) when you first contributed and as long as you continuously contribute :) Last year, when I announced the price change and switch to contribution mode in mid December, several users feedbacked that the announcement was too last minute ...