javascript - Yahoo finance query api, want to limit to one country search result (Ionic cordova) -
as search stock ticker in yahoo search, there search suggestion. example, when type 'tpm' in search, want australia stocks tpm.ax or other australia stocks appear in stocks suggestion. not want show other exchanges stocks tickers.
cachekey = ticker, stockdetailscache = stockdetailscacheservice.get(cachekey), query = 'select * yahoo.finance.quotes symbol in ("' + ticker + '")', url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeuriservice.encode(query) + '.ax&format=json&env=http://datatables.org/alltables.env'; if(stockdetailscache) { deferred.resolve(stockdetailscache); } else { $http.get(url) .success(function(json) { var jsondata = json.query.results.quote; deferred.resolve(jsondata); stockdetailscacheservice.put(cachekey, jsondata); }) .error(function(error) { console.log("details data error: " + error); deferred.reject(); }); } return deferred.promise; }; var getpricedata = function(ticker) { var deferred = $q.defer(), cachekey = ticker, url = "http://finance.yahoo.com/webservice/v1/symbols/" + ticker + ".ax/quote?format=json&view=detail"; $http.get(url) .success(function(json) { var jsondata = json.list.resources[0].resource.fields; stockpricecacheservice.put(cachekey, jsondata); deferred.resolve(jsondata); })
i have put .ax in url still unable shows australia stocks app written in ionic 2. currently, stocks exchanges still shown. how make show australia stocks in search suggestion?
query = 'select * yahoo.finance.quotes symbol in ("' + ticker + '")', url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeuriservice.encode(query) + '+'.ax'+&format=json&env=http://datatables.org/alltables.env';
use +'ax'
Comments
Post a Comment