Skip to main content

Signature

client.get_ticker(token_id: str) -> Dict

Parameters

token_id
string
required
The outcome token ID to get pricing for.

Returns

FieldTypeDescription
token_idstringThe token ID
last_pricefloat or NoneLast traded price (None if unavailable)
midpointfloat or NoneMidpoint between best bid and ask (None if order book unavailable)
best_bidfloat or NoneBest (highest) bid price (None if no bids)
best_askfloat or NoneBest (lowest) ask price (None if no asks)
All price fields may be None if market data is temporarily unavailable. Always check for None values before using.

Why Use This Over Polymarket’s Gamma API?

Polymarket’s Gamma API only returns last_price—the most recent trade price. This can be stale on low-volume markets or misleading if the last trade was a one-off. get_ticker() combines two data sources in a single call:
FieldSourceWhy It Matters
last_priceGamma APIHistorical reference
best_bid / best_askLive CLOB order bookReal liquidity you can trade against
midpointCalculated from bid/askMore accurate fair value than last trade
This means you get:
  • Real-time order book depth — see actual prices you can buy/sell at right now
  • Automatic fallback — if Gamma is slow, falls back to CLOB data
  • Better fair value — midpoint reflects current market, not last trade

Example

from polyhush import PolyhushClient

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

ticker = client.get_ticker(token_id="12345678901234567890")

# Always check for None values
if ticker['last_price'] is not None:
    print(f"Last Trade: ${ticker['last_price']:.2f}")
else:
    print("Last price unavailable")

if ticker['best_bid'] and ticker['best_ask']:
    print(f"Bid/Ask: ${ticker['best_bid']:.2f} / ${ticker['best_ask']:.2f}")
    print(f"Midpoint: ${ticker['midpoint']:.2f}")
else:
    print("Order book data unavailable")

# Use best_bid/best_ask to place orders that will fill
spread = ticker['best_ask'] - ticker['best_bid']
if spread > 0.05:
    # Wide spread - use limit order inside the spread
    price = ticker['best_bid'] + 0.01
    client.buy(token_id=token_id, shares=10, price=price)
else:
    # Tight spread - market order is fine
    client.buy(token_id=token_id, shares=10, order_type="FAK")
Use midpoint for P&L calculations and fair value. Use best_bid/best_ask to estimate actual execution prices.