alpa v0.1.2 Alpa View Source

api wrapper for alpaca.markets

Link to this section Summary

Functions

gets account info

get asset by id or symbol

list assets

list bars

buy day market order wrapper

delete all orders

delete an order

auth headers for api

sell day market order wrapper

Link to this section Functions

gets account info

get asset by id or symbol

list assets

list bars

paper money account, IEX data only

(uses 'v1')

https://docs.alpaca.markets/api-documentation/api-v2/market-data/bars/

Retrieves a list of bars for each requested symbol. It is guaranteed all bars are in ascending order by time.

for alpaca api, timestamps are ISO 8601 ('2019-04-15T09:30:00-04:00')

for Alpa, timestamps are Elixir DateTimes

params: /

timeframe : default = "1Min"

One of minute, 1Min, 5Min, 15Min, day or 1D. minute is an alias of 1Min. Similarly, day is of 1D.

symbols / (comma separated)

limit : default = 100 (1000 max)

start_time (cannot be used with :after)

end_time (cannot be used with :until)

after (cannot be used with :start)

until (cannot be used with :until)

note: :end, :after, :until -> :*_time due to Elixir keyword conflict

returns Bars response (list of symbol with lists of bar objects)

%{:ok, [

%{symbol: "AAPL",
  [
  %{t: 1544129220,
    o: 172.26,
    h: 172.3,
    l: 172.16,
    c: 172.18,
    v: 3892,
    }
  ]
}

] }

t the beginning time of this bar as a Unix epoch in seconds

o open price

h high price

l low price

c close price

v volume

buy day market order wrapper

delete all orders

delete an order

auth headers for api

Link to this function

order(symbol, qty, side, type, time_in_force, limit_price \\ nil, stop_price \\ nil)

View Source

posts an order

sell day market order wrapper