AlpacaElixir v2.2.0 Alpaca.Watchlist View Source
A resource that allows us to perform operations on an Watchlist
A watchlist has the following methods we can call on it
get/1
list/0
create/1
update/2
add_asset/2
remove_asset/2
delete/1The get/1 method allows us to get a singular watchlist by calling Alpaca.Watchlist.get(id).
Where id is the id of the watchlist to get.
The list/0 method allows us to list all watchlists by calling Alpaca.Watchlist.list().
The create/1 method allows us to create a new watchlist by calling Alpaca.Watchlist.create(params).
Where params is the Map of parameters to create the watchlist
The update/2 method allows us to update a specific watchlist by calling Alpaca.Watchlist.update(id, params).
Where id is the id of the watchlist and params are the parameters of the watchlist we want to
update defined by the Alpaca API documentation.
The add_asset/2 method allows us to add an asset to a specific watchlist by calling Alpaca.Watchlist.add_asset(id, params).
Where id is the id of the watchlist and params are the parameters of the asset to add. At this time just
a key symbol is needed.
The remove_asset/2 method allows us to remove an asset from a specific watchlist by calling Alpaca.Watchlist.remove_asset(id, symbol).
Where id is the id of the watchlist and symbol is the symbol to remove
The delete/1 method allows us to delete a specific watchlist by calling Alpaca.Watchlist.delete(id).
Where id is the id of the order we want to delete.
Link to this section Summary
Functions
Adds an asset to a watchlist
A function to create a new resource from the Alpaca API
A function to delete a singular resource of a given type using the Alpaca API
A function to get a singlular resource from the Alpaca API
A function to list all resources from the Alpaca API
Remove an asset from a watchlist
A function to update an existing resource using the Alpaca API
Link to this section Functions
Adds an asset to a watchlist
Example
iex> {:ok, %{} = watchlist} = Alpaca.Watchlist.add_asset(id, %{symbol: symbol})Allows us to add an asset to a watchlist and get back a a result tuple {:ok, %{}}
if successful. If not success we will get back a result tuple {:error, {status: http_status_code, body: http_response_body}}
Specs
A function to create a new resource from the Alpaca API
Specs
delete(String.t()) :: :ok
A function to delete a singular resource of a given type using the Alpaca API
Specs
A function to get a singlular resource from the Alpaca API
Specs
A function to list all resources from the Alpaca API
Remove an asset from a watchlist
Example
iex> {:ok, %{} = watchlist} = Alpaca.Watchlist.remove_asset(id, symbol)Allows us to remove an asset from a watchlist and get back a a result tuple {:ok, %{}}
if successful. If not success we will get back a result tuple {:error, {status: http_status_code, body: http_response_body}}
Specs
A function to update an existing resource using the Alpaca API