Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vectrade.io/llms.txt

Use this file to discover all available pages before exploring further.

Installation

pip install vectrade
Optional extras:
pip install vectrade[telemetry]   # OpenTelemetry integration
pip install vectrade[pandas]      # DataFrame helpers

Quick Start

from vectrade import VecTrade

client = VecTrade()  # reads VECTRADE_API_KEY env var

quote = client.quotes.get("AAPL")
print(f"{quote.symbol}: ${quote.price}")

Async Client

from vectrade import AsyncVecTrade

async def main():
    client = AsyncVecTrade()
    quote = await client.quotes.get("AAPL")
    print(f"{quote.symbol}: ${quote.price}")

Configuration

client = VecTrade(
    api_key="vq_live_...",       # or VECTRADE_API_KEY env var
    base_url="https://...",      # custom endpoint
    timeout=30,                  # request timeout (seconds)
    max_retries=2,               # automatic retries on 429/5xx
    sandbox=True,                # use sandbox environment
)

Resources

All 11 API resource groups are available:
ResourceMethods
client.quotesget(symbol), batch(symbols)
client.fundamentalsget(symbol), income_statement(symbol), balance_sheet(symbol)
client.technicalsget(symbol, indicators, interval)
client.newslist(symbols, limit), get(id)
client.screenerscreen(filters, limit)
client.aianalyze(prompt) — supports streaming
client.optionschain(symbol, expiration), expirations(symbol)
client.analystconsensus(symbol), price_targets(symbol), ratings(symbol)
client.earningshistory(symbol), calendar()
client.insidertransactions(symbol), summary(symbol)
client.webhookscreate(url, events), list(), delete(id)

Streaming

for chunk in client.ai.analyze("Analyze AAPL", stream=True):
    print(chunk.content, end="")

Pagination

for article in client.news.list(limit=100):
    print(article.title)
# Automatically fetches next pages

Middleware

from vectrade.telemetry import OpenTelemetryMiddleware

client = VecTrade(middleware=[OpenTelemetryMiddleware()])

Webhooks

from vectrade import Webhooks

event = Webhooks.verify(payload, headers, secret)

Error Handling

from vectrade import RateLimitError, NotFoundError

try:
    quote = client.quotes.get("INVALID")
except NotFoundError as e:
    print(f"Not found: {e} (request_id: {e.request_id})")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")

Requirements

  • Python 3.9+
  • Dependencies: httpx, pydantic

GitHub

Source code, issues, and contributions