Class: BudaApi::Models::Candlestick

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/buda_api/models.rb

Overview

Candlestick report entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#raw, #to_h, #to_json

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
  @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