Currency trading applications have been increasing in popularity among people lately. This process, which used to be troublesome, has reached the speed of milliseconds with the development of technology. People can buy and sell hundreds of currencies from a single application.

There are some services hosted by these applications, which are increasing in popularity. These applications are usually the currency conversion chart, which shows the exchange rates of the currency in the hands of the people who will trade. With this currency conversion chart, traders can see the value of the currencies they intend to buy or sell against the currency in their wallet.

An example Currency Conversion Chart is as above.

In this article, we will simulate currency conversion chart in the Python programming language using Fixer API, which provides Currency Exchange API service.

So let’s start.

Integration Fixer API to Python Programming Language

Fixer API, which provides Currency Exchange API service, is preferred in this article because it is a very popular service and it returns up-to-date data in just milliseconds.

Before integrating Fixer API into the project, you must obtain an API key from the fixer.io website. You can use the service with this API key.

Now, we create a sample Python project and paste the following codes, then let’s run it.

import http.client

conn = http.client.HTTPSConnection(“data.fixer.io”)
payload = ”
headers = {}
conn.request(“GET”, “/api/latest?access_key=c0*****f”, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))

When this code runs, the response is as follows.

{
  “success”: true,
  “timestamp”: 1649624524,
  “base”: “EUR”,
  “date”: “2022-04-10”,
  “rates”: {
    “AED”: 4.011231,
    “AFN”: 96.104529,
    “ALL”: 121.773346,
    “AMD”: 519.498984,
    “ANG”: 1.969097,
    “AOA”: 479.086211,
    “ARS”: 121.957108,
    “AUD”: 1.464278,
    “AWG”: 1.964681,
    “AZN”: 1.855471,
    “BAM”: 1.962905,
    “BBD”: 2.205951,
    “BDT”: 94.265458,
    “BGN”: 1.964086,
    “BHD”: 0.411858,
    “BIF”: 2196.75153,
    “BMD”: 1.092096,
    “BND”: 1.488565,
    “BOB”: 7.511273,
    “BRL”: 5.132415,
    “BSD”: 1.092538,
    “BTC”: 0.000025322239,
    “BTN”: 82.848308,
    “BWP”: 12.638051,
    “BYN”: 3.561737,
    “BYR”: 21405.085753,
    “BZD”: 2.202237,
    “CAD”: 1.372295,
    “CDF”: 2196.205154,
    “CHF”: 1.018112,
    “CLF”: 0.032257,
    “CLP”: 890.058453,
    “CNY”: 6.951305,
    “COP”: 4111.021454,
    […]      }
}

In line with the request made to the Fixer API, we have accessed the exchange rate information of the EUR currency to 170 official currencies in the world.

We are customizing our query a little more, as we will only have the currencies we want to trade in our table.

import http.client

conn = http.client.HTTPSConnection(“data.fixer.io”)
payload = ”
headers = {}
conn.request(“GET”, “/api/latest?access_key=c0*****f&symbols=TRY,USD,GBP,AUD”, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))

When this code runs, the response is as follows.

{
  “success”: true,
  “timestamp”: 1649624524,
  “base”: “EUR”,
  “date”: “2022-04-10”,
  “rates”: {
    “TRY”: 16.100501,
    “USD”: 1.092096,
    “GBP”: 0.837818,
    “AUD”: 1.464278
  }
}

With this query, we have obtained the exchange rate information of EUR currency against TRY, USD, GBP and AUD currencies via Fixer API. If we put them in a table on the currency conversion chart, it will look like this.

Currency Conversion Chart

EURTRYUSDGBPAUD
116.1005011.0920960.8378181.464278

In order to dynamically transfer this simulated application to the Currency Conversion Chart, we can open the JSON type data that we query and obtain with the Python programming language to the outside world via a web service. With a front-end application using this web service, the incoming data is instantly transferred to the currency conversion chart.

Conclusion

By using the Fixer API, which provides CurrencyExchange AOI service, you can provide your users with high user satisfaction in their trading transactions by obtaining up-to-date data.