polymarket-go

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: MIT

README ΒΆ

polymarket-go

Go CI Go Lint Go SAST Go Report Card Docs Visualization License

Go SDK for building AI trading agents on Polymarket prediction markets.

Features

  • πŸ“Š Polymarket API Client - Full client for Gamma (markets) and CLOB (trading) APIs
  • πŸ€– Multi-Agent Workflows - Define agent teams using multi-agent-spec format
  • 🧠 LLM Integration - Works with any LLM via omnillm + LangChainGo
  • πŸš€ Portable Specs - Same agent definitions deploy to Claude Code, Go servers, or Kubernetes

Installation

go get github.com/grokify/polymarket-go

Quick Start

Run the Demo

Fetch live market data from Polymarket:

go run ./cmd/polymarket-agent/ --demo --demo-limit=10

Output:

level=INFO msg="market 1" question="Will Panama win the 2026 FIFA World Cup?" liquidity=$4007373 ...
level=INFO msg="market 2" question="Will Haiti win the 2026 FIFA World Cup?" liquidity=$3860101 ...
Use the Polymarket Client
import "github.com/grokify/polymarket-go/internal/polymarket"

client := polymarket.NewClient()

// Fetch active markets
markets, err := client.GetMarkets(ctx, polymarket.GetMarketsParams{
    Active: &active,
    Limit:  10,
    Order:  "liquidity",
})

// Get order book for a token
book, err := client.GetOrderBook(ctx, tokenID)

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  polymarket-go                                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  cmd/polymarket-agent/     CLI for running agent workflows  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  agents/specs/             Multi-agent-spec definitions     β”‚
β”‚  β”œβ”€β”€ agents/               Agent markdown files             β”‚
β”‚  β”œβ”€β”€ team.json             Workflow configuration           β”‚
β”‚  └── deployment-*.json     Platform-specific configs        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  internal/                                                  β”‚
β”‚  β”œβ”€β”€ polymarket/           Polymarket API client            β”‚
β”‚  β”œβ”€β”€ loader/               Spec file parsers                β”‚
β”‚  β”œβ”€β”€ executor/             Workflow execution engine        β”‚
β”‚  └── tools/                Agent tools for Polymarket       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  omnillm-langchaingo       LangChainGo adapter              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  omnillm-core              Unified LLM provider abstraction β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Agent Team

The default trading team consists of three agents in a graph workflow:

Agent Role Model
market-analyst Discovers trading opportunities sonnet
superforecaster Generates probability estimates sonnet
trader Executes trades based on analysis haiku

Workflow: discover β†’ forecast β†’ execute

Agent Specs

Agents are defined in markdown with YAML frontmatter:

---
name: market-analyst
model: sonnet
tools: [WebSearch, WebFetch, Read, Write]
role: Market Research Analyst
goal: Identify mispriced markets with >10% expected edge
---

You are a market analyst specializing in Polymarket...

Deployment Targets

The same agent specs can deploy to multiple platforms:

Platform Config File Use Case
Go Server deployment-go-server.json Production trading
Claude Code deployment-claude-code.json Development/testing

Dependencies

Documentation

License

MIT License - see LICENSE for details.

Directories ΒΆ

Path Synopsis
cmd
polymarket-agent command
Command polymarket-agent runs Polymarket trading agents.
Command polymarket-agent runs Polymarket trading agents.
internal
executor
Package executor provides workflow execution for multi-agent-spec teams.
Package executor provides workflow execution for multi-agent-spec teams.
loader
Package loader provides loading of multi-agent-spec definitions.
Package loader provides loading of multi-agent-spec definitions.
polymarket
Package polymarket provides a Go client for Polymarket APIs.
Package polymarket provides a Go client for Polymarket APIs.
tools
Package tools provides Polymarket-specific tools for agents.
Package tools provides Polymarket-specific tools for agents.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL