alpa v0.1.3 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
close a position by symbol
close all positions
create a watchlist
delete all orders
delete an order
delete a watchlist by id
auth headers for api
places an order
get asset by id or symbol
list open positions
sell day market order wrapper
get watchlists by id
add an asset to a watchlist
gets id of watchlist by name
list watchlists
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
One of minute, 1Min, 5Min, 15Min, day or 1D. minute is an alias of 1Min. Similarly, day is of 1D.
symbols (comma separated)
limit
start_time
end_time
after
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
o
h
l
c
v
buy day market order wrapper
close a position by symbol
close all positions
create a watchlist
delete all orders
delete an order
delete a watchlist by id
auth headers for api
place_order(symbol, qty, side, type, time_in_force, limit_price \\ nil, stop_price \\ nil)
View Sourceplaces an order
get asset by id or symbol
list open positions
sell day market order wrapper
get watchlists by id
add an asset to a watchlist
gets id of watchlist by name
returns:
{:ok, id} on success
{:error, reason} on failure
list watchlists