Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 

README.md

CBR Elixir

http://cbr.ru Central Bank of the Russian Federation API Elixir wrapper

Installation

The package can be installed from hex:

  1. Add cbr_elixir to your list of dependencies in mix.exs:
def deps do
  [{:cbr_elixir, "~> 0.1.3"}]
end
  1. Ensure cbr_elixir is started before your application:
def application do
  [applications: [:cbr_elixir]]
end
  1. Get daily data (for today's date):
iex(1)> CbrElixir.daily
  %CbrElixir.Models.ValuteCurses{valcurs: [%CbrElixir.Models.Valute{charcode: "AUD",
     id: "R01010", name: "Австралийский доллар", nominal: 1,
     numcode: "036", value: "45,8701"},
    %CbrElixir.Models.Valute{charcode: "AZN", id: "R01020A",
     name: "Азербайджанский манат", nominal: 1,
     numcode: "944", value: "35,4713"},
    %CbrElixir.Models.Valute{charcode: "GBP", id: "R01035",
     name: "Фунт стерлингов Соединенного королевства",
     nominal: 1, numcode: "826", value: "78,2273"}
  1. Get data for specific date:
iex(1)> CbrElixir.daily("03.08.2014")
  %CbrElixir.Models.ValuteCurses{valcurs: [%CbrElixir.Models.Valute{charcode: "AUD",
     id: "R01010", name: "Австралийский доллар", nominal: 1,
     numcode: "036", value: "43,9016"},
    %CbrElixir.Models.Valute{charcode: "AZN", id: "R01020A",
     name: "Азербайджанский манат", nominal: 1,
     numcode: "944", value: "57,4120"},
    %CbrElixir.Models.Valute{charcode: "GBP", id: "R01035",
     name: "Фунт стерлингов Соединенного королевства",
     nominal: 1, numcode: "826", value: "93,9403"}
  1. Get currencies catalog :
iex(1)> CbrElixir.valute_catalog
  %CbrElixir.Models.Valutes{items: [%CbrElixir.Models.Item{engname: "Moldova Lei",
     id: "R01500", name: "Молдавский лей", nominal: 10,
     parentcode: "R01500"},
    %CbrElixir.Models.Item{engname: "US Dollar", id: "R01235",
     name: "Доллар США", nominal: 1, parentcode: "R01235"},
    %CbrElixir.Models.Item{engname: "S.African Rand", id: "R01810",
     name: "Южноафриканский рэнд", nominal: 10,
     parentcode: "R01810"}
  1. Get specific currency rate by charcode:
iex(4)> CbrElixir.daily_by_code(:EUR, '31-12-2001')
  %CbrElixir.Models.Valute{charcode: "EUR", id: "R01239", name: "Евро",
   nominal: 1, numcode: "978", value: "26,4900"}

TODO

- Add more API wrappers

License

Copyright © 2017 Marat Galiev <kazanlug@gmail.com>

This work is free. You can redistribute it and/or modify it under the
terms of the MIT License. See the LICENSE file for more details.

About

Central Bank of the Russian Federation API Elixir wrapper

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.