Class: Tradier::Account
- Inherits:
-
Base
- Object
- Base
- Tradier::Account
show all
- Defined in:
- lib/tradier/account.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#[], #attr_equal, attr_reader, #attrs, #attrs_equal, from_response, #initialize, #update
Constructor Details
This class inherits a constructor from Tradier::Base
Instance Attribute Details
#account_number ⇒ Object
Returns the value of attribute account_number.
5
6
7
|
# File 'lib/tradier/account.rb', line 5
def account_number
@account_number
end
|
#classification ⇒ Object
Returns the value of attribute classification.
5
6
7
|
# File 'lib/tradier/account.rb', line 5
def classification
@classification
end
|
#type ⇒ Object
Returns the value of attribute type.
5
6
7
|
# File 'lib/tradier/account.rb', line 5
def type
@type
end
|
Instance Method Details
#cash? ⇒ Boolean
11
12
13
|
# File 'lib/tradier/account.rb', line 11
def cash?
type.downcase == 'cash'
end
|
#entity? ⇒ Boolean
63
64
65
|
# File 'lib/tradier/account.rb', line 63
def entity?
classification && classification.downcase == 'entity'
end
|
#gainloss ⇒ Object
27
28
29
30
31
|
# File 'lib/tradier/account.rb', line 27
def gainloss
@attrs.fetch(:gainloss, {}).
fetch(:closed_position, []).
map { |a| Tradier::Position.new(a) }
end
|
#history ⇒ Object
33
34
35
36
37
|
# File 'lib/tradier/account.rb', line 33
def history
@attrs.fetch(:history, {}).
fetch(:event, []).
map { |a| Tradier::Event.new(a) }
end
|
#individual_account? ⇒ Boolean
39
40
41
|
# File 'lib/tradier/account.rb', line 39
def individual_account?
classification && classification.downcase == 'individual'
end
|
#ira? ⇒ Boolean
59
60
61
|
# File 'lib/tradier/account.rb', line 59
def ira?
traditional_ira? || roth_ira? || rollover_ira?
end
|
#joint_account? ⇒ Boolean
43
44
45
|
# File 'lib/tradier/account.rb', line 43
def joint_account?
classification && classification.downcase == 'joint'
end
|
#margin? ⇒ Boolean
7
8
9
|
# File 'lib/tradier/account.rb', line 7
def margin?
type.downcase == 'margin'
end
|
#orders ⇒ Object
21
22
23
24
25
|
# File 'lib/tradier/account.rb', line 21
def orders
@attrs.fetch(:orders, {}).
fetch(:order, []).
map { |a| Tradier::Order.new(a) }
end
|
#positions ⇒ Object
15
16
17
18
19
|
# File 'lib/tradier/account.rb', line 15
def positions
@attrs.fetch(:positions, {}).
fetch(:position, []).
map { |a| Tradier::Position.new(a) }
end
|
#rollover_ira? ⇒ Boolean
55
56
57
|
# File 'lib/tradier/account.rb', line 55
def rollover_ira?
classification && classification.downcase == 'rollover_ira'
end
|
#roth_ira? ⇒ Boolean
51
52
53
|
# File 'lib/tradier/account.rb', line 51
def roth_ira?
classification && classification.downcase == 'roth_ira'
end
|
#traditional_ira? ⇒ Boolean
47
48
49
|
# File 'lib/tradier/account.rb', line 47
def traditional_ira?
classification && classification.downcase == 'traditional_ira'
end
|