BitBridge
BitBridge is a service that connects external data sources to the ThrillTech platform. Currently, it is primarily used for fetching (or receiving) updated exchange rates from either an operator's platform or an external feed provider and synchronising all services with these rates.
The default external provide we use as www.exchangerate-api.com. In order to make use of this exchange rate feed, you will need to create an API key with the provider and with that, BitBridge can be configured to use the provider.
If BitBridge is configured to retrieve exchange rates, it will do so hourly.
Configuring BitBridge for ExchangeRate-API.com
You will need to visit www.exchangerate-api.com and create a new API key for your organisation or environment. Once you have the key, go through these steps to configure BitBridge correctly. In this example, we are using MongoDB Compass:
- Connect to your MongoDB database and open the
bitbridge.configcollection - Click the ADD DATA button (assuming that you're using Compass)
- Select Insert Document
- Paste the following document into the dialog that opens up:
{
"doc_type": "job-config",
"job_type": "ExchangeRateAPI",
"config": {
"host": "https://v6.exchangerate-api.com",
"path": {
"GET": "/v6/:key/latest/:base_currency"
},
"response": "exchange",
"parameters": [
{
"location": "Path",
"key": "key",
"value": "YOUR_API_KEY_GOES_HERE"
},
{
"location": "Path",
"key": "base_currency",
"value": "EUR"
}
]
},
"active": true
}
- In the first element of
parameters, change thevaluefield to be your API KEY that you created on exchangerate-api.com - Save the document and restart bitbridge
Other Exchange Rate Providers
If you need BitBridge to be integrated with another internal or 3rd party exchange rate provider, please speak to your ThrillTech contact person or account manager about doing the integration.
Pushing Exchange Rates
If you would like to push exchange rates periodically to BitBridge from your own source of exchange rates, this is possible using the POST /currencies API endpoint available on BitBridge.
Each time you push new exchange rates to BitBridge, the rest of the ThrillTech services will be synchronised with the new exchange rates.
Example
In this example, we will be pushing currency exchange rates for the EUR base currency:
POST /currencies
{
"base_currency": "EUR",
"rates": {
"HNL": 26.6701,
"DJF": 192.0955,
"SCR": 15.3367,
"KHR": 4372.5658,
"GMD": 72.8486,
"BWP": 14.8547,
"GBP": 0.8578,
"BYN": 3.5272
}
}
As soon as the call is successfully complete, BitBridge will ensure that all other ThrillTech services are updated with the new exchange rates.
Retrieving latest exchange rates
If you would like to retrieve the latest exchange rates that BitBridge has, you can do so by calling the following endpoint:
GET /currencies/:base_currency
base_currency defines the base currency of the exchnage rate table that you want to retrieve. In a typical setup, BitBridge is only configured to fetch exchange rates for one base currency (eg base currency EUR). In this case, to retrieve the exchange rates for the EUR base currency, you would make the following call:
GET /currencies/EUR
If the exchange rates for the EUR base currency exist, you should receive a response that looks like this:
{
"last_updated": 1711396353136000,
"base_currency": "EUR",
"multipliers": {
"GYD": 226.0646,
"SBD": 8.9604,
"XAF": 655.957,
"MAD": 10.9099,
...
"KID": 1.6587,
"SLE": 24.4312,
"ARS": 923.8843,
"SAR": 4.0533,
"AFN": 77.2238
}
}