-2

I'm interested in the OHLC / VWAP data (both historical and recent) provided via API to be used by external charting application.
I don't want to use trades methods as whole process should be as lightweight as possible, trades method is redundant due to history loading speed.
Combining bitcoincharts.com csv historical trades with markets API recent trades would be kind of error prone.

Another option would be to access the following data:

  1. visit bitcoincharts chart: http://bitcoincharts.com/charts/krakenEUR
  2. below the chart in the left corner click on Load raw data
  3. and just download those data

I've checked the page and data appears in tbody in the following div after click on Load raw data:

<div>
  <a href="#" onclick="load_table();return false;">Load raw data</a>
  <table class="data" id="chart_table" style="display: none;">
    <thead>
      <tr>
        <th>Timestamp</th><th>Open</th><th>High</th><th>Low</th><th>Close</th><th>Volume (BTC)</th><th>Volume (Currency)</th><th>Weighted Price</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
  </table>
</div>

Is there any easy way to access those data similarly to API?

Another way is to ask markets for such method, kraken already provide such: https://api.kraken.com/0/public/OHLC?pair=XBTCZEUR&interval=60&since=1416160800
I've just asked for such method on hitbtc market, you can track/contribute here: https://github.com/hitbtc-com/hitbtc-api/issues/7

2
+25

It may be possible to retrieve raw OHLC and VWAP data from bitcoincharts.com in a not-too-difficult manner using JavaScript (as well as jQuery) by extracting the relevant tabular data provided at http://bitcoincharts.com/charts/krakenEUR#rg60ztgSzm1g10zm2g25zv and passing it to an external charting application.

Unfortunately, extracting HTML data from an external website using JavaScript can sometimes be a complicated process, due to the presence of content security and same origin policies (these issues apply particularly to Google Chrome).

The following question on StackOverflow explores an easy way to retrieve external HTML using jQuery and AJAX (https://stackoverflow.com/questions/15005500/loading-cross-domain-html-page-with-jquery-ajax). A simple solution using the aforementioned method could be similar to the following:

$.ajaxSetup({
    scriptCharset: "utf-8", //maybe "ISO-8859-1"
    contentType: "application/json; charset=utf-8"
});

$.getJSON('http://whateverorigin.org/get?url=' + 
  encodeURIComponent('http://bitcoincharts.com/charts/krakenEUR#rg60ztgSzm1g10zm2g25zv') + '&callback=?',
    function(data) {
        console.log("> ", data);
        $("#chart_table" tbody tr).find("td").html(data.contents);
});

Essentially, this method of extracting data from an API or website would depend on what language you are using, and whether you are implementing a back-end. Perhaps placing a similar question on StackOverflow, a site dedicated to programming questions would return better suited results.

Edit: More information regarding bypassing same origin policies can be found at Christian Heilmann's blog, a developer evangelist with the Mozilla Network. Information regarding utilising GET and POST requests can be found at Doncho Minkov's SlideShare, however, this may not be the most effective way to access data when restricted by same origin policies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.