Alpa.Client (AlpaEx v1.0.3)

View Source

HTTP client for the Alpaca API.

Uses Req for HTTP requests with automatic:

  • Authentication header injection
  • JSON encoding/decoding
  • Error handling
  • Retry logic for rate limiting

Summary

Functions

Make a DELETE request to the trading API.

Make a GET request to the trading API.

Make a GET request to the market data API.

Make a PATCH request to the trading API.

Make a POST request to the trading API.

Make a PUT request to the trading API.

Make a request with explicit config.

Types

response()

@type response() :: {:ok, map() | [map()] | :deleted} | {:error, Alpa.Error.t()}

Functions

delete(path, opts \\ [])

@spec delete(
  String.t(),
  keyword()
) :: response()

Make a DELETE request to the trading API.

get(path, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: response()

Make a GET request to the trading API.

get_data(path, opts \\ [])

@spec get_data(
  String.t(),
  keyword()
) :: response()

Make a GET request to the market data API.

patch(path, body, opts \\ [])

@spec patch(String.t(), map(), keyword()) :: response()

Make a PATCH request to the trading API.

post(path, body \\ nil, opts \\ [])

@spec post(String.t(), map() | nil, keyword()) :: response()

Make a POST request to the trading API.

put(path, body, opts \\ [])

@spec put(String.t(), map(), keyword()) :: response()

Make a PUT request to the trading API.

request(method, api, path, body, opts)

@spec request(atom(), :trading | :data, String.t(), map() | nil, keyword()) ::
  response()

Make a request with explicit config.