Class: Alpaca::Trade::Api::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/alpaca/trade/api/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Account

Returns a new instance of Account.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/alpaca/trade/api/account.rb', line 14

def initialize(json)
  @id = json['id']
  @status = json['status']
  @currency = json['currency']
  @buying_power = BigDecimal(json['buying_power'])
  @cash = BigDecimal(json['cash'])
  @portfolio_value = BigDecimal(json['portfolio_value'])
  @pattern_day_trader = json['pattern_day_trader']
  @trade_suspended_by_user = json['trade_suspended_by_user']
  @trading_blocked = json['trading_blocked']
  @transfers_blocked = json['transfers_blocked']
  @created_at = json['created_at']
  @shorting_enabled = json['shorting_enabled']
  @multiplier = json['multiplier']
  @long_market_value = BigDecimal(json['long_market_value'])
  @short_market_value = BigDecimal(json['short_market_value'])
  @equity = BigDecimal(json['equity'])
  @last_equity = BigDecimal(json['last_equity'])
  @initial_margin = BigDecimal(json['initial_margin'])
  @maintenance_margin = BigDecimal(json['maintenance_margin'])
  @daytrade_count = json['daytrade_count']
  @sma = json['sma']
end

Instance Attribute Details

#account_blockedObject (readonly)

Returns the value of attribute account_blocked.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def 
  @account_blocked
end

#buying_powerObject (readonly)

Returns the value of attribute buying_power.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def buying_power
  @buying_power
end

#cashObject (readonly)

Returns the value of attribute cash.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def cash
  @cash
end

#created_atObject (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def currency
  @currency
end

#daytrade_countObject (readonly)

Returns the value of attribute daytrade_count.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def daytrade_count
  @daytrade_count
end

#equityObject (readonly)

Returns the value of attribute equity.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def equity
  @equity
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def id
  @id
end

#initial_marginObject (readonly)

Returns the value of attribute initial_margin.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def initial_margin
  @initial_margin
end

#last_equityObject (readonly)

Returns the value of attribute last_equity.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def last_equity
  @last_equity
end

#long_market_valueObject (readonly)

Returns the value of attribute long_market_value.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def long_market_value
  @long_market_value
end

#maintenance_marginObject (readonly)

Returns the value of attribute maintenance_margin.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def maintenance_margin
  @maintenance_margin
end

#multiplierObject (readonly)

Returns the value of attribute multiplier.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def multiplier
  @multiplier
end

#pattern_day_traderObject (readonly)

Returns the value of attribute pattern_day_trader.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def pattern_day_trader
  @pattern_day_trader
end

#portfolio_valueObject (readonly)

Returns the value of attribute portfolio_value.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def portfolio_value
  @portfolio_value
end

#short_market_valueObject (readonly)

Returns the value of attribute short_market_value.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def short_market_value
  @short_market_value
end

#shorting_enabledObject (readonly)

Returns the value of attribute shorting_enabled.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def shorting_enabled
  @shorting_enabled
end

#smaObject (readonly)

Returns the value of attribute sma.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def sma
  @sma
end

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def status
  @status
end

#trade_suspended_by_userObject (readonly)

Returns the value of attribute trade_suspended_by_user.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def trade_suspended_by_user
  @trade_suspended_by_user
end

#trading_blockedObject (readonly)

Returns the value of attribute trading_blocked.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def trading_blocked
  @trading_blocked
end

#transfers_blockedObject (readonly)

Returns the value of attribute transfers_blocked.



7
8
9
# File 'lib/alpaca/trade/api/account.rb', line 7

def transfers_blocked
  @transfers_blocked
end