1
Help for ParamQuery Grid (free version) / Finance data
« on: January 19, 2015, 08:25:12 pm »
Good day! Is it possible to dynamically add data to the table from Yhoo!Finance:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20=%20%22BAC%22&format=json&diagnostics=true&env=http://datatables.org/alltables.env
I need to create a list of companies with market data.
Did not succeed.
Here is some sample code:
<script>
var tickers = ['"c"','"ge"'];
for (var k = 0; k < tickers.length; k++) {
var query = "select * from yahoo.finance.quotes where symbol = " + tickers[k];
var yql = "http://query.yahooapis.com/v1/public/yql?q=" + escape(query) + "&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback=?";
//$("#yql").text(yql);
$.ajax({
url: yql,
dataType: 'json',
success: function(data) {
var keys = _.keys(data.query.results.quote);
//var values = _.values(data.query.results.quote);
for (var x=0; x<keys.length; x++) {
switch (keys
case 'Symbol':
var Symbol = data.query.results.quote[keys
break;
case 'PERatio':
var PERatio = data.query.results.quote[keys
break;
$(document).ready(function(){
$(Symbol).append(Symbol);
});
}
}
$(function () {
var data = [[Symbol, PERatio]];
alert(data[0]);
var obj = { width: 700, height: 400, title: "ParamQuery Grid Example",resizable:true,draggable:true };
obj.colModel = [
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" }];
obj.dataModel = { data: data };
$("#grid_array").pqGrid(obj);
});
$("#info").html(results);
}
});
};
</script>
However, it generates only one row in the table and one element...
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20=%20%22BAC%22&format=json&diagnostics=true&env=http://datatables.org/alltables.env
I need to create a list of companies with market data.
Did not succeed.
Here is some sample code:
<script>
var tickers = ['"c"','"ge"'];
for (var k = 0; k < tickers.length; k++) {
var query = "select * from yahoo.finance.quotes where symbol = " + tickers[k];
var yql = "http://query.yahooapis.com/v1/public/yql?q=" + escape(query) + "&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback=?";
//$("#yql").text(yql);
$.ajax({
url: yql,
dataType: 'json',
success: function(data) {
var keys = _.keys(data.query.results.quote);
//var values = _.values(data.query.results.quote);
for (var x=0; x<keys.length; x++) {
switch (keys
- ) {
case 'Symbol':
var Symbol = data.query.results.quote[keys
- ];
break;
case 'PERatio':
var PERatio = data.query.results.quote[keys
- ];
break;
$(document).ready(function(){
$(Symbol).append(Symbol);
});
}
}
$(function () {
var data = [[Symbol, PERatio]];
alert(data[0]);
var obj = { width: 700, height: 400, title: "ParamQuery Grid Example",resizable:true,draggable:true };
obj.colModel = [
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 100, dataType: "string" }];
obj.dataModel = { data: data };
$("#grid_array").pqGrid(obj);
});
$("#info").html(results);
}
});
};
</script>
However, it generates only one row in the table and one element...