Quandlex 0.1 released: Quandle API client for Elixir/Erlang
I'm releasing Quandlex, a new Elixir/Erlang library for Quandl API. Quandl provides unified access to multiple sources for financial, economic, and alternative datasets .
Links
Installation
The package can be installed by adding quandlex
to your list of dependencies in mix.exs
:
def deps do
[
{:quandlex, "~> 0.1.0"}
]
end
Quandlex.Timeseries
Quandlex.Timeseries includes several functions that match API endpoints:
get_data
: returns both data and dataset metadataget_dataset_metadata
: returns only dataset metadataget_database_metadata
: returns database metadata
iex> {:ok, %{data: data, type: type}} = Quandlex.Timeseries.get_data("CHRIS", "MGEX_IH1")
iex> is_list(hd(data)) and is_list(data) and type == "Time Series"
true
iex> {:ok, %{name: name, id: id}} = Quandlex.Timeseries.get_database_metadata("CHRIS")
iex> name == "Wiki Continuous Futures" and id == 596
true
Response example
{:ok,
%{
collapse: nil,
column_index: nil,
column_names: ["Date", "Open", "High", "Low", "Last", "Volume",
"Open Interest"],
data: [
[~D[2019-04-30], nil, 486.0, 486.0, 486.0, 0.0, 0.0],
[~D[2018-04-30], nil, 486.0, 486.0, 486.0, 0.0, 0.0],
[~D[2018-04-27], nil, 474.0, 474.0, 474.0, 0.0, 0.0],
[...],
...
],
database_code: "CHRIS",
database_id: 596,
dataset_code: "MGEX_IH1",
description: "Historical Futures Prices: Minneapolis HRWI Hard Red Wheat Futures, Continuous Contract #1. Non-adjusted price based on spot-month continuous contract calculations. Raw data from MGEX.",
end_date: "2019-04-30",
frequency: "daily",
id: 9774107,
limit: nil,
name: "Minneapolis HRWI Hard Red Wheat Futures, Continuous Contract #1 (IH1) (Front Month)",
newest_available_date: "2019-04-30",
oldest_available_date: "2005-01-03",
order: nil,
premium: false,
refreshed_at: "2018-05-08T18:27:06.846Z",
start_date: "2005-01-03",
transform: nil,
type: "Time Series"
}}
Quandlex.Forex
Quandlex.Forex is a utility module that makes fetching historical data of foreign exchange rates simpler and easier.
Quandl provides free (albeit limited for non-registered users) data of forex rates sourced from Bank of England, Federal Reserve and European Central Bank.
You can use get_rates/2 or get_rates/3 function without wasting time on searching for special currency codes for every bank database.
For example, instead of using Quandlex.Timeseries.get_data("BOE", "XUDLJYD")
you can call Quandlex.Forex.get_rates("USD", "JPY", source: "BOE")
Examples
iex> {:ok, %{data: data, type: type, database_code: database_code}} = Quandlex.Forex.get_rates("HKD", "USD")
iex> database_code === "FRED" and is_list(data) and type == "Time Series"
true
iex> {:ok, %{data: data, type: type, database_code: database_code}} = Quandlex.Forex.get_rates("HKD", "USD", source: "BOE")
iex> database_code === "BOE" and is_list(data) and type == "Time Series"
true
iex> {:ok, %{data: data, type: type, database_code: database_code}} = Quandlex.Forex.get_rates("THB", "EUR", source: "ECB")
iex> database_code === "ECB" and is_list(data) and type == "Time Series"
true
Response example
{:ok,
%{
collapse: nil,
column_index: nil,
column_names: ["Date", "Value"],
data: [
[~D[2018-05-18], 7.8498],
[~D[2018-05-17], 7.8496],
[~D[2018-05-16], 7.8499],
[...],
...
],
database_code: "FRED",
database_id: 118,
dataset_code: "DEXHKUS",
description: "Hong Kong Dollars to One U.S. Dollar Not Seasonally Adjusted, Noon buying rates in New York City for cable transfers payable in foreign currencies. ",
end_date: "2018-05-18",
frequency: "daily",
id: 121063,
limit: nil,
name: "Hong Kong / U.S. Foreign Exchange Rate",
newest_available_date: "2018-05-18",
oldest_available_date: "1981-01-02",
order: nil,
premium: false,
refreshed_at: "2018-05-27T03:10:46.002Z",
start_date: "1981-01-02",
transform: nil,
type: "Time Series"
}}
"""
Roadmap
- [ ] Add datatables module
- [ ] Add structs for return values
- [ ] Investigate developer experience improvements using rate limiting utilities and caching
Thank you for your contribution.
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Hey @ontofractal
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!