class Finviz::Quote

Single quote representation

Attributes

stats[R]
ticker[R]

Public Class Methods

new(ticker:, stats: nil) click to toggle source
# File lib/finviz/quote.rb, line 10
def initialize(ticker:, stats: nil)
  @ticker = ticker
  @stats = ActiveSupport::HashWithIndifferentAccess.new(stats.to_h)
end

Public Instance Methods

chart() click to toggle source
# File lib/finviz/quote.rb, line 19
def chart
  "https://charts2.finviz.com/chart.ashx?t=#{ticker}&ty=c&ta=1&p=d&s=l"
end
path() click to toggle source
# File lib/finviz/quote.rb, line 15
def path
  "https://finviz.com/quote.ashx?t=#{ticker}"
end
to_h() click to toggle source

grab all instance methods to the hash

# File lib/finviz/quote.rb, line 24
def to_h
  (self.class.instance_methods(false) - [__callee__]).each_with_object({}) do |method, acc|
    acc[method] = public_send method
  end
end