Coinbase.Pro.REST.Request (coinbasepro_rest v1.0.0) View Source

Module responsible for wrapping logic of the HTTP requests issues to the Coinbase Pro API.

Example

alias Coinbase.Pro.REST.{Context,Request}
# Obtain these values from Coinbase
context = %Context{key: "...", secret: "...", passphrase: "..."}
{:ok, response} = Request.get(context, "/orders?limit=10")

Link to this section Summary

Functions

Issues a signed GET request to the Coinbase Pro REST API.

Works similarly to get/3 but issues multiple requests to handle pagination and fetch the whole collection.

Issues a signed POST request to the Coinbase Pro REST API.

Link to this section Functions

Link to this function

get(context, path, opts \\ [])

View Source

Specs

get(Coinbase.Pro.REST.Context.t(), Tesla.Env.url(), [Tesla.option()]) ::
  {:ok, Coinbase.Pro.REST.Response.t()}
  | {:error, {:http, any()}}
  | {:error, {:code, pos_integer(), any()}}

Issues a signed GET request to the Coinbase Pro REST API.

On success it returns {:ok, response} where response is a Response struct.

On error it returns either {:error, {:http, reason}} when underlying HTTP call has failed or {:error, {:code, code, body}} when the HTTP call suceeded but it returned unexpected status code.

Link to this function

get_all(context, path, opts \\ [])

View Source

Specs

get_all(Coinbase.Pro.REST.Context.t(), Tesla.Env.url(), [Tesla.option()]) ::
  {:ok, Coinbase.Pro.REST.Response.t()}
  | {:error, {:http, any()}}
  | {:error, {:code, pos_integer(), any()}}

Works similarly to get/3 but issues multiple requests to handle pagination and fetch the whole collection.

Link to this function

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

View Source

Issues a signed POST request to the Coinbase Pro REST API.

On success it returns {:ok, response} where response is a Response struct.

On error it returns either {:error, {:http, reason}} when underlying HTTP call has failed or {:error, {:code, code, body}} when the HTTP call suceeded but it returned unexpected status code.