Class: BudaApi::Models::Trade
- Defined in:
- lib/buda_api/models.rb
Overview
Trade model
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#market_id ⇒ Object
readonly
Returns the value of attribute market_id.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(data) ⇒ Trade
constructor
A new instance of Trade.
Methods inherited from BaseModel
Constructor Details
#initialize(data) ⇒ Trade
Returns a new instance of Trade.
152 153 154 155 156 157 158 159 |
# File 'lib/buda_api/models.rb', line 152 def initialize(data) super(data) = parse_datetime(data["timestamp"]) || Time.at(data["timestamp"].to_i) if data["timestamp"] @direction = data["direction"] @price = parse_amount(data["price"]) @amount = parse_amount(data["amount"]) @market_id = data["market_id"] end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
161 162 163 |
# File 'lib/buda_api/models.rb', line 161 def amount @amount end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
161 162 163 |
# File 'lib/buda_api/models.rb', line 161 def direction @direction end |
#market_id ⇒ Object (readonly)
Returns the value of attribute market_id.
161 162 163 |
# File 'lib/buda_api/models.rb', line 161 def market_id @market_id end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
161 162 163 |
# File 'lib/buda_api/models.rb', line 161 def price @price end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
161 162 163 |
# File 'lib/buda_api/models.rb', line 161 def end |