fixerAPI / fixer

A foreign exchange rates and currency conversion API
http://fixer.io
MIT License
2.55k stars 198 forks source link

For anyone else also affected with fixer API being deprecated #107

Closed madisvain closed 6 years ago

madisvain commented 6 years ago

I have built a compatible API with the old fixer that can be freely used. The code is open source and available on Github. Written in Python using the Falcon framework.

Homepage with similar documentation to Fixer.io can be located at exchangeratesapi.io

Hope this will bring relief to some people that used to use fixer.io before and can convert before the old API is deprecated.

Kronuz commented 6 years ago

Particularly useful due the base_currency_access_restricted of the free plan...

soundasleep commented 6 years ago

The new terms also seem to suggest you cannot redistribute or reproduce the Fixer.io API data in any way, except for personal use. https://fixer.io/terms

downhiller commented 6 years ago

Who says he is, @soundasleep? He's getting his data from the ECB, not from fixer.io.

I agree with Kronuz, I went through the steps necessary to carry on using fixer.io on their free plan (I only check the rates once a day) and got the same error from setting base=GBP. Rubbish.

aleqx commented 6 years ago

@madisvain many thanks for your compatible API service!

hanrw commented 6 years ago

@madisvain can support http as well?

markvirtue commented 6 years ago

Even on the FREE plan, it's pretty trivial to use whatever BASE currency you want....

In your code, ensure that the "base" currency you want is one of the "symbols" you ask for. Then get the results as per normal, in the EUR base currency. When you get the results, do a simple math division. Here is is in PHP...

$url = 'http://data.fixer.io/api/latest?access_key=XXXXXXX&symbols=' . implode(',', $symbols); $json = file_get_contents($url); $a = json_decode($json, true); $rates = $a['rates']; $ratio = 1.0 / $rates[$base]; foreach ($rates as $code => $rate) $rates[$code] = $rate * $ratio;

downhiller commented 6 years ago

You're right @markvirtue, limiting the base currency was both stupid AND pointless...

Schusti91 commented 6 years ago

@downhiller

To prevent the restricted base currency error, we created the legacy plan for all GitHub users.

Legacy Plan For a limited period of time we are also offering a Free Legacy Plan for all legacy users. This plan comes with free SSL support and the ability to change base currency.

Julienh commented 6 years ago

The guy who built fixer.io sold his domain name, that's why it changed : https://frankfurter.app

This project started out as Fixer in 2013. I renamed it to Frankfurter after selling the original domain in early 2018.

deficlef commented 6 years ago

Great! Thanks for this.

hcaandersen commented 6 years ago

I just tried frankfurter.app. It returns results, but they're a few days out of date. For example, on 16/7/2018 it returned the following:

{
  "base": "AUD",
  "date": "2018-07-13",
  "rates": {
    "USD": 0.73858
  }
}

Notice that the timestamp is three days old.

soundasleep commented 6 years ago

@hcaandersen That may be because it is over a weekend or public holiday. I think rates are only published at ~4 PM EU time on weekdays.

Julienh commented 6 years ago

@soundasleep @hcaandersen yes the data source is 13 July : https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

hcaandersen commented 6 years ago

OK. I'm in Australia where it's Monday evening, though, so that's no good to me. Also, fixer.io is returning current values.

devinsewell commented 6 years ago

Here's a work around for base currency: (Replace [ACCESS KEY] with ur access key) $c = file_get_contents("http://data.fixer.io/api/latest?access_key=[ACCESS KEY]&format=1"); $exchange = json_decode($c); $exchange = $exchange->rates; $default_base_currency = $exchange->EUR; //DEFAULT BASE CURRENCY $new_base_currency = $exchange->USD; //NEW BASE CURRENCY $base_exchange = $default_base_currency/$new_base_currency; foreach($exchange as $key=>$value){ $new_exhange_rates[$key]=($value*$base_exchange); }

commonpike commented 6 years ago

and for javascript .. setting the base rate to USD

jqxhr .done(function(data) {
   var ratio = 1.0 / data.rates['USD'];
   for (var key in data.rates) { data.rates[key] = data.rates[key]*ratio; }
  // .. and continue as planned
}
Vallance21 commented 5 years ago

Hi Guy's & Gal's,

I had this issue with this in magento 2 fixer.io

the Base Currency rate must be set to Euro in core setting. path login to admin go to stores configuration then go to General>Currency Setup> look for Base Currency and set it to {Euro}.

This is based on free subscription to fixer.io

Screenshot from 2019-11-26 10-17-11

My fixer.io now pulls in all the rates i need hope this helps please note you are limited to 1000 request a month on the free account please view https://fixer.io/product for full pricing

aampudia commented 4 years ago

for Magento 2.3.5.p1 just modify the file \<magento root>/vendor/magento/module-directory/Model/Currency/Import/FixerIo.php
on Line 21 From: . '&base={{CURRENCY_FROM}}&symbols={{CURRENCY_TO}}'; To: . '&base=EUR&symbols={{CURRENCY_FROM}},{{CURRENCY_TO}}'; on Line 132 From: (double)$response['rates'][$currencyTo] To: (double)$response['rates'][$currencyTo]/(double)$response['rates'][$currencyFrom]

Thats it.... it gets (in my case) USD and MXN , both relative to EUR (which i don't need, but has to be the base currency) and divides the MXN rate over USD rate so i get the correct rate for USD ->MXN