Class: StockMarkit::Element
- Inherits:
-
Object
- Object
- StockMarkit::Element
- Defined in:
- lib/stock-markit/element.rb
Overview
Stock Chart Element Object
- Copyright
-
Copyright © 2016 Michael Heijmans
- License
-
MIT
Instance Attribute Summary collapse
-
#params ⇒ String
readonly
Params vary for each Type.
-
#symbol ⇒ String
readonly
The Stock Symbol.
-
#type ⇒ String
readonly
The type of element.
Instance Method Summary collapse
-
#initialize(symbol, type, params = nil) ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(symbol, type, params = nil) ⇒ Element
Returns a new instance of 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
#params ⇒ String (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 |
#symbol ⇒ String (readonly)
The Stock Symbol
13 14 15 |
# File 'lib/stock-markit/element.rb', line 13 def symbol @symbol end |
#type ⇒ String (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 |