Class: StockMarkit::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/stock-markit/element.rb

Overview

Stock Chart Element Object

Copyright

Copyright © 2016 Michael Heijmans

License

MIT

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, type, params = nil) ⇒ Element



19
20
21
22
23
# 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

Instance Attribute Details

#paramsString (readonly)

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.



13
14
15
# File 'lib/stock-markit/element.rb', line 13

def params
  @params
end

#symbolString (readonly)

The Stock Symbol



13
14
15
# File 'lib/stock-markit/element.rb', line 13

def symbol
  @symbol
end

#typeString (readonly)

The type of element. Must be one of :price, :volume, or :sma



13
14
15
# File 'lib/stock-markit/element.rb', line 13

def type
  @type
end