vike

Recipe 20 of 30

Telegram alert bot for Polymarket markets I follow

Poll /events with event_type=trade for the tokens you follow, each window starting where the last one ended and ending a minute behind the clock, and forward each new print to Telegram yourself.

There is no push channel for Polymarket prints, so the bot polls GET /v1/polymarket/events with event_type=trade: one call returns the prints of the tokens it follows over [from_ms, to_ms). Make from_ms the previous call's to_ms and to_ms the clock minus one minute; windows are half-open, so no print comes twice. Your code sends each row with Telegram's sendMessage and stores to_ms for the next poll. The full parameter list is on Event tape.

Quick answer

One poll asks for the prints of both tokens of a market over the last window.

cURL
# one poll: the prints of both tokens of the live 5-minute BTC market over a two-minute window
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/events?token_ids=81867584374175372880457777566079013621273238304582319385248599876669556228508,62425621073503465111538809206737425389291240653177818813865255723335634930011&event_type=trade&from_ms=1792862388652&to_ms=1792862508652&limit=1000"

Example response

Captured from the live API on 2026-10-24 at 17:21 UTC, trimmed to the last 3 of 410 prints. The market btc-updown-5m-1792862400 printed 410 times in those two minutes. A message needs token_id (which outcome), side (the taker's side), price (the probability paid) and size (shares); has_more false means the window is complete.

Example response
{
  "events": [
    {
      "asks": "",
      "best_ask": 0.0,
      "best_bid": 0.0,
      "bids": "",
      "event_type": "trade",
      "is_snapshot": 0,
      "local_ts": 1792862503391,
      "price": 0.19,
      "seq": 0,
      "side": "buy",
      "size": 5.263158,
      "status": "",
      "token_id": "62425621073503465111538809206737425389291240653177818813865255723335634930011",
      "ts": 1792862503378
    },
    {
      "asks": "",
      "best_ask": 0.0,
      "best_bid": 0.0,
      "bids": "",
      "event_type": "trade",
      "is_snapshot": 0,
      "local_ts": 1792862503671,
      "price": 0.82,
      "seq": 0,
      "side": "buy",
      "size": 6.097561,
      "status": "",
      "token_id": "81867584374175372880457777566079013621273238304582319385248599876669556228508",
      "ts": 1792862503659
    },
    {
      "asks": "",
      "best_ask": 0.0,
      "best_bid": 0.0,
      "bids": "",
      "event_type": "trade",
      "is_snapshot": 0,
      "local_ts": 1792862504149,
      "price": 0.81,
      "seq": 0,
      "side": "sell",
      "size": 0.01,
      "status": "",
      "token_id": "81867584374175372880457777566079013621273238304582319385248599876669556228508",
      "ts": 1792862504133
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Variations

The token ids of a market you follow. Search the slug; token_ids lists the tokens in the order of the market's outcomes.

cURL — token ids
# the current 5-minute BTC market and its two tokens
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/markets?query=btc-updown-5m-1792862400&limit=1"

Only the big prints. Filter on the dollar value of each print before you send it.

cURL — $100 and up
# prints worth $100 or more in the window
curl -s -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/events?token_ids=81867584374175372880457777566079013621273238304582319385248599876669556228508,62425621073503465111538809206737425389291240653177818813865255723335634930011&event_type=trade&from_ms=1792862388652&to_ms=1792862508652&limit=1000" \
  | jq -c '.events[] | select(.price * .size >= 100) | {token_id, side, price, size}'

Tell the chat how it ended. Once the market resolves on chain, one call gives the winner to post.

cURL — result
# the on-chain result of the market the bot was following
curl -H "X-API-Key: $VIKE_API_KEY" \
  "https://data.vike.io/v1/polymarket/settlements/0x108a1e2e1747c01d6d64330e9b3c4091a910aa9315f96cc7d887f5bb84332df0"

Before you rely on it

It is polling, and the tape trails the clock

The bot asks; nothing is pushed. Prints reach the API in batches: in our capture the newest rows were up to about 15 seconds behind the clock, so a window ending at the current time can miss a print that lands a moment later. End each window a minute back and start the next exactly where it ended. A window is at most 24 hours, so a bot that was down longer catches up in steps.

One call for every market you follow

token_ids takes up to 100 tokens, so one poll covers 50 binary markets. A poll every 10 seconds is 360 requests an hour, well inside the 20,000 an hour and 200 a minute your key allows.

Ask your agent

Connected to the Vike MCP server (https://vike.io/mcp) in Claude, ChatGPT or Cursor, ask it in plain words. The polymarket_tape tool answers once, at 1 credit a call. The bot is your own loop.

Ask your agent
What trades printed on the current 5-minute BTC Up or Down market on Polymarket in the last two minutes?
Example response
{  "events": [    {      "asks": "",      "best_ask": 0.0,      "best_bid": 0.0,      "bids": "",      "event_type": "trade",      "is_snapshot": 0,      "local_ts": 1792862503391,      "price": 0.19,      "seq": 0,      "side": "buy",      "size": 5.263158,      "status": "",      "token_id": "62425621073503465111538809206737425389291240653177818813865255723335634930011",      "ts": 1792862503378    },    {      "asks": "",      "best_ask": 0.0,      "best_bid": 0.0,      "bids": "",      "event_type": "trade",      "is_snapshot": 0,      "local_ts": 1792862503671,      "price": 0.82,      "seq": 0,      "side": "buy",      "size": 6.097561,      "status": "",      "token_id": "81867584374175372880457777566079013621273238304582319385248599876669556228508",      "ts": 1792862503659    },    {      "asks": "",      "best_ask": 0.0,      "best_bid": 0.0,      "bids": "",      "event_type": "trade",      "is_snapshot": 0,      "local_ts": 1792862504149,      "price": 0.81,      "seq": 0,      "side": "sell",      "size": 0.01,      "status": "",      "token_id": "81867584374175372880457777566079013621273238304582319385248599876669556228508",      "ts": 1792862504133    }  ],  "has_more": false,  "next_cursor": null}