Class: BudaApi::Models::Trade

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

Overview

Trade model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#raw, #to_h, #to_json

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)
  @timestamp = 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

#amountObject (readonly)

Returns the value of attribute amount.



161
162
163
# File 'lib/buda_api/models.rb', line 161

def amount
  @amount
end

#directionObject (readonly)

Returns the value of attribute direction.



161
162
163
# File 'lib/buda_api/models.rb', line 161

def direction
  @direction
end

#market_idObject (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

#priceObject (readonly)

Returns the value of attribute price.



161
162
163
# File 'lib/buda_api/models.rb', line 161

def price
  @price
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



161
162
163
# File 'lib/buda_api/models.rb', line 161

def timestamp
  @timestamp
end