Check exchange rates using The Console

The Console started as a small side project that was supposed to automatically perform things I do often manually. Checking exchange rates of currencies is one of amongst those repeated actions.

1. invoke: currency

First, I want to check if scripts takes enough of arguments. If not, then display the “Usage” as many shell programs do.

We’ll just evaluate boolean expression args.length != 0 . If it’s false, then assertInfo()  will print text white.

That’s not bulletproof but let’s keep it simple for now. To achieve red text, which looks as an error, you may use assert()  instead, it would look like this:

2. invoke: currency gbp eur

First, I take arguments into variables for better readability.

Then I contact Yahoo Finance service to check exchange rate – this time between British Pound (GBP) and Euro (EUR):

The server returns value in CSV format so I have to split it and take second value, then print it to the console output:

3. invoke: currency 175 gbp eur

To support a specific amount, i.e. – as in this case – 175, I have to check whether there’s 2 or 3 arguments.

Then, in the end, print exchange rate multipled by amount .

Put it somewhere!

Your script will be loaded if it’s anywhere inside %APPDATA%\TheConsole\scripts  folder. Yeah, in the moment of writing it’s supported on Windows only but that may change in future.


The example above shows just a few API calls which cover multiple situations of analyzing data from websites. Between the API functions are:

  • console.log()
  • synchronous Utils.requestUrl()
  • assert()
  • assertInfo()
  • args  array

You can find more about the API on GitHub.