class StockMarkit::Element

Stock Chart Element Object

@attr_reader [String] symbol The Stock Symbol @attr_reader [String] type The type of element. Must be one of :price, :volume, or :sma @attr_reader [String] params Params vary for each Type. The following Types accept Params. For the other types, Params should be null or an empty array. “sma”: [period], “price”: [“ohlc”] for open/high/low/close, [“c”] for close only.

@author Michael Heijmans (parabuzzle@gmail.com)

Copyright

Copyright © 2016 Michael Heijmans

License

MIT

Attributes

params[R]
symbol[R]
type[R]

Public Class Methods

new(symbol, type, params=nil) click to toggle source

@param [String] symbol The stock's ticker symbol @param [Symbol] type The type of element. Must be one of :price, :volume, or :sma @param [Array] params Params vary for each Type. The following Types accept Params. For the other types, Params should be null or an empty array. “sma”: [period], “price”: [“ohlc”] for open/high/low/close, [“c”] for close only.

# File lib/stock-markit/element.rb, line 19
def initialize(symbol, type, params=nil)
  @symbol = symbol.to_s.upcase
  @type   = type.to_s
  @params = params || default_params
end

Private Instance Methods

default_params() click to toggle source
# File lib/stock-markit/element.rb, line 27
def default_params
  case @type
  when "price"
    "c"
  when "sma"
    :week
  end
end