AlpacaElixir v0.1.0 Alpaca.Account View Source

A resource that allows us to query an Account from Alpaca

Link to this section Summary

Types

t()

An Account

Functions

Retrieve your Alpaca trading account info

Link to this section Types

Specs

t() :: %Alpaca.Account{
  account_blocked: boolean(),
  account_number: String.t(),
  buying_power: String.t(),
  cash: String.t(),
  created_at: String.t(),
  currency: String.t(),
  daytrade_count: String.t(),
  daytrading_buying_power: String.t(),
  equity: String.t(),
  id: String.t(),
  initial_margin: String.t(),
  last_equity: String.t(),
  last_maintenance_margin: String.t(),
  long_market_value: String.t(),
  maintenance_margin: String.t(),
  multiplier: String.t(),
  pattern_day_trader: boolean(),
  portfolio_value: String.t(),
  regt_buying_power: String.t(),
  shorting_enabled: boolean(),
  sma: String.t(),
  status: String.t(),
  trade_suspended_by_user: boolean(),
  transfers_blocked: boolean()
}

An Account

Link to this section Functions

Specs

get() :: {:ok, t()} | {:error, map()}

Retrieve your Alpaca trading account info

Example

iex> {:ok, %Account{} = account} = Account.get()

Allows us to retrieve our own account information as a result tuple {:ok, %Account{}} if successful. If not success we will get back a result tuple {:error, {status: http_status_code, body: http_response_body}}