Skip to main content

Auto-batched Zerodha historical data with TA-Lib style indicators

Project description

zerodha_talib

Zerodha historical data to pandas with TA-Lib indicators.

Python License: MIT Status

Install

pip install zerodha-talib

For local development:

pip install -e .[dev]

Usage

from kiteconnect import KiteConnect
import pandas as pd
from zerodha_talib import HistoricalClient, add_basics, add_talib

# Display settings
pd.set_option('display.max_rows', 100000)
pd.set_option('display.max_columns', 50)
pd.set_option('display.width', None)

# API credentials
api_key = 'your api key'
access_token = 'your access token'

kite = KiteConnect(api_key=api_key)
kite.set_access_token(access_token)

client = HistoricalClient(kite)

# 1) Fetch historical candles only
df = client.fetch(
    instrument_name='NIFTY 50',
    exchange='NSE',
    from_date='2010-01-01',
    to_date='2026-02-28',
    interval='day',
)

print('Raw OHLCV:')
print(df.tail(5))

# 2) add_basics + add_talib (nubra_talib style)
#df = add_basics(df)
df_ta = add_talib(
    df,
    funcs={
        "RSI": {"timeperiod": 14},
        "EMA": {"timeperiod": 21},
        "CCI": {"timeperiod": 14},
        "MACD": {"fastperiod": 12, "slowperiod": 26, "signalperiod": 9},
    },
)

print('\nWith indicators (add_talib):')
print(df_ta.tail(5))

Example Script

python examples/example.py

Historical Fetch Defaults

  • batch_days=2000
  • throttle_seconds=0.5
  • retries=3
  • backoff_seconds=1.0

API

  • HistoricalClient(kite)
  • HistoricalClient.fetch(...)
  • add_basics(df) -> adds SMA_9, EMA_21, RSI_14
  • add_talib(df, funcs={...})

Release Checklist

  • Update version in pyproject.toml
  • Validate imports with pip install -e .
  • Run your sample script: python examples/example.py
  • Run tests (if using dev deps): pytest
  • Build artifacts: python -m build
  • Check artifacts in dist/
  • Commit + tag release in Git
  • Push to GitHub

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zerodha_talib-0.2.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zerodha_talib-0.2.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file zerodha_talib-0.2.1.tar.gz.

File metadata

  • Download URL: zerodha_talib-0.2.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zerodha_talib-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d4e1b0c18493e5e10e6c5ec750a98716ed4c577cec58eecbe435f86e1b38e927
MD5 62f11280c3fb7b4915a61bb843c84fd5
BLAKE2b-256 e4fd1d1703d86485fc4f2877b47f1363a22075a525c7c2ad9bfa4550ed9cb0e5

See more details on using hashes here.

File details

Details for the file zerodha_talib-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: zerodha_talib-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zerodha_talib-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef85ae5c62b95767269210639a0880092f84959a24d7f8be85d39f82603059d6
MD5 e35eaa17fb3e7bbebea0f3b9989b3206
BLAKE2b-256 6b3e31a5635b0222c4ef4c4c057cdf2b1b6b6eedd7c09448e548b4999ad817a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page