npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sneilan/alpaca-historical-data-downloader

v1.0.10

Published

Command line tool (with managed ETL system) to download / sync all alpaca historical data to your hard drive as CSV files.

Downloads

11

Readme

alpaca-historical-data-downloader

Command line tool (with managed ETL system) to download / sync all alpaca historical data to your hard drive as CSV files.

Alpaca https://alpaca.markets/ is an API-first stock / crypto brokerage. They provide api access to download trades, quotes, news, corporate actions and bars https://alpaca.markets/docs/api-references/market-data-api/. This tool syncs all of this available data from Alpaca to your hard drive as CSV files so you can create a professional backtesting and stock / crypto exploration environment.

The first time the tool runs, it downloads all available 1 day bars which takes about an hour or two. There are some options to focus on specific data types and filters on date ranges so you can get started backtesting sooner rather than later. Or you can pay for a $99/month plan temporarily which will speed up this process.

If the downloader sees that you've already ran and retrieved some data, it will put the data into a staging folder, which gets merged with your existing downloaded CSV files so if there are corrections to the data from Alpaca, these will be handled. By default, this tool assumes whatever is on Alpaca's servers is the correct data.

Installation & Usage

By default, this tool syncs all available alpaca data

npm i -g alpaca-historical-data-downloader
# cd to your desired directory
export ALPACA_API_KEY=<your alpaca key here>
export ALPACA_API_SECRET=<your alpaca api secret here>
alpaca-historical-data-downloader

# or specify a different data directory
alpaca-historical-data-downloader --data-dir=/your/data/folder

# specify a start date 
alpaca-historical-data-downloader --start=2020-01-01

# or an end date 
alpaca-historical-data-downloader --end=2021-01-01

# specific symbols
alpaca-historical-data-downloader --symbols GOOG AAPL MSFT

# combine params
alpaca-historical-data-downloader --start=2020-01-01 --end=2021-01-01 --symbols GOOG AAPL MSFT
# This will download only google, apple and msft symbol information from 2020-01-01 to 2021-01-01 inclusive.

This will create a folder called data in the same directory that you ran ahdd in. It will take the next hour (more data types to come!) to download all daily bars for every available non-crypto stock available for trading in the last

Running the tool again will take far less time because it will detect the data folder and see the csv files in the data/1day folder. It will proceed to sync only what it needs to. This command can be ran each day and it will sync yesterday's market data (on the free plan) or today's market data on the paid plan.

Roadmap & Features

Currently supporting 1 day bars. Soon other time frames like 1 min, quotes, trades, news and corporate actions.