Skip to main content

Python SDK

Install:

pip install gfin

Create a client:

from gfin import Client

client = Client(contact="you@example.com")

Core Calls

search = client.search("apple")
research = client.research("Why is AAPL moving today?")
summary = client.quote_summary("AAPL", exchange="NASDAQ")
financials = client.quote_financials("AAPL", exchange="NASDAQ")
news = client.news(limit=5)
markets = client.market_summary()

Quote Views

client.quote_summary("AAPL", exchange="NASDAQ")
client.quote_details("AAPL", exchange="NASDAQ")
client.quote_entity_details("AAPL", exchange="NASDAQ")
client.quote_history("AAPL", exchange="NASDAQ")
client.quote_financials("AAPL", exchange="NASDAQ")
client.quote_earnings("AAPL", exchange="NASDAQ")
client.quote_related("AAPL", exchange="NASDAQ")
client.quote_sentiment("AAPL", exchange="NASDAQ")

Or choose a view dynamically:

client.quote("AAPL", view="summary", exchange="NASDAQ")
client.quote_view("AAPL", "earnings", exchange="NASDAQ")

Realtime Routes

client.realtime_snapshots(["/m/0cqyw", "/m/016yss"])
client.realtime_trend_lines(["/m/0cqyw", "/m/016yss"])

Configuration

client = Client(
base_url="https://api.gfin.dev",
contact="you@example.com",
api_key="gfin_...",
timeout=10.0,
)

Environment variables are also supported:

export GFIN_BASE_URL=https://api.gfin.dev
export GFIN_CONTACT=you@example.com
export GFIN_API_KEY=gfin_...

Errors

from gfin import Client, GfinError, GfinRateLimitError

client = Client(contact="you@example.com")

try:
client.research("Why is AAPL moving today?")
except GfinRateLimitError:
print("retry after the rate-limit window")
except GfinError as exc:
print("request failed", exc)

The SDK is intentionally thin: it preserves the REST response envelope and keeps decoded payloads under data without exposing source endpoint identifiers.