Skip to content

CLI & Python SDK (lopjlb)

lopjlb is a standalone Python/Typer client over HTTPS REST — no browser needed for public or freemium research, and full Pro/Enterprise workflows when LOPJLB_API_KEY is exported. Built for scripts and AI coding agents with structured JSON errors and stable exit codes.

Install

bash
uv tool install lopjlb
lopjlb --version

CLI command reference

bash
# Free (no key, no browser)
lopjlb ticker AAPL
lopjlb ticker AAPL intel
lopjlb ticker AAPL scores --as-of 2026-11-25
lopjlb regime
lopjlb regime-history
lopjlb pulse
lopjlb search NVDA --limit 10
lopjlb compare AAPL MSFT --range 5y
lopjlb options hold-spreads --limit 25
lopjlb universes spy25 --as-of 2025-01
lopjlb congress
lopjlb predict
lopjlb calendar earnings --days-ahead 14
lopjlb calendar econ
lopjlb treasuries
lopjlb hours
lopjlb sd50
lopjlb schema metrics            # 180 screener columns

# NLP Research desk (JSON envelope by default; --text prints clean markdown)
lopjlb ask "What does LOPJLB say about AAPL?"
lopjlb ask "Summarize SPY regime odds" --text

# Enterprise REST (after subscribing & minting key in Settings)
export LOPJLB_API_KEY=lopjlb_live_…
lopjlb screen --asset all --profile screener --limit 40
lopjlb peers AAPL
lopjlb sd50 allocation
lopjlb iexh --limit 40
lopjlb intraday AAPL
lopjlb export signals --out signals.csv
lopjlb export archive --source sd50 --month 2024_12

Python SDK (import lopjlb)

python
import lopjlb

# Module-level public helpers (no key needed)
regime = lopjlb.regime()
pulse = lopjlb.pulse()
hits = lopjlb.search("MSFT", limit=5)

# Ticker object (thin public teaser, detail/scores, earnings CallCard)
aapl = lopjlb.Ticker("AAPL", as_of="2026-11-25")
card = aapl.summary()
intel = aapl.intel()

# Client instance + Enterprise key
client = lopjlb.Client(api_key="lopjlb_live_…")
ask_res = client.ask("Compare AAPL and MSFT signals")
rows = client.universe_partition("stocks")

# Error handling
try:
    client.export_signals()
except lopjlb.LopjlbHTTPError as exc:
    print(exc.status_code, exc.error, exc.upgrade_url)

See every underlying endpoint in the Interactive API Reference →.

Agent contract & exit codes

Usage errors emit machine-readable JSON on stderr with exact exit codes so agent loops can branch cleanly without scraping text:

CodeMeaningAgent action
0SuccessParse stdout JSON
1Other HTTP error (e.g. 404, 422 no_vintage, 5xx)Inspect JSON error, withheld, retryable
2CLI usage / flag / invalid subarg errorFix command syntax or unsupported --as-of / key
3Authentication failure (401)Re-mint or verify LOPJLB_API_KEY in /settings
4Entitlement / plan required (402)Prompt user with upgrade_url or fall back to public routes
5Rate limited (429)Back off and retry (retryable: true)
6Network / TLS / timeout errorRetry with backoff (retryable: true)