Class: Scottrade::Position
Instance Attribute Summary collapse
-
#account_type ⇒ Object
readonly
Returns the value of attribute account_type.
-
#cusip ⇒ Object
readonly
Returns the value of attribute cusip.
-
#display_symbol ⇒ Object
readonly
Returns the value of attribute display_symbol.
-
#previous_close_price ⇒ Object
readonly
Returns the value of attribute previous_close_price.
-
#previous_market_close_value ⇒ Object
readonly
Returns the value of attribute previous_market_close_value.
-
#price_change ⇒ Object
readonly
Returns the value of attribute price_change.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#real_time_market_value ⇒ Object
readonly
Returns the value of attribute real_time_market_value.
-
#real_time_price ⇒ Object
readonly
Returns the value of attribute real_time_price.
-
#realTimePrice ⇒ Object
readonly
Returns the value of attribute realTimePrice.
-
#security_class ⇒ Object
readonly
Returns the value of attribute security_class.
-
#security_description ⇒ Object
readonly
Returns the value of attribute security_description.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(details) ⇒ Position
constructor
A new instance of Position.
Methods inherited from Base
Constructor Details
#initialize(details) ⇒ Position
Returns a new instance of Position.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/scottrade/position.rb', line 7 def initialize(details) @symbol = details["symbol"] @display_symbol = details["displaySymbol"] @quantity = details["quantity"] @account_type = details["accType"] @cusip = details["cusip"] @security_description = details["securityDescription"] @security_class = details["SecurityClass"] @previous_close_price = details["previousClosePrice"] @real_time_price = details["realTimePrice"] begin @price_change = Money.parse details["priceChange"].split("\n")[0] rescue @price_change = Money.parse("$0.00") end begin @previous_market_close_value = Money.parse(details["prevCloseMktValue"]) rescue @previous_market_close_value = Money.parse("$0.00") end begin @real_time_market_value = Money.parse(details["RealTimeMktValue"]) rescue @previous_market_close_value = Money.parse("$0.00") end end |
Instance Attribute Details
#account_type ⇒ Object (readonly)
Returns the value of attribute account_type.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def account_type @account_type end |
#cusip ⇒ Object (readonly)
Returns the value of attribute cusip.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def cusip @cusip end |
#display_symbol ⇒ Object (readonly)
Returns the value of attribute display_symbol.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def display_symbol @display_symbol end |
#previous_close_price ⇒ Object (readonly)
Returns the value of attribute previous_close_price.
5 6 7 |
# File 'lib/scottrade/position.rb', line 5 def previous_close_price @previous_close_price end |
#previous_market_close_value ⇒ Object (readonly)
Returns the value of attribute previous_market_close_value.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def previous_market_close_value @previous_market_close_value end |
#price_change ⇒ Object (readonly)
Returns the value of attribute price_change.
5 6 7 |
# File 'lib/scottrade/position.rb', line 5 def price_change @price_change end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def quantity @quantity end |
#real_time_market_value ⇒ Object (readonly)
Returns the value of attribute real_time_market_value.
5 6 7 |
# File 'lib/scottrade/position.rb', line 5 def real_time_market_value @real_time_market_value end |
#real_time_price ⇒ Object (readonly)
Returns the value of attribute real_time_price.
5 6 7 |
# File 'lib/scottrade/position.rb', line 5 def real_time_price @real_time_price end |
#realTimePrice ⇒ Object (readonly)
Returns the value of attribute realTimePrice.
5 6 7 |
# File 'lib/scottrade/position.rb', line 5 def realTimePrice @realTimePrice end |
#security_class ⇒ Object (readonly)
Returns the value of attribute security_class.
5 6 7 |
# File 'lib/scottrade/position.rb', line 5 def security_class @security_class end |
#security_description ⇒ Object (readonly)
Returns the value of attribute security_description.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def security_description @security_description end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
4 5 6 |
# File 'lib/scottrade/position.rb', line 4 def symbol @symbol end |