AlpacaElixir v0.1.0 Alpaca.Order View Source
A resource that allows us to perform operations on an Order
An order has the following methods we can call on it
get/1
list/1
create/1
edit/2
delete_all/0
delete/1
get_by_client_order_id/1
The get/1
method allows us to get a singular order by calling Alpaca.Order.get(id)
.
Where id
is the id of the order to get.
The list/1
method allows us to list all orders by calling Alpaca.Order.list(params)
.
Where params
is a Map of optional params you can use to retrieve orders
defined in the Alpaca API documentation
The create/1
method allows us to create a new order by calling Alpaca.Order.create(params)
.
Where params
is the Map of parameters to create the order
The edit/2
method allows us to edit a specific order by calling Alpaca.Order.edit(id, params)
.
Where id
is the id of the order and params
are the parameters of the order we want to
change defined by the Alpaca API documentation.
The delete_all/0
method allows us to delete all open orders by calling Alpaca.Order.delete_all()
.
The delete/1
method allows us to delete a specific order by calling Alpaca.Order.delete(id)
.
Where id is the id of the order we want to delete.
The get_by_client_order_id/1
method allows us to get a specific order by the client order id by calling
Alpaca.Order.get_by_client_order_id(client_order_id)
. Where client_order_id is the client order id on the order.
Link to this section Summary
Functions
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 delete all resources of a given type using the Alpaca API
A function to edit an existing resource using the Alpaca API
A function to get a singlular resource from the Alpaca API
Retrieve an order by client order id
A function to list all resources from the Alpaca API
Link to this section Types
Specs
t() :: %Alpaca.Order{ asset_class: String.t() | nil, asset_id: String.t() | nil, canceled_at: String.t() | nil, client_order_id: String.t() | nil, created_at: String.t() | nil, expired_at: String.t() | nil, extended_hours: boolean() | nil, failed_at: String.t() | nil, filled_at: String.t() | nil, filled_avg_price: String.t() | nil, filled_qty: String.t() | nil, id: String.t() | nil, limit_price: String.t() | nil, qty: String.t() | nil, replaced_at: String.t() | nil, replaced_by: String.t() | nil, replaces: String.t() | nil, side: String.t() | nil, status: String.t() | nil, stop_price: String.t() | nil, submitted_at: String.t() | nil, symbol: String.t() | nil, time_in_force: String.t() | nil, type: String.t() | nil, updated_at: String.t() | nil }
An Order
Link to this section Functions
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 delete all resources of a given type using the Alpaca API
Specs
A function to edit an existing resource using the Alpaca API
Specs
A function to get a singlular resource from the Alpaca API
Specs
Retrieve an order by client order id
Example
iex> {:ok, %Order{} = order} = Order.get_by_client_order_id(client_order_id)
Allows us to retrieve our an order as a result tuple {:ok, %Alpaca.Order{}}
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 list all resources from the Alpaca API