mysql - Yahoo-Finance Query Speed -


i'm working on project involves querying yahoo-finance many different ticker symbols. bottleneck acquiring data yahoo, wondering if there way might go speeding up.

if used multiple machines query , aggregated data, help? have 1 physical machine; how might go doing that?

thanks!

edit: currently, i'm using node.js, yahoo-finance, , q.deferred ask yahoo historical data. then, once promises fulfilled (for each ticker), i'm doing q.all() persist data.

    var data = [];     tickers = ["goog", "aapl", ...];     ...     q.all(_.map(tickers, function(symbol) {          return getyahoopromise(symbol);      }))     .done( function() { persistdata(data) }); 

getyahoopromise retrieves data ticker symbol , pushes data array. once promises resolved, data persisted in mysql database.

second edit: more code:

var sequentialcalls = [];  ( var = 0; < tickers.length / chunksize; i++ ) {     sequentialcalls.push( persistyahoochunk ); } sequentialcalls.push( function(callback) {      connection.end();      callback(); });  async.series( sequentialcalls )    exports.persistyahoochunk = function(callback) { console.log("starting yahoo query"); var currenttickers = tickers.slice(currenttickerindex,currenttickerindex + chunksize);   return yahoofinance.historical( {     symbols: currenttickers,     from: "2015-01-28",     to: "2015-02-05" }).then( function(result) {     console.log("query " + currenttickerindex +  "/" + tickers.length + "completed");     currenttickerindex += chunksize;     //add valid data     var topersist = _.map(result, function(quotes, symbol) {             return [symbol, quotes.length != 0 ];     });       var query = "insert `ticker` (`symbol`, `valid`) values ?";     connection.query(query, [topersist], function(err, result) {         if (err) {             console.log (err);         }         //console.log(result);          callback();     }); }); 

}

the bottleneck because doing 1 query per ticker.

depending on data need pull, if single query includes tickers faster.

here example if need current prices list of tickers, single query :

http://finance.yahoo.com/webservice/v1/symbols/a,b,c,d,e/quote?format=json


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -