Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Name is the name of the Polymarket provider. Name = "polymarket_api" // URL is the default base URL of the Polymarket CLOB API. It uses the `markets` endpoint with a given market ID. URL = "https://clob.polymarket.com/markets/%s" )
Variables ¶
Functions ¶
func NewAPIHandler ¶
func NewAPIHandler(api config.APIConfig) (types.PriceAPIDataHandler, error)
NewAPIHandler returns a new Polymarket PriceAPIDataHandler.
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler implements the PriceAPIDataHandler interface for Polymarket, which can be used by a base provider. The handler fetches data from the `markets` endpoint.
func (APIHandler) CreateURL ¶
func (h APIHandler) CreateURL(ids []types.ProviderTicker) (string, error)
CreateURL returns the URL that is used to fetch data from the Polymarket API for the given ticker. Since the markets endpoint's price data is automatically denominated in USD, only one ID is expected to be passed into this method.
func (APIHandler) ParseResponse ¶
func (h APIHandler) ParseResponse(ids []types.ProviderTicker, response *http.Response) types.PriceResponse
ParseResponse parses the HTTP response from the markets endpoint of the Polymarket API endpoint and returns the resulting data.
type MarketsResponse ¶
type MarketsResponse struct { EnableOrderBook bool `json:"enable_order_book"` Active bool `json:"active"` Closed bool `json:"closed"` Archived bool `json:"archived"` AcceptingOrders bool `json:"accepting_orders"` AcceptingOrderTimestamp time.Time `json:"accepting_order_timestamp"` MinimumOrderSize int `json:"minimum_order_size"` MinimumTickSize float64 `json:"minimum_tick_size"` ConditionID string `json:"condition_id"` QuestionID string `json:"question_id"` Question string `json:"question"` Description string `json:"description"` MarketSlug string `json:"market_slug"` EndDateIso time.Time `json:"end_date_iso"` GameStartTime any `json:"game_start_time"` SecondsDelay int `json:"seconds_delay"` Fpmm string `json:"fpmm"` MakerBaseFee int `json:"maker_base_fee"` TakerBaseFee int `json:"taker_base_fee"` NotificationsEnabled bool `json:"notifications_enabled"` NegRisk bool `json:"neg_risk"` NegRiskMarketID string `json:"neg_risk_market_id"` NegRiskRequestID string `json:"neg_risk_request_id"` Icon string `json:"icon"` Image string `json:"image"` Rewards struct { Rates []struct { AssetAddress string `json:"asset_address"` RewardsDailyRate int `json:"rewards_daily_rate"` } `json:"rates"` MinSize int `json:"min_size"` MaxSpread float64 `json:"max_spread"` } `json:"rewards"` Is5050Outcome bool `json:"is_50_50_outcome"` Tokens []TokenData `json:"tokens"` Tags []string `json:"tags"` }
Click to show internal directories.
Click to hide internal directories.