Class: Scottrade::Account
- Inherits:
-
Object
- Object
- Scottrade::Account
- Defined in:
- lib/scottrade/account.rb
Constant Summary collapse
- CASH_ACCOUNT =
"Cash"
- MARGIN_ACCOUNT =
"Margin"
- SHORT_ACCOUNT =
"Short"
Instance Attribute Summary collapse
-
#deposited_funds ⇒ Object
readonly
Returns the value of attribute deposited_funds.
-
#market_value ⇒ Object
readonly
Returns the value of attribute market_value.
-
#settled_funds ⇒ Object
readonly
Returns the value of attribute settled_funds.
-
#total_available_for_trading ⇒ Object
readonly
Returns the value of attribute total_available_for_trading.
-
#total_value ⇒ Object
readonly
Returns the value of attribute total_value.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#yesterday_market_value ⇒ Object
readonly
Returns the value of attribute yesterday_market_value.
Instance Method Summary collapse
- #cash? ⇒ Boolean
-
#initialize(details = {}) ⇒ Account
constructor
A new instance of Account.
- #margin? ⇒ Boolean
- #short? ⇒ Boolean
Constructor Details
#initialize(details = {}) ⇒ Account
Returns a new instance of Account.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/scottrade/account.rb', line 10 def initialize(details={}) @type = details["AccountType"] @settled_funds = Money.parse details["SettledFunds"] @market_value = Money.parse details["MarketValue"] @yesterday_market_value = Money.parse details["YesterdayMarketValue"] @total_available_for_trading = Money.parse details["TotalAccountTypeFundsForTrading"] @deposited_funds = Money.parse details["BankDepositProgramForTrading"] @total_value = Money.parse details["TotalAccountTypeValue"] end |
Instance Attribute Details
#deposited_funds ⇒ Object (readonly)
Returns the value of attribute deposited_funds.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def deposited_funds @deposited_funds end |
#market_value ⇒ Object (readonly)
Returns the value of attribute market_value.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def market_value @market_value end |
#settled_funds ⇒ Object (readonly)
Returns the value of attribute settled_funds.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def settled_funds @settled_funds end |
#total_available_for_trading ⇒ Object (readonly)
Returns the value of attribute total_available_for_trading.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def total_available_for_trading @total_available_for_trading end |
#total_value ⇒ Object (readonly)
Returns the value of attribute total_value.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def total_value @total_value end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def type @type end |
#yesterday_market_value ⇒ Object (readonly)
Returns the value of attribute yesterday_market_value.
8 9 10 |
# File 'lib/scottrade/account.rb', line 8 def yesterday_market_value @yesterday_market_value end |
Instance Method Details
#cash? ⇒ Boolean
22 23 24 |
# File 'lib/scottrade/account.rb', line 22 def cash? @type == CASH_ACCOUNT end |
#margin? ⇒ Boolean
25 26 27 |
# File 'lib/scottrade/account.rb', line 25 def margin? @type == MARGIN_ACCOUNT end |
#short? ⇒ Boolean
28 29 30 |
# File 'lib/scottrade/account.rb', line 28 def short? @type == SHORT_ACCOUNT end |