Official Python SDK for the G-Prophet AI Stock Prediction API
Project description
G-Prophet Python SDK
Official Python client for the G-Prophet AI Stock Prediction API.
Installation
pip install gprophet
To also use the MCP Server (for AI agents like Claude, Kiro, etc.):
pip install gprophet[mcp]
Quick Start
from gprophet import GProphet
client = GProphet(api_key="gp_sk_your_key_here")
# Check balance
print(client.balance())
# Get a stock quote
quote = client.quote("AAPL", market="US")
print(f"AAPL: ${quote['price']}")
# AI prediction
pred = client.predict("AAPL", market="US", days=7)
print(f"Predicted: ${pred['predicted_price']} ({pred['direction']})")
# CN/A-share prediction uses G-Prophet2026V2 in auto mode, 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"Signal: {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 stock analysis (async with auto-polling)
analysis = client.analyze_stock("AAPL", market="US", wait=True)
print(analysis["analysis"]["summary"])
MCP Server (for AI Agents)
After installing with pip install gprophet[mcp], a gprophet-mcp command is available.
See MCP Server documentation for setup details.
API Reference
System
client.health()— Health checkclient.info()— API metadata, pricing, supported markets
Account
client.balance()— Points balance and quota infoclient.usage(days=7)— Usage statistics
Predictions
client.predict(symbol, market, days, algorithm)— AI price predictionclient.compare(symbol, market, days, algorithms)— Multi-algorithm comparison
Supported prediction 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)— Real-time quoteclient.batch_quote(symbols, market)— Batch quotesclient.history(symbol, market, period)— Historical OHLCVclient.search(keyword, market, limit)— Search symbols
Technical Analysis
client.technical(symbol, market, indicators)— Technical indicators & signals
Sentiment
client.fear_greed(days)— Crypto Fear & Greed Indexclient.market_overview(market)— Market overview
Analysis
client.analyze_stock(symbol, market, locale, wait)— AI stock analysis (58 pts)client.analyze_comprehensive(symbol, market, locale, wait)— Multi-agent analysis (150 pts)client.task_status(task_id)— Check async task status
Error Handling
from gprophet import GProphet
from gprophet.client import GProphetError, RateLimitError, InsufficientPointsError
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}")
except GProphetError as e:
print(f"API error [{e.code}]: {e.message}")
Configuration
client = GProphet(
api_key="gp_sk_...",
base_url="https://www.gprophet.com/api/external/v1", # Custom base URL
timeout=60, # Request timeout (seconds)
max_retries=3, # Auto-retry on rate limit
)
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gprophet-0.1.4.tar.gz.
File metadata
- Download URL: gprophet-0.1.4.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db5ee8ad0bd06b0c9126518319944bbe76dbbfda839ed802d218cdf81ba56345
|
|
| MD5 |
6dc0809049fb83d6e1799c59cef9b7d6
|
|
| BLAKE2b-256 |
b1b30127c864f255cbd24b3139fb46e106cd46203318e8c1b8b8d0f330aba3d5
|
File details
Details for the file gprophet-0.1.4-py3-none-any.whl.
File metadata
- Download URL: gprophet-0.1.4-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
566a167a8fe124581333da17158a3f1fda5da1dd1ca2a77a391f947e75dd73cb
|
|
| MD5 |
29dcf430e6dbc577c37b2a536eaf153a
|
|
| BLAKE2b-256 |
6cedecb1122307c201f1cf9e049fdd18ce042d371b4152a14468a4943d5a472c
|