Polymarket.Client 0.1.0

dotnet add package Polymarket.Client --version 0.1.0
                    
NuGet\Install-Package Polymarket.Client -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Polymarket.Client" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Polymarket.Client" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Polymarket.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Polymarket.Client --version 0.1.0
                    
#r "nuget: Polymarket.Client, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Polymarket.Client@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Polymarket.Client&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Polymarket.Client&version=0.1.0
                    
Install as a Cake Tool

Polymarket.Client

English | 中文 | 日本語 | Français


Polymarket.Client is a .NET SDK for the Polymarket CLOB and Gamma APIs.

The current SDK covers the main CLOB client surface and the public Gamma content/discovery surface:

  • public health, version, time, markets, order books, price, spread, trade price, and price history endpoints
  • public Gamma status, teams, tags, events, markets, series, comments, profiles, sports, and search endpoints
  • websocket sessions for market, user, and sports channels via ClobWebSocketClient
  • L1 wallet auth for API key creation/derivation
  • L2 HMAC auth for account, trades, notifications, balance allowance, rewards, builder API keys, and order endpoints
  • V1/V2 order creation, market order creation, posting, cancellation, scoring, and order book hashing
  • chain-aware exchange contract resolution for Polygon and Amoy

Project layout

  • src/Polymarket.Client - core SDK package
  • tests/Polymarket.Client.Tests - xUnit test suite
  • examples/Polymarket.Client.ConsoleApp - minimal console sample

Build and test

dotnet restore Polymarket.Client.slnx
dotnet build Polymarket.Client.slnx --configuration Release --no-restore
dotnet test tests\Polymarket.Client.Tests\Polymarket.Client.Tests.csproj --configuration Release

Run a single test:

dotnet test tests\Polymarket.Client.Tests\Polymarket.Client.Tests.csproj --filter "FullyQualifiedName~Polymarket.Client.Tests.ClobClientTests.GetVersionAsync_ReturnsVersionFromPayload"

Example

using Polymarket.Client;

await using ClobClient client = new(Chain.Polygon);

int version = await client.GetVersionAsync();
long serverTime = await client.GetServerTimeAsync();
PaginationPayload<Market> markets = await client.GetMarketsAsync(new MarketQueryParameters
{
    NextCursor = PolymarketConstants.InitialCursor,
    Limit = 20,
});
OrderBookSummary book = await client.GetOrderBookAsync("TOKEN_ID");

Gamma usage:

using Polymarket.Client;

await using GammaClient gammaClient = new();

string status = await gammaClient.GetStatusAsync();
IReadOnlyList<GammaMarket> gammaMarkets = await gammaClient.GetMarketsAsync(new GammaMarketQueryParameters
{
    Limit = 20,
    Closed = false,
    IncludeTag = true,
});

GammaSearchResponse search = await gammaClient.PublicSearchAsync(new GammaPublicSearchQueryParameters
{
    Query = "election",
    SearchTags = true,
    SearchProfiles = true,
});

WebSocket usage:

using Polymarket.Client;

ClobWebSocketClient webSocketClient = new();

await using ClobMarketWebSocketSession session = await webSocketClient.ConnectMarketAsync(
    new ClobMarketSubscriptionRequest
    {
        AssetIds = ["YES_TOKEN_ID", "NO_TOKEN_ID"],
        InitialDump = true,
        Level = ClobMarketSubscriptionLevel.Level2,
        CustomFeatureEnabled = true,
    });

await foreach (ClobMarketChannelMessage message in session.ReadAllAsync())
{
    Console.WriteLine(message.EventType);
}

Authenticated usage:

using Polymarket.Client;

ClobClientOptions options = new()
{
    Chain = Chain.Polygon,
    PrivateKey = Environment.GetEnvironmentVariable("POLYMARKET_PRIVATE_KEY"),
    Credentials = new ApiCredentials(
        Environment.GetEnvironmentVariable("POLYMARKET_API_KEY")!,
        Environment.GetEnvironmentVariable("POLYMARKET_API_SECRET")!,
        Environment.GetEnvironmentVariable("POLYMARKET_API_PASSPHRASE")!),
    UseServerTime = true,
};

await using ClobClient authedClient = new(options);

SignedOrderBase order = await authedClient.CreateOrderAsync(
    new OrderArguments("TOKEN_ID", 0.45m, 10m, Side.Buy),
    new PartialCreateOrderOptions("0.01", false));

JsonElement postResult = await authedClient.PostOrderAsync(order);

Notes

  • Package ID: Polymarket.Client
  • Target framework: .NET 10
  • Naming follows .NET conventions while keeping the official SDK surface recognizable
  • ClobClient targets trading/CLOB endpoints, while GammaClient targets catalog/content endpoints
  • ClobWebSocketClient targets realtime market, user, and sports websocket sessions
  • HttpClient is injectable for tests and custom hosting scenarios

Console sample

The console sample now demonstrates Gamma discovery + CLOB websocket streaming for the latest BTC 5-minute market:

dotnet run --project examples\Polymarket.Client.ConsoleApp\Polymarket.Client.ConsoleApp.csproj
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 124 4/24/2026