Class: BudaApi::Models::Candlestick
- Defined in:
- lib/buda_api/models.rb
Overview
Candlestick report entry
Instance Attribute Summary collapse
-
#close ⇒ Object
readonly
Returns the value of attribute close.
-
#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.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Instance Method Summary collapse
-
#initialize(data) ⇒ Candlestick
constructor
A new instance of Candlestick.
Methods inherited from BaseModel
Constructor Details
#initialize(data) ⇒ Candlestick
Returns a new instance of Candlestick.
352 353 354 355 356 357 358 359 360 |
# File 'lib/buda_api/models.rb', line 352 def initialize(data) super(data) @timestamp = Time.at(data["timestamp"].to_i) if data["timestamp"] @open = data["open"]&.to_f @close = data["close"]&.to_f @high = data["high"]&.to_f @low = data["low"]&.to_f @volume = data["volume"]&.to_f end |
Instance Attribute Details
#close ⇒ Object (readonly)
Returns the value of attribute close.
362 363 364 |
# File 'lib/buda_api/models.rb', line 362 def close @close end |
#high ⇒ Object (readonly)
Returns the value of attribute high.
362 363 364 |
# File 'lib/buda_api/models.rb', line 362 def high @high end |
#low ⇒ Object (readonly)
Returns the value of attribute low.
362 363 364 |
# File 'lib/buda_api/models.rb', line 362 def low @low end |
#open ⇒ Object (readonly)
Returns the value of attribute open.
362 363 364 |
# File 'lib/buda_api/models.rb', line 362 def open @open end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
362 363 364 |
# File 'lib/buda_api/models.rb', line 362 def @timestamp end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
362 363 364 |
# File 'lib/buda_api/models.rb', line 362 def volume @volume end |