Class: Tradier::WatchlistItem

Inherits:
Base
  • Object
show all
Defined in:
lib/tradier/watchlist_item.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #attr_equal, attr_reader, #attrs, #attrs_equal, #initialize, #update

Constructor Details

This class inherits a constructor from Tradier::Base

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/tradier/watchlist_item.rb', line 5

def id
  @id
end

#purchase_priceObject (readonly)

Returns the value of attribute purchase_price.



5
6
7
# File 'lib/tradier/watchlist_item.rb', line 5

def purchase_price
  @purchase_price
end

#sharesObject (readonly)

Returns the value of attribute shares.



5
6
7
# File 'lib/tradier/watchlist_item.rb', line 5

def shares
  @shares
end

#symbolObject (readonly)

Returns the value of attribute symbol.



5
6
7
# File 'lib/tradier/watchlist_item.rb', line 5

def symbol
  @symbol
end

Class Method Details

.from_response(body = {}) ⇒ Object



7
8
9
# File 'lib/tradier/watchlist_item.rb', line 7

def self.from_response(body={})
  new(body[:item])
end

Instance Method Details

#purchase_dateObject



11
12
13
14
15
# File 'lib/tradier/watchlist_item.rb', line 11

def purchase_date
  return unless @purchase_date || @attrs[:purchase_date]

  @purchase_date ||= Date.parse(@attrs[:purchase_date])
end