Skip to main content

Python SDK for Reportify API - Financial data and document search

Project description

Reportify SDK for Python

Python SDK for Reportify API - Financial data and document search.

Installation

pip install reportify-sdk

Quick Start

from reportify_sdk import Reportify

# Initialize client
client = Reportify(api_key="your-api-key")

# Search documents
docs = client.search("Tesla earnings", num=10)
for doc in docs:
    print(doc["title"])

Features

Document Search

# General search across all categories
docs = client.search("revenue growth", num=10)

# Search specific document types
news = client.search_news("Apple iPhone", num=10)
reports = client.search_reports("semiconductor analysis", num=10)
filings = client.search_filings("10-K annual report", symbols=["US:AAPL"])
transcripts = client.search_transcripts("guidance", symbols=["US:TSLA"])

Stock Data (returns pandas DataFrame)

# Financial statements
income = client.stock.income_statement("AAPL", period="quarterly")
balance = client.stock.balance_sheet("AAPL")
cashflow = client.stock.cashflow_statement("AAPL")

# Stock quote (price data)
quote = client.stock.quote("AAPL", start_date="2024-01-01")

# Company info (symbols without market prefix)
overview = client.stock.overview(symbols="AAPL")
shareholders = client.stock.shareholders("AAPL")

# Earnings calendar
earnings = client.stock.earnings_calendar(market="us", start_date="2024-01-01", end_date="2024-01-31")

Timeline

# Get timeline for followed entities
companies = client.timeline.companies(num=20)
topics = client.timeline.topics(num=20)
institutes = client.timeline.institutes(num=20)
public_media = client.timeline.public_media(num=20)
social_media = client.timeline.social_media(num=20)

Knowledge Base

# Search user's uploaded documents
chunks = client.kb.search("quarterly revenue", folder_ids=["folder_id"])

Documents

# Get document content
doc = client.docs.get("doc_id")
summary = client.docs.summary("doc_id")

# List and search documents
docs = client.docs.list(symbols=["US:AAPL"], page_size=10)
chunks = client.docs.search_chunks("revenue breakdown", num=5)

# Upload documents
result = client.docs.upload([
    {"url": "https://example.com/report.pdf", "name": "Annual Report"}
])

Quant (Quantitative Analysis)

# Screen stocks by formula
stocks = client.quant.factors_screen(formula="RSI(14) < 30")
stocks = client.quant.factors_screen(formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))")

# Get OHLCV data
ohlcv = client.quant.ohlcv("000001", start_date="2024-01-01")
ohlcv_batch = client.quant.ohlcv_batch(["000001", "600519"])

# Backtest strategy
result = client.quant.backtest(
    start_date="2023-01-01",
    end_date="2024-01-01",
    symbols=["000001"],
    entry_formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))",
    exit_formula="CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))"
)
print(f"Total Return: {result['total_return_pct']:.2%}")
print(f"Sharpe: {result.get('sharpe_ratio', 0):.3f}")
print(f"Alpha/Beta: {result.get('alpha', 0):.3f}/{result.get('beta', 0):.3f}")

Concepts

# Get latest concepts
concepts = client.concepts.latest()
for c in concepts:
    print(c["concept_name"])

# Get today's concept feeds
feeds = client.concepts.today()

Channels

# Search channels
result = client.channels.search("Goldman Sachs")

# Get followed channels
followings = client.channels.followings()

# Follow/unfollow a channel
client.channels.follow("channel_id")
client.channels.unfollow("channel_id")

Chat

# Chat completion based on documents
response = client.chat.completion(
    "What are Tesla's revenue projections?",
    symbols=["US:TSLA"],
    mode="comprehensive"  # concise, comprehensive, deepresearch
)
print(response["message"])

Agent

# Create agent conversation
conv = client.agent.create_conversation()  # uses system default agent
# or specify agent_id: client.agent.create_conversation(agent_id=11887655289749510)

# Chat with agent
response = client.agent.chat(
    conversation_id=conv["id"],
    message="Analyze NVIDIA's latest earnings"
)

# Get agent-generated file
file_content = client.agent.get_file("file_id")
with open("output.xlsx", "wb") as f:
    f.write(file_content)

User

# Get followed companies
companies = client.user.followed_companies()
for company in companies:
    print(f"{company['symbol']}: {company['name']}")

Error Handling

from reportify_sdk import (
    Reportify,
    AuthenticationError,
    RateLimitError,
    NotFoundError,
    APIError,
)

try:
    docs = client.search("Tesla")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded, please wait")
except NotFoundError:
    print("Resource not found")
except APIError as e:
    print(f"API error: {e.message}")

Configuration

client = Reportify(
    api_key="your-api-key",
    base_url="https://api.reportify.cn",  # Optional: custom API URL
    timeout=30.0,  # Optional: request timeout in seconds
)

Context Manager

with Reportify(api_key="your-api-key") as client:
    docs = client.search("Tesla")
    # Client will be closed automatically

License

MIT License - see LICENSE for details.

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

reportify_sdk-0.3.59.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

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

reportify_sdk-0.3.59-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file reportify_sdk-0.3.59.tar.gz.

File metadata

  • Download URL: reportify_sdk-0.3.59.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reportify_sdk-0.3.59.tar.gz
Algorithm Hash digest
SHA256 044e9b78e065e7bbd135545c6c2080e339d1e0f8cb2d18252e7af7df436eca3d
MD5 ef594dff92952c249f1fa1fc4b23466f
BLAKE2b-256 ec7d25b3ba64c3bf5f14b52afe1d3b71b4542ad3a7e0338787dc4f40a8b0d2c7

See more details on using hashes here.

File details

Details for the file reportify_sdk-0.3.59-py3-none-any.whl.

File metadata

  • Download URL: reportify_sdk-0.3.59-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reportify_sdk-0.3.59-py3-none-any.whl
Algorithm Hash digest
SHA256 9e723c78ccdb23dcfff1f65ee4c3f2861cae7f65c4fc5fb2547deee2469ab719
MD5 621a3384ebdc60f48dbea20cd3f4b795
BLAKE2b-256 796405b0275a19fcd11bc9636ecd01c885f233604f82881084258dfbeaef9194

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