class MarkIt::Quote

To use, initialize with MarkIt::Quote.new(ticker) where ticker is a string of the company's trading symbol e.g. aapl = MarkIt::Quote.new(“AAPL”)

Attributes

info[RW]
ticker[RW]

Public Class Methods

new(ticker) click to toggle source
# File lib/markit.rb, line 30
def initialize(ticker) #ticker is a string of the company's trading symbol
        self.ticker = ticker
        self.info = self.class.get("symbol=#{ticker}") #GET method
        if self.info["Error"]
                self.info = "Error. Please enter a new ticker."
        end
end

Public Instance Methods

change_ytd() click to toggle source
# File lib/markit.rb, line 46
def change_ytd
        (last_price.to_f - info["QuoteApiModel"]["Data"]["ChangeYTD"].to_f).to_s
end