Stock Quote & Chart Dashing Dashboard consists of two widgets. While one displays a stock's current quote and other details; another displays its last 30-days closing stock prices.
Add the gem to your dashing gemfile:
gem 'json'
and run bundle install
.
First, copy stock.coffee
, stock.html
, and stock.sass
into the /widgets/stock
directory and chart.coffee
, chart.html
, and chart.sass
into the /widgets/chart
directory. Put the yahoo_stock_quote.rb
and yahoo_stock_quote.rb
files in the /jobs
folder.
To use the widget, put the following codes into one of the /dashboards
directory's .erb
file:
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="yahoo_stock_quote" data-view="Stock" data-prefix="$"></div>
</li>
<li data-row="1" data-col="1" data-sizex="3" data-sizey="1">
<div data-id="yahoo_stock_chart" data-view="Chart" data-prefix="$"></div>
</li>
There are two jobs running for this dashboard, which are yahoo_stock_quote.rb
and yahoo_stock_chart.rb
. yahoo_stock_quote.rb
selects data from yahoo.finance.quotes
table, and yahoo_stock_chart.rb
retrieves data from yahoo.finance.historicaldata
table. You can change to another stock with the following line within the jobs.
symbol = "YHOO"
for a while now the stock quote is giving 6 decimal places e.g. $50.679999
Is yahoo doing something different or how can I trim this to two places?