polymarket-go

module
v0.2.0 Latest Latest
Warning

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

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

README ΒΆ

Polymarket SDK for 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
  • πŸ”Œ OmniAgent Integration - Compiled skill wrapper for embedding in omniagent-based agents

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  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  omniagent/skill/          Compiled skill for omniagent     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  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

OmniAgent Integration

Use polymarket-go as a compiled skill in omniagent-based agents:

import (
    "github.com/plexusone/omniagent/agent"
    predictskill "github.com/grokify/polymarket-go/omniagent/skill"
)

// Create and register the predictions skill
predictSkill := predictskill.New(predictskill.Config{})
commands.RegisterAgentOption(agent.WithCompiledSkill(predictSkill))

Tools provided:

Tool Description
get_markets Fetch active prediction markets with filters
get_orderbook Get order book for a market token

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.
polymarket-agent/cmd
Package cmd provides the CLI commands for polymarket-agent.
Package cmd provides the CLI commands for polymarket-agent.
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.
prompts
Package prompts provides prompt templates and agent execution for Polymarket trading.
Package prompts provides prompt templates and agent execution for Polymarket trading.
tools
Package tools provides Polymarket-specific tools for agents.
Package tools provides Polymarket-specific tools for agents.
omniagent
skill
Package skill provides an omniagent skill wrapper for polymarket-go.
Package skill provides an omniagent skill wrapper for polymarket-go.

Jump to

Keyboard shortcuts

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