Skip to main content

Python client for the TradeInsight API — yfinance-compatible Ticker.history()

Project description

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 TRADING_DATA_API_KEY=your_key_here

Then use the client:

from trading_data import Ticker

# API key is read from TRADING_DATA_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
df_raw = t.history(start="2024-01-01", end="2024-12-31", auto_adjust=False)

Configuration

Parameter Description Default
symbol Ticker symbol (e.g. "AAPL") required
api_key API key — also reads TRADING_DATA_API_KEY env var None
base_url API base URL https://api.tradeinsight.info
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

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

tidata-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

tidata-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file tidata-0.1.0.tar.gz.

File metadata

  • Download URL: tidata-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tidata-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b415a3cabe1453d5b908ea95cd228c28573907df702e57700481f595247f07d
MD5 8933ce0d9d953d59e962bb6f362d6a78
BLAKE2b-256 f61e952549e5aa4680ff468b47b82484bb99e9230fdbc390bceed9b85c5ab35c

See more details on using hashes here.

File details

Details for the file tidata-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tidata-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tidata-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90c3de9c4bcf7d625592e4aa1118cd005062dbc5ca4ad36bf77449189c8e44c8
MD5 d78e7902fb49ba47680f25f433fe9883
BLAKE2b-256 39ae4fdc9ba445886c7711d546ebf64e50890636b3796fd103f02ef616f9a1ac

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