Skip to content

Instantly share code, notes, and snippets.

@molcik
Last active December 20, 2021 12:36
Show Gist options
  • Save molcik/f26d31fe390a231690defa034cc83535 to your computer and use it in GitHub Desktop.
Save molcik/f26d31fe390a231690defa034cc83535 to your computer and use it in GitHub Desktop.
var Api = function() {
var url = 'https://query.yahooapis.com/v1/public/yql';
var query = 'env "store://datatables.org/alltableswithkeys"; select * from yahoo.finance.historicaldata where symbol = "AAPL" and startDate = "2016-01-01" and endDate = "2017-01-01"';
var def = new $.Deferred();
this.getData = function() {
$.ajax({
'url': url,
'data': {
'q': query,
'format': 'json',
'jsonCompat': 'new',
},
'dataType': 'jsonp',
'success': function(response) {
def.resolve(response);
},
});
return def.promise();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment