Class: BudaApi::Models::Ticker

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

Overview

Ticker model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#raw, #to_h, #to_json

Constructor Details

#initialize(data) ⇒ Ticker

Returns a new instance of Ticker.



85
86
87
88
89
90
91
92
93
# File 'lib/buda_api/models.rb', line 85

def initialize(data)
  super(data)
  @last_price = parse_amount(data["last_price"])
  @min_ask = parse_amount(data["min_ask"])
  @max_bid = parse_amount(data["max_bid"])
  @volume = parse_amount(data["volume"])
  @price_variation_24h = data["price_variation_24h"]&.to_f
  @price_variation_7d = data["price_variation_7d"]&.to_f
end

Instance Attribute Details

#last_price ⇒ Object (readonly)

Returns the value of attribute last_price.



95
96
97
# File 'lib/buda_api/models.rb', line 95

def last_price
  @last_price
end

#max_bid ⇒ Object (readonly)

Returns the value of attribute max_bid.



95
96
97
# File 'lib/buda_api/models.rb', line 95

def max_bid
  @max_bid
end

#min_ask ⇒ Object (readonly)

Returns the value of attribute min_ask.



95
96
97
# File 'lib/buda_api/models.rb', line 95

def min_ask
  @min_ask
end

#price_variation_24h ⇒ Object (readonly)

Returns the value of attribute price_variation_24h.



95
96
97
# File 'lib/buda_api/models.rb', line 95

def price_variation_24h
  @price_variation_24h
end

#price_variation_7d ⇒ Object (readonly)

Returns the value of attribute price_variation_7d.



95
96
97
# File 'lib/buda_api/models.rb', line 95

def price_variation_7d
  @price_variation_7d
end

#volume ⇒ Object (readonly)

Returns the value of attribute volume.



95
96
97
# File 'lib/buda_api/models.rb', line 95

def volume
  @volume
end