G-Prophet Python SDK
Official Python client for G-Prophet, an auditable quantitative market research platform that turns market data and model outputs into reviewable research records.
G-Prophet produces research material. Its output is not personalised investment advice, a trading recommendation, or an instruction to buy, sell, or hold any instrument. The platform is built for research, model observation, and retrospective evaluation; historical results do not guarantee future performance.
Scope and data semantics
predict() and compare() return a model reference path: one reference price per market-local trading date, with uncertainty bounds tied to that same date. The path is not actual future OHLCV, and it is not a price forecast.
predicted_price is a field name kept for compatibility with existing API clients. It carries the same value as the last point's model_reference_price inside model_reference_path — a model reference value, not a predicted market price. direction and change_percent describe the shape of that reference path relative to the latest quote; neither is a trading signal. Use history() for observed historical OHLCV.
Installation
pip install gprophet
To also use the MCP Server (for AI agents like Claude, Kiro, etc.):
pip install "gprophet[mcp]"
The core HTTP SDK supports Python 3.8+. The MCP extra requires Python 3.10+.
Quick Start
from gprophet import GProphet, InsufficientPointsError
client = GProphet(api_key="gp_sk_your_key_here")
# Free planning check: reads live pricing from /info and the current balance.
# It does not reserve points, so the paid call can still return HTTP 402 later.
plan = client.preflight("quote", market="US")
print(plan) # ready plus point, scope, and daily/monthly quota checks
# Get a stock quote
if plan["ready"]:
try:
quote = client.quote("AAPL", market="US")
print(f"AAPL: ${quote['price']}")
except InsufficientPointsError as exc:
# Another concurrent call may have spent points after the preflight.
print(exc.to_dict())
# Daily model reference path: one reference price per market trading day
pred = client.predict("AAPL", market="US", days=7)
print(f"Model reference: ${pred['predicted_price']} ({pred['direction']})")
for point in pred["model_reference_path"]["points"]:
print(point["date"], point["model_reference_price"])
# CN/A-share model reference path can use G-Prophet2026V2, with V1 as fallback.
cn_pred = client.predict("600519", market="CN", days=7, algorithm="gprophet2026v2")
print(f"600519: ¥{cn_pred['predicted_price']} ({cn_pred['direction']})")
# Technical analysis
tech = client.technical("AAPL", market="US")
print(f"Indicator observation: {tech['overall_signal']}")
# Batch quotes
quotes = client.batch_quote(["AAPL", "GOOGL", "MSFT"], market="US")
for q in quotes["results"]:
if q["success"]:
print(f"{q['symbol']}: ${q['price']}")
# AI-assisted research report (async with auto-polling)
analysis = client.analyze_stock("AAPL", market="US", wait=True)
print(analysis["analysis"]["summary"])
# International markets: search first, then use the returned canonical symbol
results = client.search("HSBA", market="UK")
symbol = results["results"][0]["symbol"] # e.g. HSBA.LON
uk_pred = client.predict(symbol, market="UK", days=7)
# Japan and Korea examples
jp_pred = client.predict("7203.T", market="JP", days=7)
kr_pred = client.predict("005930.KS", market="KR", days=7)
Only public metadata is needed? GProphet().health() and GProphet().info() work without a key. Paid, account, and authenticated health methods still require one.
MCP Server (for AI Agents)
After installing with pip install gprophet[mcp], a gprophet-mcp command is available.
The MCP server may start without GPROPHET_API_KEY for the public
gprophet_health and gprophet_info tools. Protected tools then return a
structured MISSING_API_KEY error instead of preventing server startup.
See MCP Server documentation for setup details.
API Reference
System
client.health()— Public origin-reachability check (GET /health)client.auth_health()— Validate the API key/account and report quota counters and points for freeclient.prediction_health(market)— Check prediction scope, market, and one-run point affordability for freeclient.info()— API metadata, pricing, supported markets, currency, timezone, and market_details
Supported markets are US, CN, HK, JP, KR, CRYPTO, UK, CA, DE, and IN. Prefer client.info() as the source of truth instead of hard-coding this list.
The health methods do not run a model or deduct points.
Symbol notes:
- HK accepts bare digits, zero-padded codes, or
.HKsuffix.700,0700, and700.HKresolve to the same Hong Kong listing. - JP accepts bare or
.Tsymbols such as7203and7203.T; KR accepts 6-digit symbols with optional.KS/.KQsuffixes such as005930.KSand035420.KQ. - UK is the official market code for UK stocks. Do not use
GBorLSEas themarket; use symbols such asHSBA.LON. - For AI agents and automation, call
client.search(...)first when the ticker is uncertain, then callpredict(...)with the returned canonicalsymbol.
Account
client.balance()— Points balance and quota infoclient.usage(days=7)— Usage statisticsclient.estimate_cost(operation, market, count)— Estimate cost from the/infopricing table (cached for up to five minutes by default)client.preflight(operation, market, count)— Refresh pricing and evaluate known point, scope, and quota gates without spending or reserving pointsclient.check_points(required)— Check a known point requirement against the current balanceclient.ensure_points(required)— Raise a structuredInsufficientPointsErrorif the balance is too low
Preflight is intentionally explicit rather than automatic on every paid method. This avoids an extra network round trip when the caller does not need it. It refreshes /info pricing by default; pass refresh_pricing=False only when pricing cached for up to five minutes is acceptable. For compare, omitting count uses the SDK's default model count (CN 5, other markets 4); for batch_quote, pass the exact symbol count. Treat the result as planning information, not a reservation of points or a rate-limit slot; always handle a later HTTP 402/429 from the paid call.
Model reference path
client.predict(symbol, market, days, algorithm)— Daily model reference path plus summary fieldsclient.compare(symbol, market, days, algorithms)— Multi-algorithm summary comparison with currency/timezone; no per-algorithm path
predict() returns currency, IANA timezone, and model_reference_path.points with date-aligned uncertainty bounds. predicted_price is the path's final model_reference_price under the field name existing clients already read; treat it as a model reference value, not a predicted market price or price target. uncertainty.confidence_level is a model-reported score, not nominal coverage; do not interpret it as a calibrated “95% confidence interval.” The path is not actual future OHLCV. Use history() for observed historical OHLCV. Every paid prediction response also repeats this framing in a top-level research_disclaimer field.
Supported model algorithms include auto, gprophet2026v1, gprophet2026v2 (CN/A-shares only), lstm, transformer, random_forest, and ensemble.
For client.compare(...), the default CN algorithm list includes gprophet2026v2; other markets do not expose V2.
Market Data
client.quote(symbol, market)— Latest available quote with currency/timezoneclient.batch_quote(symbols, market)— Batch quotes with currency/timezoneclient.history(symbol, market, period)— Observed historical OHLCV with currency/timezoneclient.search(keyword, market, limit)— Search symbols with market currency/timezone
Technical Analysis
client.technical(symbol, market, indicators)— Technical indicators and observations; defaults to RSI, MACD, Bollinger, KDJ, SMA, and EMA
Sentiment
client.fear_greed(days)— Crypto Fear & Greed Indexclient.market_overview(market)— Market overview
Analysis
client.analyze_stock(symbol, market, locale, callback_url, wait)— AI-assisted research report (58 pts)client.analyze_comprehensive(symbol, market, locale, callback_url, wait)— Multi-agent, multi-factor research review (150 pts)client.task_status(task_id)— Check async task status
Both analysis methods accept an optional callback_url. It must be a public
HTTPS URL without user information and must not use localhost or a
private/reserved IP literal. It is limited to 2048 characters and cannot
contain backslashes, control characters, or an explicit port 0. The SDK
rejects invalid callbacks before sending the paid request. The API may
additionally return VALIDATION_ERROR (HTTP 422) after server-side safety
checks; correct the URL rather than retrying it unchanged. When wait=True,
poll_interval and max_wait must
both be positive finite numbers.
After an analysis task has been created, polling failures never make the paid
analysis call itself retryable. The raised error includes task_id,
poll_retryable, and an agent_action directing callers to continue only with
client.task_status(task_id); do not resubmit the analysis automatically.
Error Handling
from gprophet import (
GProphet,
GProphetError,
InsufficientPointsError,
RateLimitError,
)
client = GProphet(api_key="gp_sk_...")
try:
result = client.predict("AAPL", market="US")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
except InsufficientPointsError as e:
print(f"Need {e.required} points, have {e.available}, shortage {e.shortage}")
# retryable is False: add points before retrying the paid call.
except GProphetError as e:
print(e.to_dict())
The SDK automatically retries only transient RATE_LIMITED responses. It does not retry INSUFFICIENT_POINTS or QUOTA_EXCEEDED. A timeout or malformed gateway response from a paid endpoint is also marked non-retryable because the server may already have consumed points; check usage, balance, or task state before deciding what to do. Downstream agents should follow the structured retryable and agent_action fields.
Configuration
client = GProphet(
api_key="gp_sk_...",
base_url="https://www.gprophet.com/api/external/v1", # Custom base URL
timeout=120, # Request timeout (seconds); recommended for DE/IN and other slower international markets
max_retries=3, # Auto-retry only transient RATE_LIMITED responses
)
License
MIT
Metadata
Release files for gprophet 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| gprophet-0.2.0.tar.gz | 34.7 kB | Without provenance | Details for gprophet-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gprophet-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for gprophet-0.2.0-py3-none-any.whl |
Total release size: 60.5 kB
Release files / gprophet-0.2.0.tar.gz
| Download URL | gprophet-0.2.0.tar.gz |
|---|---|
| Size | 34.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff64428bf8479c323b378ba3e7dbde0fcd51d0eb0d2d45e76c0a6623d9453dd6
|
|
BLAKE2b-256 checksum How to use checksums |
15c842eda869db19e4b2a647be4a48ff6ef7fd01d2c3d35b15a6209577db3bc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / gprophet-0.2.0-py3-none-any.whl
| Download URL | gprophet-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b72bcda198c4e093e2664d6154ec89f48fe53bee75a66fe2f7b8e10ae59910d
|
|
BLAKE2b-256 checksum How to use checksums |
c0912725ca4a3bc4b0c23581990c1e045ebee4ad8114197f59c2926173d18a24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for gprophet 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.