polymarketdata

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 9 Imported by: 0

README

Polymarket Go Data Client

A comprehensive Go SDK for the Polymarket Data API. This client library provides easy access to market data, user positions, trading activity, and more.

Features

  • ✅ Complete API coverage for all Polymarket Data endpoints
  • ✅ Type-safe with proper decimal handling using shopspring/decimal
  • ✅ Comprehensive error handling
  • ✅ Full test coverage
  • ✅ Production-ready examples for trading strategies

Installation

go get github.com/ivanzzeth/polymarket-go-data-client

Quick Start

package main

import (
    "context"
    "fmt"
    "net/http"

    polymarketdata "github.com/ivanzzeth/polymarket-go-data-client"
)

func main() {
    // Create client
    client, err := polymarketdata.NewClient(&http.Client{})
    if err != nil {
        panic(err)
    }

    ctx := context.Background()

    // Check API health
    health, err := client.HealthCheck(ctx)
    if err != nil {
        panic(err)
    }
    fmt.Printf("API Status: %s\n", health.Data)

    // Get user positions
    positions, err := client.GetPositions(ctx, &polymarketdata.GetPositionsParams{
        User:  "0x56687bf447db6ffa42ffe2204a05edaa20f55839",
        Limit: 10,
    })
    if err != nil {
        panic(err)
    }

    for _, pos := range positions {
        fmt.Printf("Market: %s | PnL: %s\n", pos.Title, pos.CashPnl.String())
    }
}

API Documentation

Available Methods
Health & Status
  • HealthCheck() - Check API availability
Positions
  • GetPositions(params) - Get current user positions
  • GetClosedPositions(params) - Get historical closed positions
  • GetPositionsValue(params) - Get total position value
Trading
  • GetTrades(params) - Get trade history
  • GetTradedMarketsCount(params) - Get count of markets traded
Activity
  • GetActivity(params) - Get user activity (trades, splits, merges, etc.)
Market Data
  • GetHolders(params) - Get top token holders
  • GetOpenInterest(params) - Get market open interest
  • GetLiveVolume(params) - Get live trading volume
Example Usage
ctx := context.Background()

// Get recent trades for a market
trades, err := client.GetTrades(ctx, &polymarketdata.GetTradesParams{
    Market: []string{"0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917"},
    Limit:  50,
})

// Get top holders
holders, err := client.GetHolders(ctx, &polymarketdata.GetHoldersParams{
    Market:     []string{marketId},
    Limit:      10,
    MinBalance: 1000,
})

// Get open interest
oi, err := client.GetOpenInterest(ctx, &polymarketdata.GetOpenInterestParams{
    Market: []string{marketId},
})

Trading Strategy Examples

This repository includes 5 complete, production-ready examples demonstrating different trading strategies:

1. Smart Money Tracker

Track and follow profitable traders

Identifies high-performing traders and monitors their positions and activities. Perfect for copy-trading strategies.

cd examples/smart_money_tracker && go run main.go

Key Use Cases:

  • Copy trading profitable traders
  • Validate market direction with smart money consensus
  • Avoid positions opposite to successful traders

2. Whale Watcher

Monitor large holders and market concentration

Analyzes token holder distribution to identify concentration risks and whale movements.

cd examples/whale_watcher && go run main.go

Key Use Cases:

  • Assess concentration risk before entering markets
  • Track whale accumulation/distribution
  • Predict potential price movements from large holders

Warning Levels:

  • ⚠️ Top 3 holders > 50% control
  • ⚠️ Top 10 holders > 70% control

3. Market Liquidity Analyzer

Find liquid markets and identify mispricing

Evaluates market depth, volume, and liquidity to find optimal trading opportunities.

cd examples/market_liquidity_analyzer && go run main.go

Key Use Cases:

  • Find liquid markets for large trades
  • Identify illiquid markets prone to volatility
  • Assess OI/Volume ratio for market health

Liquidity Scoring:

  • 70-100: Excellent liquidity
  • 30-70: Moderate liquidity
  • <30: Poor liquidity, use caution

4. Sentiment Reversal Detector

Identify overcrowded trades for contrarian opportunities

Detects extreme sentiment imbalances (>85% one-sided) that often precede reversals.

cd examples/sentiment_reversal_detector && go run main.go

Key Use Cases:

  • Find contrarian trading opportunities
  • Identify overbought/oversold markets
  • Fade overcrowded positions

Signal Strength:

  • STRONG: >85% one-sided pressure
  • MODERATE: 75-85% one-sided pressure
  • WEAK: Balanced market

5. Price Momentum Analyzer

Analyze trends and catch momentum trades

Identifies price trends, volume changes, and momentum to find trending markets.

cd examples/price_momentum_analyzer && go run main.go

Key Use Cases:

  • Trend following strategies
  • Breakout trading
  • Support/resistance level identification

Trading Signals:

  • 🟢 STRONG BUY: Price +3%+ with volume
  • 🟢 BUY: Price +1-3%
  • 🔴 STRONG SELL: Price -3%+ with volume
  • 🔴 SELL: Price -1-3%
  • ⚪ HOLD: Sideways action

Project Structure

.
├── client.go           # Core client implementation
├── types.go            # All type definitions
├── health.go           # Health check endpoint
├── positions.go        # Position-related endpoints
├── trades.go           # Trading endpoints
├── activity.go         # Activity endpoints
├── holders.go          # Holder endpoints
├── misc.go             # Miscellaneous endpoints
├── *_test.go           # Comprehensive tests
└── examples/           # Trading strategy examples
    ├── smart_money_tracker/
    ├── whale_watcher/
    ├── market_liquidity_analyzer/
    ├── sentiment_reversal_detector/
    └── price_momentum_analyzer/

Testing

Run all tests:

go test -v

Run specific test:

go test -v -run TestGetPositions

Design Principles

1. Decimal Precision

All numeric values use github.com/shopspring/decimal for precise handling of financial data.

type Position struct {
    Size     decimal.Decimal `json:"size"`
    AvgPrice decimal.Decimal `json:"avgPrice"`
    CashPnl  decimal.Decimal `json:"cashPnl"`
}
2. Pointer Parameters

Function parameters use pointers for mutability, while struct fields use values when zero is acceptable:

// Function parameter is pointer, context comes first
func (c *DataClient) GetPositions(ctx context.Context, params *GetPositionsParams) ([]Position, error)

// Field types - pointers only when needed
type GetPositionsParams struct {
    User          string           // Zero value OK
    Limit         int              // 0 means not set
    SizeThreshold *decimal.Decimal // Needs pointer
    Redeemable    *bool            // Needs pointer
}
3. Error Handling

Comprehensive error handling with context:

if resp.StatusCode != http.StatusOK {
    var errResp ErrorResponse
    if err := json.Unmarshal(body, &errResp); err == nil && errResp.Error != "" {
        return nil, fmt.Errorf("API error (status %d): %s", resp.StatusCode, errResp.Error)
    }
    return nil, fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body))
}

API Rate Limits

  • The Polymarket Data API has rate limits
  • Implement exponential backoff for production use
  • Consider caching responses when appropriate

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Disclaimer

This SDK is for educational and research purposes. Trading prediction markets involves risk. Always:

  • Do your own research
  • Never risk more than you can afford to lose
  • Past performance does not guarantee future results
  • The examples are for demonstration only

Resources

Support

For issues, questions, or contributions:

  • Open an issue on GitHub
  • Check existing examples for guidance
  • Review test files for usage patterns

Documentation

Index

Constants

View Source
const Endpoint = "https://data-api.polymarket.com"

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	ProxyWallet           string          `json:"proxyWallet"` // User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Timestamp             int64           `json:"timestamp"`
	ConditionId           string          `json:"conditionId"` // 0x-prefixed 64-hex string. Example: "0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917"
	Type                  ActivityType    `json:"type"`        // Available options: TRADE, SPLIT, MERGE, REDEEM, REWARD, CONVERSION
	Size                  decimal.Decimal `json:"size"`
	UsdcSize              decimal.Decimal `json:"usdcSize"`
	TransactionHash       string          `json:"transactionHash"`
	Price                 decimal.Decimal `json:"price"`
	Asset                 string          `json:"asset"`
	Side                  TradeSide       `json:"side"` // Available options: BUY, SELL
	OutcomeIndex          int             `json:"outcomeIndex"`
	Title                 string          `json:"title"`
	Slug                  string          `json:"slug"`
	Icon                  string          `json:"icon"`
	EventSlug             string          `json:"eventSlug"`
	Outcome               string          `json:"outcome"`
	Name                  string          `json:"name"`
	Pseudonym             string          `json:"pseudonym"`
	Bio                   string          `json:"bio"`
	ProfileImage          string          `json:"profileImage"`
	ProfileImageOptimized string          `json:"profileImageOptimized"`
}

Activity represents a user's on-chain activity

type ActivitySortBy

type ActivitySortBy string

ActivitySortBy represents the sort field for activities

const (
	ActivitySortByTimestamp ActivitySortBy = "TIMESTAMP"
	ActivitySortByTokens    ActivitySortBy = "TOKENS"
	ActivitySortByCash      ActivitySortBy = "CASH"
)

type ActivityType

type ActivityType string

ActivityType represents the type of activity

const (
	ActivityTypeTrade      ActivityType = "TRADE"
	ActivityTypeSplit      ActivityType = "SPLIT"
	ActivityTypeMerge      ActivityType = "MERGE"
	ActivityTypeRedeem     ActivityType = "REDEEM"
	ActivityTypeReward     ActivityType = "REWARD"
	ActivityTypeConversion ActivityType = "CONVERSION"
)

type Client added in v0.1.0

type Client struct {
	// contains filtered or unexported fields
}

func NewClient added in v0.1.0

func NewClient(httpClient *http.Client) (*Client, error)

func (*Client) GetActivity added in v0.1.0

func (c *Client) GetActivity(ctx context.Context, params *GetActivityParams) ([]Activity, error)

GetActivity retrieves on-chain activity for a user

func (*Client) GetClosedPositions added in v0.1.0

func (c *Client) GetClosedPositions(ctx context.Context, params *GetClosedPositionsParams) ([]ClosedPosition, error)

GetClosedPositions fetches closed positions for a user

func (*Client) GetHolders added in v0.1.0

func (c *Client) GetHolders(ctx context.Context, params *GetHoldersParams) ([]MarketHolders, error)

GetHolders retrieves top holders for markets

func (*Client) GetLiveVolume added in v0.1.0

func (c *Client) GetLiveVolume(ctx context.Context, params *GetLiveVolumeParams) ([]LiveVolume, error)

GetLiveVolume retrieves the live volume for an event

func (*Client) GetOpenInterest added in v0.1.0

func (c *Client) GetOpenInterest(ctx context.Context, params *GetOpenInterestParams) ([]OpenInterest, error)

GetOpenInterest retrieves the open interest for markets

func (*Client) GetPositions added in v0.1.0

func (c *Client) GetPositions(ctx context.Context, params *GetPositionsParams) ([]Position, error)

GetPositions retrieves current positions for a user

func (*Client) GetPositionsValue added in v0.1.0

func (c *Client) GetPositionsValue(ctx context.Context, params *GetValueParams) ([]UserValue, error)

GetPositionsValue retrieves the total value of a user's positions

func (*Client) GetTradedMarketsCount added in v0.1.0

func (c *Client) GetTradedMarketsCount(ctx context.Context, params *GetTradedMarketsCountParams) (*TradedMarketsCount, error)

GetTradedMarketsCount retrieves the total number of markets a user has traded

func (*Client) GetTrades added in v0.1.0

func (c *Client) GetTrades(ctx context.Context, params *GetTradesParams) ([]Trade, error)

GetTrades retrieves trades for a user or markets

func (*Client) HealthCheck added in v0.1.0

func (c *Client) HealthCheck(ctx context.Context) (*HealthResponse, error)

HealthCheck performs a health check on the Polymarket Data API Returns "OK" if the API is healthy

type ClosedPosition

type ClosedPosition struct {
	ProxyWallet     string          `json:"proxyWallet"` // User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Asset           string          `json:"asset"`
	ConditionId     string          `json:"conditionId"` // 0x-prefixed 64-hex string. Example: "0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917"
	AvgPrice        decimal.Decimal `json:"avgPrice"`
	TotalBought     decimal.Decimal `json:"totalBought"`
	RealizedPnl     decimal.Decimal `json:"realizedPnl"`
	CurPrice        decimal.Decimal `json:"curPrice"`
	Title           string          `json:"title"`
	Slug            string          `json:"slug"`
	Icon            string          `json:"icon"`
	EventSlug       string          `json:"eventSlug"`
	Outcome         string          `json:"outcome"`
	OutcomeIndex    int             `json:"outcomeIndex"`
	OppositeOutcome string          `json:"oppositeOutcome"`
	OppositeAsset   string          `json:"oppositeAsset"`
	EndDate         string          `json:"endDate"`
}

ClosedPosition represents a closed position for a user

type ClosedPositionSortBy

type ClosedPositionSortBy string

ClosedPositionSortBy represents the sort field for closed positions

const (
	ClosedPositionSortByRealizedPnl ClosedPositionSortBy = "REALIZEDPNL"
	ClosedPositionSortByTitle       ClosedPositionSortBy = "TITLE"
	ClosedPositionSortByPrice       ClosedPositionSortBy = "PRICE"
	ClosedPositionSortByAvgPrice    ClosedPositionSortBy = "AVGPRICE"
)

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse represents a standard error response from the API

type FilterType

type FilterType string

FilterType represents the filter type for trades

const (
	FilterTypeCash   FilterType = "CASH"
	FilterTypeTokens FilterType = "TOKENS"
)

type GetActivityParams

type GetActivityParams struct {
	Limit         int            // Optional: Default 100, required range: 0 <= x <= 500. 0 means not set.
	Offset        int            // Optional: Default 0, required range: 0 <= x <= 10000. 0 means not set.
	User          string         // Required: User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Market        []string       // Optional: Comma-separated list of condition IDs (0x-prefixed 64-hex string). Mutually exclusive with EventId.
	EventId       []int          // Optional: Comma-separated list of event IDs. Mutually exclusive with Market.
	Type          []ActivityType // Optional: Activity type filters
	Start         int64          // Optional: Start timestamp, required range: x >= 0. 0 means not set.
	End           int64          // Optional: End timestamp, required range: x >= 0. 0 means not set.
	SortBy        ActivitySortBy // Optional: Default TIMESTAMP. Available options: TIMESTAMP, TOKENS, CASH
	SortDirection SortDirection  // Optional: Default DESC. Available options: ASC, DESC
	Side          TradeSide      // Optional: Available options: BUY, SELL
}

GetActivityParams represents parameters for getting user activity

type GetClosedPositionsParams

type GetClosedPositionsParams struct {
	User          string               // Required: The address of the user. Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Market        []string             // Optional: The conditionId of the market (0x-prefixed 64-hex string). Cannot be used with EventId.
	Title         string               // Optional: Filter by market title. Maximum length: 100
	EventId       []int                // Optional: The event id. Returns positions for all markets for those event ids. Cannot be used with Market.
	Limit         int                  // Optional: Default 50, required range: 0 <= x <= 500. 0 means not set.
	Offset        int                  // Optional: Default 0, required range: 0 <= x <= 10000. 0 means not set.
	SortBy        ClosedPositionSortBy // Optional: Default REALIZEDPNL. Available options: REALIZEDPNL, TITLE, PRICE, AVGPRICE
	SortDirection SortDirection        // Optional: Default DESC. Available options: ASC, DESC
}

GetClosedPositionsParams represents parameters for getting closed positions

type GetHoldersParams

type GetHoldersParams struct {
	Limit      int      // Optional: Default 100, required range: 0 <= x <= 500. 0 means not set.
	Market     []string // Required: Comma-separated list of condition IDs (0x-prefixed 64-hex string)
	MinBalance int      // Optional: Default 1, required range: 0 <= x <= 999999. 0 means not set.
}

GetHoldersParams represents parameters for getting top holders

type GetLiveVolumeParams

type GetLiveVolumeParams struct {
	Id int // Required: Event ID, required range: x >= 1
}

GetLiveVolumeParams represents parameters for getting live volume

type GetOpenInterestParams

type GetOpenInterestParams struct {
	Market []string // Optional: List of market condition IDs (0x-prefixed 64-hex string)
}

GetOpenInterestParams represents parameters for getting open interest

type GetPositionsParams

type GetPositionsParams struct {
	User          string           // Required: User address. Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Market        []string         // Optional: Comma-separated list of condition IDs. 0x-prefixed 64-hex string. Mutually exclusive with EventId.
	EventId       []int            // Optional: Comma-separated list of event IDs. Mutually exclusive with Market.
	SizeThreshold *decimal.Decimal // Optional: Default 1, required range: x >= 0
	Redeemable    *bool            // Optional: Default false
	Mergeable     *bool            // Optional: Default false
	Limit         int              // Optional: Default 100, required range: 0 <= x <= 500. 0 means not set.
	Offset        int              // Optional: Default 0, required range: 0 <= x <= 10000. 0 means not set.
	SortBy        SortBy           // Optional: Default TOKENS. Available options: CURRENT, INITIAL, TOKENS, CASHPNL, PERCENTPNL, TITLE, RESOLVING, PRICE, AVGPRICE
	SortDirection SortDirection    // Optional: Default DESC. Available options: ASC, DESC
	Title         string           // Optional: Maximum length: 100
}

GetPositionsParams represents parameters for getting user positions

type GetTradedMarketsCountParams

type GetTradedMarketsCountParams struct {
	User string // Required: User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
}

GetTradedMarketsCountParams represents parameters for getting traded markets count

type GetTradesParams

type GetTradesParams struct {
	Limit        int              // Optional: Default 100, required range: 0 <= x <= 10000. 0 means not set.
	Offset       int              // Optional: Default 0, required range: 0 <= x <= 10000. 0 means not set.
	TakerOnly    *bool            // Optional: Default true
	FilterType   FilterType       // Optional: Must be provided together with FilterAmount. Available options: CASH, TOKENS
	FilterAmount *decimal.Decimal // Optional: Must be provided together with FilterType. Required range: x >= 0
	Market       []string         // Optional: Comma-separated list of condition IDs (0x-prefixed 64-hex string). Mutually exclusive with EventId.
	EventId      []int            // Optional: Comma-separated list of event IDs. Mutually exclusive with Market.
	User         string           // Optional: User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Side         TradeSide        // Optional: Available options: BUY, SELL
}

GetTradesParams represents parameters for getting trades

type GetValueParams

type GetValueParams struct {
	User   string   // Required: User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Market []string // Optional: List of condition IDs (0x-prefixed 64-hex string)
}

GetValueParams represents parameters for getting user's total position value

type HealthResponse

type HealthResponse struct {
	Data string `json:"data"`
}

HealthResponse represents the response from the health check endpoint

type Holder

type Holder struct {
	ProxyWallet           string          `json:"proxyWallet"`           // User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Bio                   string          `json:"bio"`                   // User bio
	Asset                 string          `json:"asset"`                 // Asset address
	Pseudonym             string          `json:"pseudonym"`             // User pseudonym
	Amount                decimal.Decimal `json:"amount"`                // Amount held
	DisplayUsernamePublic bool            `json:"displayUsernamePublic"` // Whether username is public
	OutcomeIndex          int             `json:"outcomeIndex"`          // Outcome index
	Name                  string          `json:"name"`                  // User name
	ProfileImage          string          `json:"profileImage"`          // Profile image URL
	ProfileImageOptimized string          `json:"profileImageOptimized"` // Optimized profile image URL
}

Holder represents a holder of a market token

type LiveVolume

type LiveVolume struct {
	Total   decimal.Decimal    `json:"total"`   // Total volume
	Markets []LiveVolumeMarket `json:"markets"` // List of market volumes
}

LiveVolume represents the live volume for an event

type LiveVolumeMarket

type LiveVolumeMarket struct {
	Market string          `json:"market"` // 0x-prefixed 64-hex string. Example: "0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917"
	Value  decimal.Decimal `json:"value"`  // Volume value
}

LiveVolumeMarket represents the volume for a specific market

type MarketHolders

type MarketHolders struct {
	Token   string   `json:"token"`   // Token address
	Holders []Holder `json:"holders"` // List of holders
}

MarketHolders represents holders for a specific market token

type OpenInterest

type OpenInterest struct {
	Market string          `json:"market"` // 0x-prefixed 64-hex string. Example: "0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917"
	Value  decimal.Decimal `json:"value"`  // Open interest value
}

OpenInterest represents the open interest for a market

type Position

type Position struct {
	ProxyWallet        string          `json:"proxyWallet"`
	Asset              string          `json:"asset"`
	ConditionId        string          `json:"conditionId"`
	Size               decimal.Decimal `json:"size"`
	AvgPrice           decimal.Decimal `json:"avgPrice"`
	InitialValue       decimal.Decimal `json:"initialValue"`
	CurrentValue       decimal.Decimal `json:"currentValue"`
	CashPnl            decimal.Decimal `json:"cashPnl"`
	PercentPnl         decimal.Decimal `json:"percentPnl"`
	TotalBought        decimal.Decimal `json:"totalBought"`
	RealizedPnl        decimal.Decimal `json:"realizedPnl"`
	PercentRealizedPnl decimal.Decimal `json:"percentRealizedPnl"`
	CurPrice           decimal.Decimal `json:"curPrice"`
	Redeemable         bool            `json:"redeemable"`
	Mergeable          bool            `json:"mergeable"`
	Title              string          `json:"title"`
	Slug               string          `json:"slug"`
	Icon               string          `json:"icon"`
	EventSlug          string          `json:"eventSlug"`
	Outcome            string          `json:"outcome"`
	OutcomeIndex       int             `json:"outcomeIndex"`
	OppositeOutcome    string          `json:"oppositeOutcome"`
	OppositeAsset      string          `json:"oppositeAsset"`
	EndDate            string          `json:"endDate"`
	NegativeRisk       bool            `json:"negativeRisk"`
}

Position represents a user's position in a market

type SortBy

type SortBy string

SortBy represents the sort field for positions

const (
	SortByCurrent    SortBy = "CURRENT"
	SortByInitial    SortBy = "INITIAL"
	SortByTokens     SortBy = "TOKENS"
	SortByCashPnl    SortBy = "CASHPNL"
	SortByPercentPnl SortBy = "PERCENTPNL"
	SortByTitle      SortBy = "TITLE"
	SortByResolving  SortBy = "RESOLVING"
	SortByPrice      SortBy = "PRICE"
	SortByAvgPrice   SortBy = "AVGPRICE"
)

type SortDirection

type SortDirection string

SortDirection represents the sort direction

const (
	SortDirectionAsc  SortDirection = "ASC"
	SortDirectionDesc SortDirection = "DESC"
)

type Trade

type Trade struct {
	ProxyWallet           string          `json:"proxyWallet"` // User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Side                  TradeSide       `json:"side"`        // Available options: BUY, SELL
	Asset                 string          `json:"asset"`
	ConditionId           string          `json:"conditionId"` // 0x-prefixed 64-hex string. Example: "0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917"
	Size                  decimal.Decimal `json:"size"`
	Price                 decimal.Decimal `json:"price"`
	Timestamp             int64           `json:"timestamp"`
	Title                 string          `json:"title"`
	Slug                  string          `json:"slug"`
	Icon                  string          `json:"icon"`
	EventSlug             string          `json:"eventSlug"`
	Outcome               string          `json:"outcome"`
	OutcomeIndex          int             `json:"outcomeIndex"`
	Name                  string          `json:"name"`
	Pseudonym             string          `json:"pseudonym"`
	Bio                   string          `json:"bio"`
	ProfileImage          string          `json:"profileImage"`
	ProfileImageOptimized string          `json:"profileImageOptimized"`
	TransactionHash       string          `json:"transactionHash"`
}

Trade represents a trade record

type TradeSide

type TradeSide string

TradeSide represents the side of a trade

const (
	TradeSideBuy  TradeSide = "BUY"
	TradeSideSell TradeSide = "SELL"
)

type TradedMarketsCount

type TradedMarketsCount struct {
	User   string `json:"user"`   // User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Traded int    `json:"traded"` // Total number of markets traded
}

TradedMarketsCount represents the total number of markets a user has traded

type UserValue

type UserValue struct {
	User  string          `json:"user"`  // User Profile Address (0x-prefixed, 40 hex chars). Example: "0x56687bf447db6ffa42ffe2204a05edaa20f55839"
	Value decimal.Decimal `json:"value"` // Total value
}

UserValue represents the total value of a user's positions

Directories

Path Synopsis
examples
whale_watcher command

Jump to

Keyboard shortcuts

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