Class: Tradier::WatchlistItem
- Defined in:
- lib/tradier/watchlist_item.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#purchase_price ⇒ Object
readonly
Returns the value of attribute purchase_price.
-
#shares ⇒ Object
readonly
Returns the value of attribute shares.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
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
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/tradier/watchlist_item.rb', line 5 def id @id end |
#purchase_price ⇒ Object (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 |
#shares ⇒ Object (readonly)
Returns the value of attribute shares.
5 6 7 |
# File 'lib/tradier/watchlist_item.rb', line 5 def shares @shares end |
#symbol ⇒ Object (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_date ⇒ Object
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 |