Skip to main content

OHLC-DATA

Easily download OHLC data from either alpaca (requires API keys) or yfinance to csv files
To acquire API keys for alpaca visit: https://alpaca.markets/

Instructions

  • Open your preferred CLI (Terminal/Command Prompt etc)
  • Create and activate a Python virtual environment

Mac/Linux

python3 -m venv <venv>
source ./<venv>/bin/activate

Windows

python -m venv <venv>
./<venv>/Scripts/activate

Installation

Mac/Linux

pip3 install ohlc-data

Windows

pip install ohlc-data

Download OHLC data

ohlc_download

Running this script will create a folder in the current directory called 'ohlc_csv' if there isn't one already by that name. It will then take you through a series of prompts:

Download data for one or multiple tickers

You can choose to get data for one ticker or multiple tickers at once. Tickers don't have to be typed in capital letters.

Choose source

You can then choose which API to use. Alpaca requires API keys that you'll be prompted to enter, yfinance does not require API keys.

Choose lookback period and interval

Choose from a number of days or years for the lookback period. Custom periods are also available. You will be prompted for a start and end date/datetime if 'Custom' is chosen.

Valid Periods and Intervals (Timeframes)

Valid periods: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
Valid intervals: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo

yfinance:

  • 1m data cannot extend past 7 days
  • 2m - 30m data, and 90m data cannot extend past 60 days
  • 1h data cannot extend past 730 days
  • 1d - 3mo data allows max available data

alpaca:

  • Data from 2016 to present is available for all intervals

Metadata

Release files for ohlc-data 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ohlc-data 1.1.3
File Size Uploaded
ohlc_data-1.1.3.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ohlc-data 1.1.3
File Interpreter ABI Platform
ohlc_data-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / ohlc_data-1.1.3.tar.gz

Download URL ohlc_data-1.1.3.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c4f920691cefb18bd6f2731dc9b693f6182197f977722680026d06b54c14c9a0
BLAKE2b-256 checksum
How to use checksums
dca9202252945edc52ef1aa68a382509c53f2423d0e54c1ddfe819b2de9c729c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.6 Darwin/22.6.0

Release files / ohlc_data-1.1.3-py3-none-any.whl

Download URL ohlc_data-1.1.3-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe9bfa1d7f50e95ff88df0862ff066f2d201a99357d075bad0f1bc12be412b59
BLAKE2b-256 checksum
How to use checksums
b9be51abb790bcaee4fd9a1a50fc7fe9ad676a987ad34755213b3b8a6e1a6af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.6 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page