/alpaca_elixir

Alpaca API Elixir client wrapper

Primary LanguageElixirMIT LicenseMIT

alpaca_elixir Coverage Status jrusso1020

An Elixir wrapper for the Alpaca web api v2 for trading stocks commission free.

Installation

The package can be installed by adding alpaca_elixir to your list of dependencies in mix.exs:

def deps do
  [
    {:alpaca_elixir, "~> 2.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/alpaca_elixir.

Getting Started

Registration

This library requires a valid Alpaca Client ID and Secret to work. You can get both a Client ID and Secret by creating an account at Alpaca. Once you have created an account you will need to create an OAuth app to get access to a Client ID and Secret.

Client ID and Secret Configuration

To configure your app to make calls to Alpaca setup your configuration using the proper values like below

config :alpaca_elixir,
  api_host: System.get_env("ALPACA_API_HOST"),
  client_id: System.get_env("ALPACA_CLIENT_ID"),
  client_secret: System.get_env("ALPACA_CLIENT_SECRET")

Testing

You can run tests using mix test generally

Testing using Docker Container

If you would like to use the Docker container you can use the following commands in your terminal to build the Docker image, start the container, and start an interactive bash session within the container.

docker build -t alpaca-elixir .
docker run -it -t alpaca-elixir bash

Once you have access to the interactive bash session you should be able to run tests like so.

mix test