trading-data-py
Python client for the TradeInsight Trading Data Service API.
Provides a Ticker class with a history() method that returns a pandas DataFrame
with yfinance-compatible column names.
Installation
pip install trading-data-py
Or install from source:
git clone https://github.com/tradeinsight/trading-data-py.git
cd trading-data-py
pip install -e .
Quick Start
Set your API key in the environment:
export TIDATA_API_KEY=your_key_here
Then use the client:
from tidata.tifinance import Ticker
# API key is read from TIDATA_API_KEY env var automatically
t = Ticker("AAPL")
# Adjusted prices (yfinance-compatible)
df = t.history(start="2024-01-01", end="2024-12-31")
print(df.head())
# Open High Low Close Volume Dividends Stock Splits
# Date
# 2024-01-02 184.210... 185.880... 183.430... 185.200... 79047200.0 0.0 0.0
# Raw (unadjusted) prices — adds an "Adj Close" column, like yfinance
df_raw = t.history(start="2024-01-01", end="2024-12-31", auto_adjust=False)
yfinance drop-in
Ticker.history() mirrors yfinance for the daily-OHLCV case:
from tidata.tifinance import Ticker, download
# period shorthands: 1d 5d 1mo 3mo 6mo 1y 2y 5y 10y ytd max
df = Ticker("AAPL").history(period="1y")
# non-zero dividends / splits over full available history (period="max")
divs = Ticker("AAPL").dividends
spl = Ticker("AAPL").splits
# bulk download — flat frame for one ticker, column MultiIndex for many
one = download("AAPL", period="6mo")
many = download("AAPL MSFT", period="6mo") # columns: (field, ticker)
Behaviour notes
- On API errors,
history()logs a warning and returns an empty DataFrame (yfinance behaviour). Passraise_errors=Trueto raise the typed exception instead. period="max"requests full available history (from a1900-01-01floor), not a fixed window.- Only
interval="1d"is currently supported. - The index is a tz-naive
DatetimeIndexnamedDate.
Configuration
| Parameter | Description | Default |
|---|---|---|
symbol |
Ticker symbol (e.g. "AAPL") |
required |
api_key |
API key — also reads TIDATA_API_KEY env var |
None |
base_url |
API base URL | https://api.tradeinsight.info/trading-data/v1 |
timeout |
HTTP timeout in seconds | 30 |
Exceptions
| Exception | API error code |
|---|---|
TickerNotFoundError |
TICKER_NOT_FOUND, INVALID_TICKER |
AuthenticationError |
UNAUTHORIZED, INVALID_API_KEY, API_KEY_REQUIRED |
RateLimitError |
RATE_LIMIT_EXCEEDED, TOO_MANY_REQUESTS |
InvalidParameterError |
TICKER_REQUIRED, INVALID_DATE, INVALID_PARAMETER |
APIError |
Any other error code (base class) |
All exceptions inherit from APIError which exposes .code and .message.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tidata-0.2.0.tar.gz.
File metadata
- Download URL: tidata-0.2.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0c0ca89a3ac0132e16e9a4ba877489f5b9ac794524222a854a8cc435945353e
|
|
| MD5 |
68851fc2af6a30accd24aadd978ae157
|
|
| BLAKE2b-256 |
9feaf2320e64d847b39af086aff81ba793fe7739759dcda0d1f1abb8fa145238
|
File details
Details for the file tidata-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tidata-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5c2bb24a1ae010b26940c4203f6ce1a9039844d8b4131ad9a140e22ebd4e277
|
|
| MD5 |
bc45913c8fa2cc88893c7fb1c792bf2e
|
|
| BLAKE2b-256 |
5eb48a5d541f32f9898a4bbe7cb1a39a6ba904a82bc48e554e77e125e62579c3
|