Documentation
¶
Index ¶
- Constants
- type EventSearchParams
- type GammaClient
- func (c *GammaClient) GetEventByID(ctx context.Context, id string) (*GammaEvent, error)
- func (c *GammaClient) GetEventBySlug(ctx context.Context, slug string) (*GammaEvent, error)
- func (c *GammaClient) GetEvents(ctx context.Context, params EventSearchParams) ([]GammaEvent, error)
- func (c *GammaClient) GetMarketByConditionID(ctx context.Context, conditionID string) (*GammaMarket, error)
- func (c *GammaClient) GetMarketBySlug(ctx context.Context, slug string) (*GammaMarket, error)
- func (c *GammaClient) GetMarkets(ctx context.Context, params MarketSearchParams) ([]GammaMarket, error)
- type GammaEvent
- type GammaMarket
- type GammaTag
- type GammaToken
- type MarketSearchParams
Constants ¶
View Source
const GammaAPIBase = "https://gamma-api.polymarket.com"
Gamma API Base URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventSearchParams ¶
EventSearchParams parameters for querying events
type GammaClient ¶
type GammaClient struct {
// contains filtered or unexported fields
}
GammaClient interacts with the Gamma API
func NewGammaClient ¶
func NewGammaClient(httpClient *http.Client) *GammaClient
NewGammaClient creates a new GammaClient
func (*GammaClient) GetEventByID ¶
func (c *GammaClient) GetEventByID(ctx context.Context, id string) (*GammaEvent, error)
GetEventByID fetches a single event by ID
func (*GammaClient) GetEventBySlug ¶
func (c *GammaClient) GetEventBySlug(ctx context.Context, slug string) (*GammaEvent, error)
GetEventBySlug fetches a single event by slug
func (*GammaClient) GetEvents ¶
func (c *GammaClient) GetEvents(ctx context.Context, params EventSearchParams) ([]GammaEvent, error)
GetEvents fetches events with filters
func (*GammaClient) GetMarketByConditionID ¶
func (c *GammaClient) GetMarketByConditionID(ctx context.Context, conditionID string) (*GammaMarket, error)
GetMarketByConditionID fetches a single market by condition ID
func (*GammaClient) GetMarketBySlug ¶
func (c *GammaClient) GetMarketBySlug(ctx context.Context, slug string) (*GammaMarket, error)
GetMarketBySlug fetches a single market by slug
func (*GammaClient) GetMarkets ¶
func (c *GammaClient) GetMarkets(ctx context.Context, params MarketSearchParams) ([]GammaMarket, error)
GetMarkets fetches markets with filters
type GammaEvent ¶
type GammaEvent struct {
ID string `json:"id"`
Slug string `json:"slug"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Markets []GammaMarket `json:"markets"`
StartDate *time.Time `json:"startDate,omitempty"`
EndDate *time.Time `json:"endDate,omitempty"`
Image string `json:"image,omitempty"`
}
GammaEvent represents an event grouping
type GammaMarket ¶
type GammaMarket struct {
ID string `json:"id"`
ConditionID string `json:"conditionId"`
Slug string `json:"slug"`
Question string `json:"question"`
Description string `json:"description,omitempty"`
// API returns these as stringified JSON arrays sometimes?
// or maybe it's []string but my previous assumption was wrong?
// The error `cannot unmarshal string into ... []string` confirms it returns a string.
Outcomes string `json:"outcomes"`
OutcomePrices string `json:"outcomePrices"`
Volume decimal.Decimal `json:"volume"`
Volume24hr decimal.Decimal `json:"volume24hr,omitempty"`
Volume1wk decimal.Decimal `json:"volume1wk,omitempty"`
Liquidity decimal.Decimal `json:"liquidity"`
Spread decimal.Decimal `json:"spread,omitempty"`
OneDayPriceChange decimal.Decimal `json:"oneDayPriceChange,omitempty"`
OneWeekPriceChange decimal.Decimal `json:"oneWeekPriceChange,omitempty"`
LastTradePrice decimal.Decimal `json:"lastTradePrice,omitempty"`
BestBid decimal.Decimal `json:"bestBid,omitempty"`
BestAsk decimal.Decimal `json:"bestAsk,omitempty"`
EndDate *time.Time `json:"endDate"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
StartDate *time.Time `json:"startDate,omitempty"`
AcceptingOrdersTimestamp *time.Time `json:"acceptingOrdersTimestamp,omitempty"`
Active bool `json:"active"`
Closed bool `json:"closed"`
Image string `json:"image,omitempty"`
Icon string `json:"icon,omitempty"`
Tags []GammaTag `json:"tags,omitempty"` // API might return strings or objects? TS says strings but also defines GammaTag interface. Checking TS implem, it says `tags?: string[]`.
// Let's stick to []string for now based on GammaMarket interface in TS which says `tags?: string[]`
// Wait, TS says `tags?: string[]` in GammaMarket, so we use []string
TagStrings []string `json:"-"`
// ClobTokenIds is stringified JSON array in API response
ClobTokenIds string `json:"clobTokenIds,omitempty"`
}
GammaMarket represents a market from the Gamma API
func (GammaMarket) Tokens ¶
func (m GammaMarket) Tokens() []GammaToken
Tokens helper returns structured token info
type GammaTag ¶
type GammaTag struct {
ID string `json:"id"`
Label string `json:"label"`
Slug string `json:"slug"`
}
Tag struct if we need it later
type GammaToken ¶
GammaToken represents a token for an outcome
Click to show internal directories.
Click to hide internal directories.