create account

Foreign Exchange Calculator Made With R & RShiny by dkmathstats

View this thread on: hive.blogpeakd.comecency.com
· @dkmathstats ·
$6.29
Foreign Exchange Calculator Made With R & RShiny
Hi there. A few weeks ago, I made a [Math Tools Web Application](https://dkmathstats.shinyapps.io/mathTools/) with the use of R programming and its RShiny library. This [Math tools application](https://dkmathstats.shinyapps.io/mathTools/) contained graphing tools, geometry calculators, a quadratic formula calculator and a section for personal finance. 

I have recently added a [foreign exchange calculator](https://dkmathstats.shinyapps.io/mathTools/#section-foreign-exchange-calculator) as an add-on section for converting currency amounts from one currency to another. This forex app uses https://exchangeratesapi.io/ which is a free service for current and historical foreign exchange rates. These exchange rates is published by the [European Central Bank](https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html). 

This post will provide an overview on what this simple forex calculator does. 

<center><img src="https://cdn.pixabay.com/photo/2014/10/21/12/28/money-496229_960_720.jpg" /></center>
<center><a href="https://cdn.pixabay.com/photo/2014/10/21/12/28/money-496229_960_720.jpg">Pixabay Image Source</a></center>



&nbsp;

## Listed Currencies
---

The European Central bank list of currencies was larger than I thought. It just made the dropdown list longer to implement with all the typing. Not a big deal in the grand scheme of things. Here is a screenshot from ECB website that has a sample of the listed currencies.


<center>![ECB_currencies_Feb152021_screenshot.PNG](https://images.hive.blog/DQmaCimJagLtiZceFY9Y9W9t6SJCkAJ8aWfeyXYVtFtCmq9/ECB_currencies_Feb152021_screenshot.PNG)
</center>

<center><img src="https://cdn.pixabay.com/photo/2016/09/19/17/15/currency-1680786_960_720.png
" /></center>
<center><a href="https://cdn.pixabay.com/photo/2016/09/19/17/15/currency-1680786_960_720.png
">Pixabay Image Source</a></center>




&nbsp;

## The Foreign Exchange Calculator Application
---

This Foreign Exchange Calculator is an add-on to my Math Tools application. It is a single page with four sections.


![home_fx_app.PNG](https://images.hive.blog/DQmRdJe6qpSFzSy7aowpqTRZSzHFPY48z5Z6BXhHYFxo9g8/home_fx_app.PNG)

**Top Left Area**

The top left section is just a Pixabay image that has different currencies.

&nbsp;

**Top Right Section**

In the top right area, I have a text box talking about what this foreign exchange rate calculator is about. I mention that this tool is linked with the Exchange Rates API Website and the list of currencies is from the European Central Bank as of January 2021.

The last sentence informs the user of the data and time of their visit. This date and time is updated in real time with the use of R's `Sys.time()` function along with the `format()` function. The format of the date and time is in dayofweek-month-daynumber format. There is also informtion for the user of what the base currency is. The default currency is the Euro set as EUR in this section and for the converter.


&nbsp;


**Bottom Left Section - Forex Calculator**

This bottom left section is the main forex calculator. The user can select a base currency in the drop down menu at the top which is set as the Euro for the default base currency. A Base Currency amount can be set with the number input box. To determine how much of a base currency is worth in terms of a different currency, the user can select a desired currency to convert the base currency into.

Once the inputs are selected or modified, the sentence at the bottom will update according to the user's input. This sentence is of the format of "An amount of x Base Currency is equal to y in the desired currency."

In the screenshot below, I have the base currency as the Euro (EUR) with a base currency amount of 1. The desired currency is set as the Canadian Dollar (CAD) which is the default for the desired currency. The output sentence at the bottom says that `An amount of 1 EUR is equal to 1.53CAD.`.

![home_fx_app.PNG](https://images.hive.blog/DQmRdJe6qpSFzSy7aowpqTRZSzHFPY48z5Z6BXhHYFxo9g8/home_fx_app.PNG)

&nbsp;


This next screenshot shows how much 1000 Euros would be in Canadian dollars. Just simply change the amount in the base currency amount.


![fxapp_EURtoCAD.PNG](https://images.hive.blog/DQmVDSDwNmGzd3G2kJrW6Q1pf46cpoAkYh15hYYFd3kJTRE/fxapp_EURtoCAD.PNG)

&nbsp;

**Bottom Right Section - Forex Reference Table**

I thought of adding in a table of currency exchange rates given a base currency as an extra. This table lists all the currencies supplied by the API and the European Central Bank (ECB). The left column of the table is the currency and the right column lists how much of the currency for 1 unit of the base currency.

Referring to the screenshot above, I have the base currency the Euro In the table of the screenshot, one Euro is equal to 1.5346 CAD, one Euro is equal to 9.4033 Hong Kong Dollars (HKD) and so on. 

Currencies from the table are in the three-letter abbreviated format. For currency codes that are not familiar, you would have to look them up for the corresponding country. You could use a website such as [this one](https://www.iban.com/currency-codes).

<center><img src="https://cdn.pixabay.com/photo/2016/09/03/23/34/cashbox-1642989_960_720.jpg
" /></center>
<center><a href="https://cdn.pixabay.com/photo/2016/09/03/23/34/cashbox-1642989_960_720.jpg
">Pixabay Image Source</a></center>


---

I did not feature too much code here. If you would like to see the code, you can check out [the app](https://dkmathstats.shinyapps.io/mathTools/) and click on the source code button at the top right.

&nbsp;

<center>Thank you for reading.</center>

Posted with [STEMGeeks](https://stemgeeks.net)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 2 others
properties (23)
authordkmathstats
permlinkforeign-exchange-calculator-made-with-r-and-rshiny
categoryhive-163521
json_metadata{"tags":["programming","r","rshiny","application","leofinance","finance","money","forex","stem"],"image":["https://cdn.pixabay.com/photo/2014/10/21/12/28/money-496229_960_720.jpg"],"links":["https://dkmathstats.shinyapps.io/mathTools/"],"app":"stemgeeks/0.1","format":"markdown","canonical_url":"https://stemgeeks.net/@dkmathstats/foreign-exchange-calculator-made-with-r-and-rshiny"}
created2021-02-16 15:27:09
last_update2021-02-16 15:27:09
depth0
children3
last_payout2021-02-23 15:27:09
cashout_time1969-12-31 23:59:59
total_payout_value3.684 HBD
curator_payout_value2.606 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,708
author_reputation111,681,976,437,288
root_title"Foreign Exchange Calculator Made With R & RShiny"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id101,905,701
net_rshares15,828,127,776,432
author_curate_reward""
vote details (66)
@gungunkrishu ·
$0.03
I tried the Application and explored Currency Exchange Converter; works like a gem.. Tried USD to INR conversion and it showed up correct results.. Nice work mate. cheers
👍  , , , , , ,
properties (23)
authorgungunkrishu
permlinkqompim
categoryhive-163521
json_metadata{"tags":["stem"],"app":"stemgeeks/0.1","canonical_url":"https://stemgeeks.net/@gungunkrishu/qompim"}
created2021-02-16 15:54:24
last_update2021-02-16 15:54:24
depth1
children2
last_payout2021-02-23 15:54:24
cashout_time1969-12-31 23:59:59
total_payout_value0.015 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length170
author_reputation871,143,653,848,827
root_title"Foreign Exchange Calculator Made With R & RShiny"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id101,906,105
net_rshares112,243,554,835
author_curate_reward""
vote details (7)
@amr008.stem ·
Congrats you were upvoted from this account because you were in Top 25 engagers yesterday on STEMGeeks .<br> You made a total of **1** comments and talked to **1** different authors .<br> For more details about this project please read here - [link to announcement post](https://leofinance.io/@amr008/engagement-project-14th-februrary-top-engagers-get-curated-for-enaging-with-others-first-day-curation-stats)  <br> You can also delegate and get weekly payouts.
properties (22)
authoramr008.stem
permlinkre-qompim-20210217t045203z
categoryhive-163521
json_metadata"{"app": "beem/0.24.20"}"
created2021-02-17 04:52:06
last_update2021-02-17 04:52:06
depth2
children0
last_payout2021-02-24 04:52:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length461
author_reputation1,377,064,474
root_title"Foreign Exchange Calculator Made With R & RShiny"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id101,916,407
net_rshares0
@dkmathstats ·
Thank you for trying it out. Nice that the USD to INR conversion worked. I wonder about all the other pairs. There are 33 x 32 = 1056 pairs (or 528 unique pairs). Too many to test.

I liked how this one turned out along with the whole Math Tools app in R & RShiny.
properties (22)
authordkmathstats
permlinkqon15j
categoryhive-163521
json_metadata{"app":"hiveblog/0.1"}
created2021-02-16 20:05:42
last_update2021-02-16 20:05:42
depth2
children0
last_payout2021-02-23 20:05:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length264
author_reputation111,681,976,437,288
root_title"Foreign Exchange Calculator Made With R & RShiny"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id101,910,357
net_rshares0