require 'stock_quote' //in app.rb
gem "stock_quote", '~> 2.0.0' //in GemFiles
bundle install //in command line
// please don't copy paste in the same file, they need to be pasted
// at different locations.
//here is a list of the executable commands
stock = StockQuote::Stock.quote("symbol") //returns stock quote
// in if statements:
return stock.latest_price //for latest price of stock
stock = StockQuote::Stock.logo("symbol") //returns logo
// in if statements:
return logo.url //for company logo
stock = StockQuote::Stock.dividend("symbol") //returns dividends
// in if statements:
return stock.dividend //for dividend value
stocks = StockQuote::Stock.quote("symbol1,symbol2") //search for multiple stocks
//by separating symbols with a comma (or array)
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .