tickerscope
Unofficial async Python client for the MarketSurge stock research API. Wraps the GraphQL endpoints with typed dataclass models and cookie-based auth.
Features
- Sync and async clients (
TickerScopeClient/AsyncTickerScopeClient) - Frozen dataclass models with JSON serialization
- Automatic JWT auth from browser cookies (Firefox/Chrome) via rookiepy
- Token expiry detection and structured error hierarchy
Installation
pip install tickerscope
Authentication
tickerscope authenticates by extracting cookies from your browser. Log into MarketSurge in Firefox or Chrome first, then:
from tickerscope import TickerScopeClient
# Reads cookies from Firefox by default
client = TickerScopeClient()
# Or specify Chrome
client = TickerScopeClient(browser="chrome")
You can also pass a JWT directly or set the TICKERSCOPE_JWT environment variable:
client = TickerScopeClient(jwt="your-jwt-token")
Usage
Sync client
from tickerscope import TickerScopeClient
with TickerScopeClient() as client:
stock = client.get_stock("AAPL")
print(stock.ratings.composite)
print(stock.pricing.price)
chart = client.get_chart_data(
"AAPL",
start_date="2025-01-01",
end_date="2025-03-01",
)
for point in chart.time_series.data_points[:5]:
print(point.close, point.volume)
Async client
import asyncio
from tickerscope import AsyncTickerScopeClient
async def main():
async with AsyncTickerScopeClient() as client:
stock = await client.get_stock("NVDA")
print(stock.company.name, stock.ratings.composite)
fundamentals = await client.get_fundamentals("NVDA")
for period in fundamentals.reported_earnings:
print(period.period_label, period.value)
asyncio.run(main())
Async client (fully async construction)
Use the create() factory for fully async initialization, including the auth
HTTP request:
async def main():
client = await AsyncTickerScopeClient.create()
try:
stock = await client.get_stock("TSLA")
print(stock.ratings)
finally:
await client.aclose()
Available methods
| Method | Returns | Description |
|---|---|---|
get_stock(symbol) |
StockData |
Ratings, pricing, financials, patterns |
get_chart_data(symbol, ...) |
ChartData |
OHLCV time series and quotes |
get_fundamentals(symbol) |
FundamentalData |
Earnings/sales reported and estimates |
get_ownership(symbol) |
OwnershipData |
Institutional fund ownership |
get_watchlist(list_id) |
list[WatchlistEntry] |
Screen a watchlist for stock data |
get_watchlist_names() |
list[WatchlistSummary] |
All user watchlists |
get_watchlist_symbols(id) |
WatchlistDetail |
Symbol keys in a watchlist |
get_watchlist_by_name(name) |
WatchlistDetail |
Look up watchlist by name |
get_screens() |
list[Screen] |
Saved stock screens |
get_screen_by_name(name) |
Screen |
Look up screen by name |
run_screen(name, params) |
ScreenResult |
Execute a stock screen |
get_active_alerts() |
AlertSubscriptionList |
Active alert subscriptions |
get_triggered_alerts() |
TriggeredAlertList |
Recently triggered alerts |
get_layouts() |
list[Layout] |
Saved chart layouts |
get_chart_markups(symbol) |
ChartMarkupList |
Chart annotations/markups |
Error handling
All exceptions inherit from TickerScopeError and include a to_dict() method
for structured error reporting:
from tickerscope import (
TickerScopeError,
AuthenticationError,
CookieExtractionError,
TokenExpiredError,
APIError,
SymbolNotFoundError,
)
try:
stock = client.get_stock("INVALID")
except SymbolNotFoundError as exc:
print(exc.symbol)
print(exc.to_dict())
except TokenExpiredError:
# Re-authenticate and retry
...
Development
Requires uv for dependency management:
uv sync --all-extras --dev
make lint # ruff check
make typecheck # ty check
make radon # cyclomatic complexity gate (A/B only)
make test # pytest with coverage
make ci # all of the above
License
MIT
Metadata
Release files for tickerscope 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tickerscope-0.3.0.tar.gz | 44.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tickerscope-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 99.8 kB
Release files / tickerscope-0.3.0.tar.gz
| Download URL | tickerscope-0.3.0.tar.gz |
|---|---|
| Size | 44.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63e4436244d6d1bc1bfc88cf44d060f3b7501f5e0de9005ecf80552ca033e4fc
|
|
BLAKE2b-256 checksum How to use checksums |
f3889706279866276dc13e20996da58c82cfdb2040e6e615717e7e95b6e11f96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.
Transparency logRelease files / tickerscope-0.3.0-py3-none-any.whl
| Download URL | tickerscope-0.3.0-py3-none-any.whl |
|---|---|
| Size | 54.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9383a88a065a9207381a2b3bf8c216965af38e279246d37ebffdc6cfd6c869a
|
|
BLAKE2b-256 checksum How to use checksums |
070c389525226222bbf1bddb7fc13cc8c6683b1dd9ec98a94e4c73ea8a96adfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.
Transparency log