Coherent Data Adapter: Quandl Client Edition

Bitbucket

WIKI/FB BCHARTS/BITFINEXUSD
A rendering of WIKI FB daily open prices from 2010-11-14 to 2018-06-13. An example of the Coherent Data Adapter: Quandl Client Edition for BCHARTS / BITFINEXUSD daily Bitcoin exchange rate (BTC vs USD) on Bitfinex compared with the equivalent Quandl chart.

The Problem

Your business needs to acquire either the free or subscription-only data provided by Quandl, for use in your business’ data platform. As Quandl offers access to the raw data via a suite of web services, your company needs to call these web services and import the data directly into the business. This process needs to be automated since you do not want your people spending any time working with CSV files, or doing anything manually.

The Solution

Coherent Logic offers open-source The Coherent Data Adapter: Quandl Client Edition middleware for accessing data directly from the Quandl RESTful web services.

The Coherent Data Adapter: Quandl Client Edition middleware is designed with the engineer in mind. Full-scope access to the suite of Quandl web service endpoints for table, metadata, and time series are available out-of-the-box.

The Coherent Data Adapter: Quandl Client Edition leverages the Coherent Logic Enterprise Data Adapter, delivering a common set of dependencies for developing enterprise, standalone, and embedded applications, a common data adapter and data model, an out-of-the-box cache-agnostic interface along with a default implementation for the JBoss Infinispan shared-memory data grid, and much more.

Examples

The Coherent Data Adapter: Quandl Client Edition middleware is slightly different than the other adapters we offer due to the potential for the developer to specify any number of columns in a request; note also that the rows available may differ depending on which data is requested. It is for these reasons that we do not provide a completed data model and instead deliver an API so that the developer can easily convert the resultant data into the data model of their choosing — see the following examples below.

class Result {

  private Date date;

  private BigDecimal open;

  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public BigDecimal getOpen() {
    return open;
  }

  public void setOpen(BigDecimal open) {
    this.open = open;
  }
}

@Test
public void testWIKIFB() {

  QueryBuilder queryBuilder = context.getBean(QueryBuilder.class);

  QuandlResponse quandlResponse = queryBuilder
    .datasets("WIKI", "FB")
    .data()
    .withCollapseAsMonthly()
    .withLimit(0)
    .withColumnIndex(1)
    .withStartDate("2010-01-01")
    .withEndDate("2017-01-01")
    .withApiKey(apiKey)
    .doGetAsQuandlResponse ();

    final List results = new ArrayList ();

    quandlResponse.getDatasetData()
      .getData()
      .forEachRow(
        row -> {

          Result nextResult = new Result ();

          nextResult.setDate(
            row.getColumnAsDate("Date")
          );

          nextResult.setOpen(
            row.getColumnAsBigDecimal("Open")
          );

          results.add(nextResult);
        }
    );
}

See Also