dm13450 / AlpacaMarkets.jl

Julia interface to the Alpaca Trading API
MIT License
31 stars 7 forks source link

Alpaca Markets

A work in progress Julia wrapper for the Alpaca Markets API.

Overview

Access Alpaca Markets market data API to retrieve stock and crypto market data.

Installation and Setup

AlpacaMarkets.jl is in the General Registry so you can simply install locally using Pkg.

You need to sign up to AlpacaMarkets to obtain your API keys. Once you've obtained the key and secret you can authenticate manually with

using AlpacaMarkets
AlpacaMarkets.select_account("PAPER")
AlpacaMarkets.auth(KEY, SECRET)

Rather than setting it manually each time I recommend you add it to your .julia/startup.jl or '.julia/config/startup.jl'

ENV["ALPACA_KEY"] = KEY
ENV["ALPACA_SECRET"] = SECRET

This is automatically be picked up by AlpacaMarkets.jl each time you start Julia.

Available Functions

All the historical market data API functions are available:

Plus the interface to their news API

Plus I've added helper functions to obtain data between two periods:

So you can pull some historical data as and when needed.

Trading API functions are available up to account, orders and positions:

To Do

Examples