I am able to get stock prices from yahoo finance API with the following code. I can get US stocks, EFT, and even international quotes, but unable to get PUTS or CALLS. Any idea what technique I need to get these values?
try:<br/>
TD.TO, GDX, C, C140322C00018000<br/><br/>
<input type="text" id="symbol" />
<button type="submit" onClick="getYahooFinanceData();">Get Data</button>
<div id='result'></div>
<script src="jquery.js"></script>
<script>
function getYahooFinanceData() {
var url = 'http://query.yahooapis.com/v1/public/yql';
var symbol = $("#symbol").val();
//var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('" + 'C140322C00018000' + "')");
var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('" + symbol + "')");
$.getJSON(url, 'q=' + data + "&format=json&diagnostics=true&env=http://datatables.org/alltables.env")
.done(function (data) {
$('#result').append(data.query.results.quote.Name + "..." + data.query.results.quote.LastTradePriceOnly + "<br/>");
})
.fail(function (jqxhr, textStatus, error) {
var err = textStatus + ", " + error;
console.log('Request failed: ' + err);
});
}
</script>
thanks itp