node.js从雅虎或谷歌流式传输金融数据
更新:我想连续接收数据。目前,它返回一个数据集。我认为唯一的替代方法是轮询/设置间隔技术,它只能实现流式传输的效果node.js从雅虎或谷歌流式传输金融数据,node.js,streaming,finance,express,Node.js,Streaming,Finance,Express,更新:我想连续接收数据。目前,它返回一个数据集。我认为唯一的替代方法是轮询/设置间隔技术,它只能实现流式传输的效果 var express = require('express'), http = require('http'), app = express.createServer(); // Using either Google or Yahoo... var client = http.createClient(80,'downlo
var express = require('express'),
http = require('http'),
app = express.createServer();
// Using either Google or Yahoo...
var client = http.createClient(80,'download.finance.yahoo.com');
var request = client.request('GET', '/d/quotes.csv?s=GOOG&f=snr', { host: 'download.finance.yahoo.com' });
//var client = http.createClient(80,'www.google.com');
//var request = client.request('GET', '/finance/info?client=ig&q=CSCO', { host: 'www.google.com'});
request.end();
request.addListener('response', function (response) {
response.setEncoding(encoding="utf8");
response.addListener('data', function (data) {
console.log(data);
});
response.addListener('end',function(data) {
console.log('End');
});
});
app.listen(8080);
是否可以使用node.js从雅虎或谷歌检索流媒体金融数据?我知道他们没有可用于我试图检索的数据的公共API 我用express写了这篇文章,但是数据不是流式的
var express = require('express'),
http = require('http'),
app = express.createServer();
// Using either Google or Yahoo...
var client = http.createClient(80,'download.finance.yahoo.com');
var request = client.request('GET', '/d/quotes.csv?s=GOOG&f=snr', { host: 'download.finance.yahoo.com' });
//var client = http.createClient(80,'www.google.com');
//var request = client.request('GET', '/finance/info?client=ig&q=CSCO', { host: 'www.google.com'});
request.end();
request.addListener('response', function (response) {
response.setEncoding(encoding="utf8");
response.addListener('data', function (data) {
console.log(data);
});
response.addListener('end',function(data) {
console.log('End');
});
});
app.listen(8080);
这应该行得通。你真正的问题是什么?戴夫,答案就是答案。只要编辑你的问题,如果你有一个更新,更正或什么。这应该工作。你真正的问题是什么?戴夫,答案就是答案。如果您有更新、更正或其他信息,请编辑您的问题。