Class: Tradier::Account

Inherits:
Base
  • Object
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_numberObject (readonly)

Returns the value of attribute account_number.



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

def 
  @account_number
end

#classificationObject (readonly)

Returns the value of attribute classification.



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

def classification
  @classification
end

#typeObject (readonly)

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

Returns:

  • (Boolean)


11
12
13
# File 'lib/tradier/account.rb', line 11

def cash?
  type.downcase == 'cash'
end

#gainlossObject



23
24
# File 'lib/tradier/account.rb', line 23

def gainloss
end

#historyObject



26
27
# File 'lib/tradier/account.rb', line 26

def history
end

#individual_account?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/tradier/account.rb', line 29

def individual_account?
  classification.downcase == 'individual'
end

#ira?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/tradier/account.rb', line 49

def ira?
  traditional_ira? || roth_ira? || rollover_ira?
end

#joint_account?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/tradier/account.rb', line 33

def joint_account?
  classification.downcase == 'joint'
end

#margin?Boolean

Returns:

  • (Boolean)


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

def margin?
  type.downcase == 'margin'
end

#ordersObject



19
20
21
# File 'lib/tradier/account.rb', line 19

def orders
  @attrs[:orders][:order].map { |a| Tradier::Order.new(a) }
end

#positionsObject



15
16
17
# File 'lib/tradier/account.rb', line 15

def positions
  @attrs[:positions][:position].map { |a| Tradier::Position.new(a) }
end

#rollover_ira?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/tradier/account.rb', line 45

def rollover_ira?
  classification.downcase == 'rollover_ira'
end

#roth_ira?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/tradier/account.rb', line 41

def roth_ira?
  classification.downcase == 'roth_ira'
end

#traditional_ira?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/tradier/account.rb', line 37

def traditional_ira?
  classification.downcase == 'traditional_ira'
end