eurofxref-0.2.0: Free foreign exchange/currency feed from the European Central Bank

Safe HaskellSafe-Infered

Financial.EuroFXRef

Contents

Description

Example using ghci, where we read the currency rates relative to Euros, and re-base them to hard currency.

 > :m Financial.EuroFXRef Data.Map
 > fmap (assocs . raRates . rebase (Currency "NZD")) fetch :: IO [(Currency, Double)]
 [(Currency "AUD",0.7696441703909034),(Currency "BGN",1.1064094586185438),...

Each number is one unit of the reference currency in that currency, e.g. in this example NZD 1 == AUD 0.77.

Synopsis

Simple

fetch :: (Failure EuropeanCentralBankException m, Failure HttpException m, MonadIO m, Read a) => m (Rates a)Source

Fetch today's currency rates from European Central Bank server. IO works for m and Double for a.

Throws a EuropeanCentralBankException for failures at HTTP and above, or IOException for network-level failures.

Lower-level

europeanCentralBankDaily :: Failure HttpException m => m (Request m')Source

The URL for the European Central Bank's free daily reference rates.

fetchFrom :: (Failure EuropeanCentralBankException m, Failure HttpException m, MonadResource m, MonadBaseControl IO m, Read a) => Request m -> Manager -> m (Rates a)Source

Fetch today's currency rates from the specified URL.

Throws a EuropeanCentralBankException for failures at HTTP and above, or IOException for network-level failures.

parseEuropeanCentralBank :: Read a => UNode String -> Either String (Rates a)Source

Parse the European Central Bank's XML format.