Class: Excoin::Market::Exchange::CandlestickChart::DataPoint
- Inherits:
-
Object
- Object
- Excoin::Market::Exchange::CandlestickChart::DataPoint
- Defined in:
- lib/exchange/candlestick_data.rb
Instance Attribute Summary collapse
-
#close ⇒ Object
readonly
Returns the value of attribute close.
-
#commodity_volume ⇒ Object
readonly
Returns the value of attribute commodity_volume.
-
#currency_volume ⇒ Object
readonly
Returns the value of attribute currency_volume.
-
#high ⇒ Object
readonly
Returns the value of attribute high.
-
#low ⇒ Object
readonly
Returns the value of attribute low.
-
#open ⇒ Object
readonly
Returns the value of attribute open.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(exchange_data) ⇒ DataPoint
constructor
A new instance of DataPoint.
Constructor Details
#initialize(exchange_data) ⇒ DataPoint
Returns a new instance of DataPoint.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/exchange/candlestick_data.rb', line 5 def initialize(exchange_data) begin @timestamp = Time.parse(exchange_data['timestamp']) @open = BigDecimal.new(exchange_data['open']) @close = BigDecimal.new(exchange_data['close']) @high = BigDecimal.new(exchange_data['high']) @low = BigDecimal.new(exchange_data['low']) @commodity_volume = BigDecimal.new(exchange_data['commodity_volume']) @currency_volume = BigDecimal.new(exchange_data['currency_volume']) rescue puts "Error in Excoin::Market::Exchange::CandlestickChart::Datapoint" puts exchange_data end end |
Instance Attribute Details
#close ⇒ Object (readonly)
Returns the value of attribute close.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def close @close end |
#commodity_volume ⇒ Object (readonly)
Returns the value of attribute commodity_volume.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def commodity_volume @commodity_volume end |
#currency_volume ⇒ Object (readonly)
Returns the value of attribute currency_volume.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def currency_volume @currency_volume end |
#high ⇒ Object (readonly)
Returns the value of attribute high.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def high @high end |
#low ⇒ Object (readonly)
Returns the value of attribute low.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def low @low end |
#open ⇒ Object (readonly)
Returns the value of attribute open.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def open @open end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
2 3 4 |
# File 'lib/exchange/candlestick_data.rb', line 2 def @timestamp end |