Class: StockMarkit::ChartResult
- Inherits:
-
Object
- Object
- StockMarkit::ChartResult
- Defined in:
- lib/stock-markit/chart_result.rb
Overview
Stock Chart Result Object
- Copyright
-
Copyright © 2016 Michael Heijmans
- License
-
MIT
Instance Method Summary collapse
-
#dates ⇒ Array
Timestamps corresponding to each position in UTC.
-
#elements ⇒ Array
Requested element data.
-
#initialize(json) ⇒ ChartResult
constructor
A new instance of ChartResult.
-
#labels ⇒ Hash
X Axis label position, text, and dates.
-
#positions ⇒ Array
List of X coordinate positions for each data point returned, between 0 and 1.
Constructor Details
#initialize(json) ⇒ ChartResult
Returns a new instance of ChartResult.
14 15 16 |
# File 'lib/stock-markit/chart_result.rb', line 14 def initialize(json) @json = json end |
Instance Method Details
#dates ⇒ Array
Returns Timestamps corresponding to each position in UTC.
29 30 31 |
# File 'lib/stock-markit/chart_result.rb', line 29 def dates @json["Dates"].map { |date| parse_date(date) } end |
#elements ⇒ Array
Returns requested element data.
34 35 36 |
# File 'lib/stock-markit/chart_result.rb', line 34 def elements @json["Elements"] end |
#labels ⇒ Hash
Returns X Axis label position, text, and dates. The “dates” are in Microsoft “OA Date” format. The “text” is an ISO timestamp.
19 20 21 |
# File 'lib/stock-markit/chart_result.rb', line 19 def labels @json["Labels"] end |
#positions ⇒ Array
Returns List of X coordinate positions for each data point returned, between 0 and 1.
24 25 26 |
# File 'lib/stock-markit/chart_result.rb', line 24 def positions @json["Positions"] end |