使用 meteor package 从 yahoo finance 抓取数据,有些值有效有些无效
Grabbing data from yahoo finance using meteor package, some values work some do not
我正在为 Meteor 使用以下包 https://atmospherejs.com/ajbarry/yahoo-finance
使用 YQL 控制台并搜索 "ENW.V" 符号,我可以取回某些数据,但有些数据不起作用。
这是我的模板。
<template name="stock">
<h2>{{stock.symbol}}</h2>
<ul>
<li><strong>Name</strong> {{stock.name}}</li>
<li><strong>Ask</strong> {{stock.ask}}</li>
<li><strong>Bid</strong> {{stock.bid}}</li>
<li><strong>Average Daily Volume</strong> {{stock.DaysHigh}}</li>
</ul>
</template>
这是我的客户端代码:
Template.stock.rendered = function (){
if ( _.isEmpty(Session.get('ENW.V')) ) {
Meteor.call('getQuote', 'ENW.V', function(err, result) {
Session.set('ENW.V', result['ENW.V']);
});
}
}
这是我的服务器端代码:
Template.stock.helpers({
stock: function() {
return Session.get('ENW.V');
}
})
这是 json 响应的示例,这里是 link 查看它 here。
"quote": {
"symbol": "ENW.V",
"Ask": "1.12",
"AverageDailyVolume": "56995",
"Bid": "1.04",
"AskRealtime": null,
"BidRealtime": null,
"BookValue": "0.14",
"Change_PercentChange": "+0.06 - +5.94%",
"Change": "+0.06",
"Commission": null,
"Currency": "CAD",
"ChangeRealtime": null,
"AfterHoursChangeRealtime": null,
"DividendShare": null,
"LastTradeDate": "5/4/2015",
"TradeDate": null,
"EarningsShare": "-0.05",
"ErrorIndicationreturnedforsymbolchangedinvalid": null,
"EPSEstimateCurrentYear": null,
"EPSEstimateNextYear": null,
"EPSEstimateNextQuarter": "0.00",
"DaysLow": "1.02",
"DaysHigh": "1.10",
"YearLow": "0.99",
"YearHigh": "1.52",
"HoldingsGainPercent": null,
"AnnualizedGain": null,
"HoldingsGain": null,
"HoldingsGainPercentRealtime": null,
"HoldingsGainRealtime": null,
"MoreInfo": null,
"OrderBookRealtime": null,
"MarketCapitalization": "90.39M",
"MarketCapRealtime": null,
"EBITDA": "-2.87M",
"ChangeFromYearLow": "0.08",
"PercentChangeFromYearLow": "+8.08%",
"LastTradeRealtimeWithTime": null,
"ChangePercentRealtime": null,
"ChangeFromYearHigh": "-0.45",
"PercebtChangeFromYearHigh": "-29.61%",
"LastTradeWithTime": "3:29pm - <b>1.07</b>",
"LastTradePriceOnly": "1.07",
"HighLimit": null,
"LowLimit": null,
"DaysRange": "1.02 - 1.10",
"DaysRangeRealtime": null,
"FiftydayMovingAverage": "1.07",
"TwoHundreddayMovingAverage": "1.15",
"ChangeFromTwoHundreddayMovingAverage": "-0.08",
"PercentChangeFromTwoHundreddayMovingAverage": "-6.88%",
"ChangeFromFiftydayMovingAverage": "-0.00",
"PercentChangeFromFiftydayMovingAverage": "-0.44%",
"Name": "ENWAVE CORP",
"Notes": null,
"Open": "1.05",
"PreviousClose": "1.01",
"PricePaid": null,
"ChangeinPercent": "+5.94%",
"PriceSales": "16.11",
"PriceBook": "7.06",
"ExDividendDate": null,
"PERatio": null,
"DividendPayDate": null,
"PERatioRealtime": null,
"PEGRatio": "0.00",
"PriceEPSEstimateCurrentYear": null,
"PriceEPSEstimateNextYear": null,
"Symbol": "ENW.V",
"SharesOwned": null,
"ShortRatio": "1.60",
"LastTradeTime": "3:29pm",
"TickerTrend": null,
"OneyrTargetPrice": null,
"Volume": "60650",
"HoldingsValue": null,
"HoldingsValueRealtime": null,
"YearRange": "0.99 - 1.52",
"DaysValueChange": null,
"DaysValueChangeRealtime": null,
"StockExchange": "VAN",
"DividendYield": null,
"PercentChange": "+5.94%"
}
}
这是无效的库存数据。 {{stock.DaysHigh}}
感谢您的提前帮助。如果需要,很乐意添加任何其他信息。
根据 README 包中的说明,如果您想要的不仅仅是默认值,则需要指定整个字段列表。
这是可用字段列表的 link:
https://github.com/pilwon/node-yahoo-finance/blob/master/lib/fields.js
YahooFinance.snapshot({symbols:['ENW.V'], fields:['s','n','g']})
其中 g
是 DaysHigh 代码。
我正在为 Meteor 使用以下包 https://atmospherejs.com/ajbarry/yahoo-finance 使用 YQL 控制台并搜索 "ENW.V" 符号,我可以取回某些数据,但有些数据不起作用。 这是我的模板。
<template name="stock">
<h2>{{stock.symbol}}</h2>
<ul>
<li><strong>Name</strong> {{stock.name}}</li>
<li><strong>Ask</strong> {{stock.ask}}</li>
<li><strong>Bid</strong> {{stock.bid}}</li>
<li><strong>Average Daily Volume</strong> {{stock.DaysHigh}}</li>
</ul>
</template>
这是我的客户端代码:
Template.stock.rendered = function (){
if ( _.isEmpty(Session.get('ENW.V')) ) {
Meteor.call('getQuote', 'ENW.V', function(err, result) {
Session.set('ENW.V', result['ENW.V']);
});
}
}
这是我的服务器端代码:
Template.stock.helpers({
stock: function() {
return Session.get('ENW.V');
}
})
这是 json 响应的示例,这里是 link 查看它 here。
"quote": {
"symbol": "ENW.V",
"Ask": "1.12",
"AverageDailyVolume": "56995",
"Bid": "1.04",
"AskRealtime": null,
"BidRealtime": null,
"BookValue": "0.14",
"Change_PercentChange": "+0.06 - +5.94%",
"Change": "+0.06",
"Commission": null,
"Currency": "CAD",
"ChangeRealtime": null,
"AfterHoursChangeRealtime": null,
"DividendShare": null,
"LastTradeDate": "5/4/2015",
"TradeDate": null,
"EarningsShare": "-0.05",
"ErrorIndicationreturnedforsymbolchangedinvalid": null,
"EPSEstimateCurrentYear": null,
"EPSEstimateNextYear": null,
"EPSEstimateNextQuarter": "0.00",
"DaysLow": "1.02",
"DaysHigh": "1.10",
"YearLow": "0.99",
"YearHigh": "1.52",
"HoldingsGainPercent": null,
"AnnualizedGain": null,
"HoldingsGain": null,
"HoldingsGainPercentRealtime": null,
"HoldingsGainRealtime": null,
"MoreInfo": null,
"OrderBookRealtime": null,
"MarketCapitalization": "90.39M",
"MarketCapRealtime": null,
"EBITDA": "-2.87M",
"ChangeFromYearLow": "0.08",
"PercentChangeFromYearLow": "+8.08%",
"LastTradeRealtimeWithTime": null,
"ChangePercentRealtime": null,
"ChangeFromYearHigh": "-0.45",
"PercebtChangeFromYearHigh": "-29.61%",
"LastTradeWithTime": "3:29pm - <b>1.07</b>",
"LastTradePriceOnly": "1.07",
"HighLimit": null,
"LowLimit": null,
"DaysRange": "1.02 - 1.10",
"DaysRangeRealtime": null,
"FiftydayMovingAverage": "1.07",
"TwoHundreddayMovingAverage": "1.15",
"ChangeFromTwoHundreddayMovingAverage": "-0.08",
"PercentChangeFromTwoHundreddayMovingAverage": "-6.88%",
"ChangeFromFiftydayMovingAverage": "-0.00",
"PercentChangeFromFiftydayMovingAverage": "-0.44%",
"Name": "ENWAVE CORP",
"Notes": null,
"Open": "1.05",
"PreviousClose": "1.01",
"PricePaid": null,
"ChangeinPercent": "+5.94%",
"PriceSales": "16.11",
"PriceBook": "7.06",
"ExDividendDate": null,
"PERatio": null,
"DividendPayDate": null,
"PERatioRealtime": null,
"PEGRatio": "0.00",
"PriceEPSEstimateCurrentYear": null,
"PriceEPSEstimateNextYear": null,
"Symbol": "ENW.V",
"SharesOwned": null,
"ShortRatio": "1.60",
"LastTradeTime": "3:29pm",
"TickerTrend": null,
"OneyrTargetPrice": null,
"Volume": "60650",
"HoldingsValue": null,
"HoldingsValueRealtime": null,
"YearRange": "0.99 - 1.52",
"DaysValueChange": null,
"DaysValueChangeRealtime": null,
"StockExchange": "VAN",
"DividendYield": null,
"PercentChange": "+5.94%"
}
}
这是无效的库存数据。 {{stock.DaysHigh}}
感谢您的提前帮助。如果需要,很乐意添加任何其他信息。
根据 README 包中的说明,如果您想要的不仅仅是默认值,则需要指定整个字段列表。
这是可用字段列表的 link:
https://github.com/pilwon/node-yahoo-finance/blob/master/lib/fields.js
YahooFinance.snapshot({symbols:['ENW.V'], fields:['s','n','g']})
其中 g
是 DaysHigh 代码。