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

#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

#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