Skip to main content

tgtc-sdk (Python)

中文

Official Python client for the TGTC data API. One line of code gets you BSC token intel — quotes, holders, security audit, socials, smart-money moves, wallets, tweets and more.

Transparent billing: every call returns your remaining calls and the units this request cost.

Install

pip install tgtc-sdk

Requires Python 3.9+ (dependency: requests).

You'll need an API Key (TGTC Bot profile center → My API).

Quick start

from tgtc import TGTC

client = TGTC(api_key="your-api-key")

# Token aggregation (full product categories by default)
res = client.token("0x...contract address")

print(res.symbol)          # token symbol
print(res.price)           # current price
print(res.remaining)       # remaining calls
print(res.used)            # units this request cost

Endpoints

Method Endpoint What you get
token(ca, categories=..., fields=...) POST /api/v1/aggregation/token Full token intel: quotes / structure / security / holders / socials / smart money
trending(kind="new", limit=20) POST /api/v1/token/trending Newly created / launched / graduating tokens
hot(interval="1h", limit=50) POST /api/v1/token/hot Hot search rankings
trades(actor="smartmoney", side=..., limit=50) POST /api/v1/track/trades Smart-money / KOL live trades
signals(signal_types=[20], limit=50) POST /api/v1/market/signals Market signals (new listings, anomalies, smart-money behavior)
wallet(action, wallet, period="7d", ...) POST /api/v1/wallet/{action} Wallet analysis: profile / stats / profits / activity / created / balance
twitter(action, username=..., ...) POST /api/v1/twitter/{action} Twitter: user.info / tweets / timeline / followers / search / tweet.*
sentiment(ca) POST /api/v1/twitter/sentiment CA sentiment: heat rating + AI insight + mentions
translate(action, text) POST /api/v1/translate/{action} AI translate / summarize (outputs Chinese)

Examples

# Token rankings — newly launched
for item in client.trending(kind="launch", limit=10).data.get("items", []):
    print(item.get("symbol"), item.get("price"))

# Smart-money buy trades
for t in client.trades(actor="smartmoney", side="buy", limit=10).data.get("items", []):
    print(t.get("token"), t.get("price"))

# Wallet profile
w = client.wallet("profile", wallet="0x...wallet")
print(w.data.get("pnl_7d"), w.remaining)

# CA sentiment
s = client.sentiment("0x...contract")
print(s.data.get("heat_tier"))

# Translate
r = client.translate("translate", text="gm everyone")
print(r.data.get("text"))

Every endpoint accepts optional fields=[...] to trim the response (and pay less for less).

Billing transparency

Field Meaning
remaining Remaining calls after this request
used Units this request cost (0 on cache hit)
cache_hit True if served from cache (no charge)
delay_sec Data freshness (0 = live)

Error handling

from tgtc import TGTCError, TGTCQuotaError, TGTCAuthError

try:
    res = client.token(ca)
except TGTCAuthError:
    print("invalid API key")
except TGTCQuotaError as e:
    print(f"out of calls — remaining {e.remaining}, please top up")
except TGTCError as e:
    print("request failed:", e)
Exception When
TGTCAuthError Missing / invalid API Key
TGTCParamError Bad parameters (CA format / category combos)
TGTCNotFoundError Token data not found
TGTCQuotaError Out of calls (e.remaining shows what's left — top up)
TGTCUnavailableError Service starting up or in maintenance
TGTCServerError Server error (raised after automatic retries)

Retry policy

  • 5xx / network errors: automatic exponential backoff with jitter (default up to 2 retries), raised as TGTCServerError after exhausting retries
  • 429 (out of calls): no retry — it would never succeed; raises TGTCQuotaError with remaining calls
  • 400 / 422 / 404: no retry (client or data issue)

Customize: TGTC(api_key=..., max_retries=3, retry_backoff=0.5). Timeout defaults to (3.05s connect, 30s read) — half-open connections fail fast instead of hanging.

Development

Run the test suite: python -m pytest tests/ -v (or python tests/test_client.py).

Docs

Full API reference: TGTC API Docs

Metadata

Release files for tgtc-sdk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tgtc-sdk 0.2.1
File Size Uploaded
tgtc_sdk-0.2.1.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tgtc-sdk 0.2.1
File Interpreter ABI Platform
tgtc_sdk-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / tgtc_sdk-0.2.1.tar.gz

Download URL tgtc_sdk-0.2.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
81b585057d7a6dc0ec1d26ea127c1a8990d207344aea33aba4f23417a67996f0
BLAKE2b-256 checksum
How to use checksums
14efdbc8bc5079919ab5ae03eb8e8056930cd99c1364ef53e1a7e9220a874b9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / tgtc_sdk-0.2.1-py3-none-any.whl

Download URL tgtc_sdk-0.2.1-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
945e2adbac334f7e80935af9948d982f53693b076ac3a60268c06203c1b7a9e5
BLAKE2b-256 checksum
How to use checksums
826590399da5f450035272ba4cbd6e16e88833366363afe9aa2e3984a0ecb75a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release history Release notifications | RSS feed

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page