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 -i https://test.pypi.org/simple/ 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.0.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.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zerodha_talib-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 03850a34fc5c3c9229128fdfb9d633fe3925856b2211eb1dcf2366cbf89beae9
MD5 7e6be916d3aeecc07d57f893970a3a78
BLAKE2b-256 bbca4cd5701bbde985eb481a9d0c55582229923504f675b654aead76351a23d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zerodha_talib-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b80e82e1e8688b79891c7e137987ea67a97f1a3cda611cbda2455a787a260ef8
MD5 54dab169f3a443efc992e75717b6769c
BLAKE2b-256 7016da47757e78222abbeb36a8407d7860a4e002aec2b70d55db7fd5cb9d7a33

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