How a composite rate is calculated

When CryptFolio needs to convert one currency value to another on a given date – for example, when calculating your historical values, or your inventory reports – there are many different techniques that the rate can be calculated or selected.

Existing valuation

If a transaction has a valuation defined manually, then that value in that valuation currency will be used (and converted through a composite rate if necessary). Otherwise, the value is calculated using a composite rate, as defined below.

What pairs are used?

By default, we use the following priority, to calculate a composite rate for any two given currencies.

1. Identical currencies
• If we are looking to convert BTC to BTC, then we assert that the exchange rate is identity (1.0).
2. A direct currency to currency rate
• If we are looking to convert BTC to NZD, and we have an exchange rate on that date for that currency pair (for any exchange), we will prefer to use that exchange rate, rather than going through a third party currency.
• We remove any exchange pairs from exchanges that are deprecated on the given date, AND are not selected as a preferred exchange.
• We order the remaining exchange pairs, and select the first exchange that matches:
• Exchange pairs from a preferred exchange for that portfolio;
• Exchange pairs from exchanges that are not deprecated (to encourage consistency);
• And finally, by exchange pairs with the longest available data (the difference between earliest and latest rate).
3. A direct currency to currency (inverse) rate
• If we are looking to convert BTC to NZD, and we have an exchange that provides NZD to BTC, we calculate the BTC/NZD exchange rate as the inverse of the NZD/BTC rate.
• We remove any exchange pairs from exchanges that are deprecated on the given date, AND are not selected as a preferred exchange.
• We order the remaining exchange pairs, and select the first exchange that matches:
• Exchange pairs from a preferred exchange for that portfolio;
• Exchange pairs from exchanges that are not deprecated (to encourage consistency);
• And finally, by exchange pairs with the longest available data (the difference between earliest and latest rate).
4. Through intermediary currencies
• If we do not have a direct exchange rate, then we calculate the exchange rate by composing different exchange rates together, using the shortest route that we can find through any number of intermediary currencies, using steps 1-3 above.
• a) Fiat-to-fiat
• If both exchange currencies are fiat currencies, then we will only use US Dollar (USD) and/or Euro (EUR) as intermediary currencies (in that order). This is to reduce volatility incurred when going through cryptocurrency exchanges.
• b) Cryptocurrencies
5. Gaps in data
• Finally, if we are missing exchange data for a given date, but we usually have exchange rate data for that pair, then we will use the next available rate in date descending order.
• For example, if we are looking for EUR/NZD on 26 May, but we do not have data for that date, then we will use the the exchange rate on 25 May, or 24 May, etc.
• If we still do not have an available rate, but we have an exchange with data up to one week before the requested date, then we will use the latest rate within the last week. This is necessary to handle fiat currencies, which often do not publish exchange rates for 24 hours or over weekends.
6. No data
1. If we have gone through all of these steps and still cannot find a composite exchange rate, we will declare the currencies can not be converted.

What time is used for a rate?

For latest conversions, CryptFolio will use the last rate for that exchange pair.

For conversions at a given time, we can calculate composite rates on a daily basis, using the closing rate (close) as at 23:59:59 UTC on that day.

For our inventory reports, we calculate balances as at 00:00 UTC for each day, as most existing financial software and processes expect exchange rates to be calculated only once per day.

In the future, CryptFolio will provide paid users with options for accessing higher-resolution conversions.

Do conversions consider the depth of the order book?

No, only the raw closing price is used, and the available volume is not considered. If you need to consider the depth of order books for example, your portfolio value is extremely high, and you have regulatory or financial requirements for this additional resolution please get in touch.

Examples

To illustrate this behaviour, consider a date 2017-01-01 which has the following exchange rates available:

 Exchange Exchange pair Exchange rate Data available Bitstamp BTC/USD 200.00 5 years Bitstamp BTC/LTC 0.01 3 years BTC-e BTC/LTC 0.02 2 years Fixer.io EUR/USD 1.16 5 years Fixer.io EUR/NZD 1.67 5 years Ethplorer.io BTC/ETH 0.05 2 years Ethplorer.io ETH/ABC 12.34 1 years Ethplorer.io DEF/ABC 1000.00 1 years

We would calculate the following composite rates, according to the rules above:

 Exchange pair requested Exchanges used Currencies used Calculated composite rate Per rules USD/USD none n/a 1.00 #1, currencies are identical BTC/USD Bitstamp BTC -> USD 200.00 #2, using direct USD/BTC Bitstamp USD -> BTC 0.005 #3, using direct inverse = 1/200.0 BTC/LTC Bitstamp BTC -> LTC 0.01 #2, prefer exchange pair with more data LTC/BTC Bitstamp LTC -> BTC 100.00 #3, prefer exchange pair with more data, using direct inverse = 1/100.0 USD/NZD Fixer.io, Fixer.io USD -> EUR -> NZD 1.43 #4a, fiat intermediary currencies = (1/1.16) * 1.67 ABC/BTC Ethplorer.io, Ethplorer.io ABC -> ETH -> BTC 1.62 #4b, crypto intermediary currencies = (1/12.34) * (1/0.05) ABC/NZD Ethplorer.io, Ethplorer.io, Bitstamp, Fixer.io, Fixer.io ABC -> ETH -> BTC -> USD -> NZD 466.66 #4b, crypto and fiat intermediary currencies = (1/12.34) * (1/0.05) * 200.00 * (1/1.16) * 1.67 DEF/NZD none n/a n/a #6, could not calculate a composite rate using the available intermediary currencies

Configuring this behaviour

For any composite rate used on CryptFolio, you can view which exchanges were used to calculate the rate, by clicking on the (?) next to the rate: