AlpacaElixir v0.6.0 Alpaca.Position View Source

A resource that allows us to perform operations on an Position

A position has the following methods we can call on it

get/1
list/0
delete_all/0
delete/1

The get/1 method allows us to get a singular position by calling Alpaca.Position.get(symbol). Where symbol is the symbol of the position to get.

The list/1 method allows us to list all positions by calling Alpaca.Position.list().

The delete_all/0 method allows us to close all open positions by calling Alpaca.Position.delete_all().

The delete/1 method allows us to close a specific position by calling Alpaca.Position.delete(symbol). Where symbol is the symbol of the position we want to close.

Link to this section Summary

Functions

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 get a singlular resource from the Alpaca API

A function to list all resources from the Alpaca API

Link to this section Functions

Specs

delete(String.t()) :: :ok

A function to delete a singular resource of a given type using the Alpaca API

Specs

delete_all() :: {:ok, [map()]} | {:error, map()}

A function to delete all resources of a given type using the Alpaca API

Specs

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

A function to get a singlular resource from the Alpaca API

Specs

list(map()) :: {:ok, [map()]} | {:error, map()}

A function to list all resources from the Alpaca API