Cryptocurrencies have enjoyed significant growth and popularity in recent years. We at EODHD.com provide cryptocurrency prices in USD, but many individuals and businesses may find themselves in a situation where they need to convert those into another currency. Fortunately, this conversion process can be relatively straightforward with the right information at hand. In this article, we will explore how you can convert USD prices of a cryptocurrency to a different currency, because, fortunately, we just happen have the conversion rates as well!
Step 1: Gather the Necessary Data
To begin, you will need two sets of data: the USD prices of a cryptocurrency (as an example, we’ll take Bitcoin as by far the most popular one) and the daily exchange rates between USD and the desired currency (as an example, we’ll take one of the less popular ones, say the Polish Zloty – PLN). For the sake of this example, we’ll use end-of-day prices, but the same process can be applied to different types of data (be that intraday, live or real-time).
The tickers used in the process will be: BTC-USD.CC for Bitcoin, USDPLN.FOREX for the US Dollar / Polish Zloty currency pair. Note that to convert USD cryptocurrency prices to another currency, you will need to use the currency pair ticker that starts with USD, such as USDPLN in this example (easy to memorize: from USD to PLN).
The End-Of-Day Historical Data API will help with obtaining these tickers’ data. Our APIs are quite simple to use, but if you are unfamiliar with how an API works, you can use any of the no-coding solutions that are offered by the documentation. The Get Tickers API will help with getting the right tickers for the CC and FOREX exchanges.
Ensure that both datasets cover the same period for accurate conversion.
Step 2: Learn to Convert the Price
Now that you have obtained the daily cryptocurrency prices and the daily conversion rates, the process involves multiplication of the relevant fields.
BTC-USD.CC:
- “date”: “2023-10-05”,
- “open”: 27798.647127,
- “high”: 28091.861237067,
- “low”: 27375.601423825,
- “close”: 27415.911982168,
- “adjusted_close”: 27415.911982168,
- “volume”: 11877253670
USDPLN.FOREX:
- “date”: “2023-10-05”,
- “open”: 4.3851,
- “high”: 4.3903,
- “low”: 4.3582,
- “close”: 4.3591,
- “adjusted_close”: 4.3591,
- “volume”: 0
To get the BTC to PLN rate from the above data points, multiply the “close” (or “adjusted_close”, it doesn’t matter in this specific case) fields by each other: 27415.911982168 by 4.3591; that gives us PLN 119508.7019214685 as the closing price for Bitcoin on October 5th, 2023.
Step 3: Repeat for All Desired Dates
As simple as that. For each of the dates in the dataset, multiply their respective closes. Ensure you use the same dates’ data for accuracy – and that’s all! By following these simple steps, you can effectively convert existing daily USD prices of Bitcoin (or any other cryptocurrency) to any different currency.