Skip to main content

Official Python SDK for the VecTrade financial data and AI platform

Project description

VecTrade Python SDK

CI PyPI codecov License Python 3.9+

Official Python SDK for the VecTrade financial data and AI platform.

Features

  • Sync & Async — both VecTrade and AsyncVecTrade clients
  • Streaming AI — generator-based streaming analysis
  • Type-safe — Pydantic response models, mypy strict
  • Resilient — automatic retries with exponential backoff
  • Minimal deps — httpx + pydantic only

Installation

pip install vectrade

With optional extras:

pip install "vectrade[pandas]"       # DataFrame support
pip install "vectrade[telemetry]"    # OpenTelemetry tracing

Quick Start

from vectrade import VecTrade

vt = VecTrade()  # reads VECTRADE_API_KEY from env

# Real-time quote
quote = vt.quotes.get("AAPL")
print(f"{quote.symbol}: ${quote.price}")

# Stream AI analysis
for chunk in vt.ai.stream("Analyze AAPL for long-term hold"):
    print(chunk.text, end="")

Async Usage

from vectrade import AsyncVecTrade

async with AsyncVecTrade() as vt:
    quote = await vt.quotes.get("AAPL")

Available Resources

Resource Description
client.quotes Real-time and historical price quotes
client.fundamentals Financial statements, ratios, company profiles
client.technicals Technical indicators (RSI, MACD, Bollinger, etc.)
client.news Market news and sentiment
client.earnings Earnings reports and estimates
client.analyst Analyst ratings and price targets
client.insider Insider trading activity
client.options Options chains and Greeks
client.screener Stock screener with pagination
client.webhooks Webhook management for real-time alerts
client.developer API key and usage management
client.ai AI-powered streaming analysis

Configuration

vt = VecTrade(
    api_key="vq_live_...",       # or set VECTRADE_API_KEY
    sandbox=True,                # use sandbox environment
    timeout=60.0,                # request timeout (seconds)
    max_retries=3,               # retry on 429/5xx
)

Error Handling

The SDK raises typed exceptions for all API errors:

from vectrade import VecTrade, RateLimitError, AuthenticationError, NotFoundError

try:
    quote = vt.quotes.get("INVALID")
except NotFoundError as e:
    print(f"Symbol not found: {e}")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except AuthenticationError as e:
    print(f"Bad API key: {e}")

All exceptions include request_id and status_code for debugging.

Developer Self-Service

Manage your API keys and monitor usage programmatically:

# Check your plan and quota
plan = vt.developer.get_plan()
print(f"Plan: {plan.plan_name}, Quota: {plan.monthly_quota}")

quota = vt.developer.get_quota()
print(f"Used: {quota.used}/{quota.monthly_quota} ({quota.usage_pct}%)")

# Manage API keys
keys = vt.developer.list_keys()
new_key = vt.developer.create_key(label="production", scopes="quotes,options")
vt.developer.revoke_key(key_id=new_key.id)

Pagination

Use the built-in pagination helpers for list endpoints:

# Screener with pagination
results = vt.screener.filter(
    market_cap_min=1_000_000_000,
    sector="Technology",
    limit=50,
    offset=0,
)

Rate Limits

The SDK automatically handles rate limiting with exponential backoff. You can also check your limits:

quota = vt.developer.get_quota()
print(f"Remaining: {quota.remaining} requests this period")

Documentation

Full documentation is available at docs.vectrade.io/sdks/python.

Versioning

This SDK follows Semantic Versioning:

  • MAJOR — breaking changes to public API
  • MINOR — new features, backward-compatible
  • PATCH — bug fixes, backward-compatible

Pre-1.0 releases may include breaking changes in MINOR versions. Pin your dependency accordingly:

# pyproject.toml
dependencies = ["vectrade>=0.1,<0.2"]

Requirements

  • Python 3.9+
  • No system dependencies — pure Python

Contributing

See CONTRIBUTING.md for development setup and guidelines.

Changelog

See CHANGELOG.md for release history.

License

MIT — see LICENSE.

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

vectrade-0.1.0.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

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

vectrade-0.1.0-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vectrade-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f98cd2b1a83ba2c363b0649c6f3a2fa28df52c38f1e860716eba6f66060917b1
MD5 42447ee3240901bbad956741f417f7f4
BLAKE2b-256 5e183313bb5ec178e964dfd73735d049e302204c4569eceb7f48ca4453377eb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for vectrade-0.1.0.tar.gz:

Publisher: publish.yml on VecTrade-io/vectrade-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for vectrade-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 771aaadc0fea18009aa7cd477fd93fd84a4dc5b70d60163a2b435dc63656b71e
MD5 9fa95ed13f3913a6d4865500e6d9b0da
BLAKE2b-256 97194a294bb1352381607998ffeab1292f55379e950ef772e435ea5a99ef5c67

See more details on using hashes here.

Provenance

The following attestation bundles were made for vectrade-0.1.0-py3-none-any.whl:

Publisher: publish.yml on VecTrade-io/vectrade-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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