subgraph

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubgraphPositions = "https://api.goldsky.com/api/public/project_cl6mb8i9h0003e201j6li0diw/subgraphs/positions-subgraph/0.0.7/gn"
	SubgraphPnL       = "https://api.goldsky.com/api/public/project_cl6mb8i9h0003e201j6li0diw/subgraphs/pnl-subgraph/0.0.14/gn"
	SubgraphActivity  = "https://api.goldsky.com/api/public/project_cl6mb8i9h0003e201j6li0diw/subgraphs/activity-subgraph/0.0.4/gn"
	SubgraphOI        = "https://api.goldsky.com/api/public/project_cl6mb8i9h0003e201j6li0diw/subgraphs/oi-subgraph/0.0.6/gn"
	SubgraphOrderbook = "https://api.goldsky.com/api/public/project_cl6mb8i9h0003e201j6li0diw/subgraphs/orderbook-subgraph/0.0.1/gn"
)

Subgraph Endpoints

Variables

Functions

func IntP

func IntP(i int) *int

Helpers

Types

type Condition

type Condition struct {
	ID                string   `json:"id"`
	PositionIDs       []string `json:"positionIds"`
	PayoutNumerators  []string `json:"payoutNumerators"`
	PayoutDenominator string   `json:"payoutDenominator"`
}

type GlobalOpenInterest

type GlobalOpenInterest struct {
	ID     string `json:"id"`
	Amount string `json:"amount"`
}

type MarketData

type MarketData struct {
	ID     string `json:"id"`
	Volume string `json:"volume"`
}

type MarketOpenInterest

type MarketOpenInterest struct {
	ID     string `json:"id"` // condition id
	Amount string `json:"amount"`
}

OI Subgraph

type Merge

type Merge struct {
	ID          string `json:"id"`
	Timestamp   string `json:"timestamp"`
	Stakeholder string `json:"stakeholder"`
	Condition   string `json:"condition"`
	Amount      string `json:"amount"`
}

type NetUserBalance

type NetUserBalance struct {
	ID      string `json:"id"`
	User    string `json:"user"`
	Asset   string `json:"asset"`
	Balance string `json:"balance"`
}

type OrderFilledEvent

type OrderFilledEvent struct {
	ID                string `json:"id"`
	TransactionHash   string `json:"transactionHash"`
	Timestamp         string `json:"timestamp"`
	OrderHash         string `json:"orderHash"`
	Maker             string `json:"maker"`
	Taker             string `json:"taker"`
	MakerAssetID      string `json:"makerAssetId"`
	TakerAssetID      string `json:"takerAssetId"`
	MakerAmountFilled string `json:"makerAmountFilled"`
	TakerAmountFilled string `json:"takerAmountFilled"`
	Fee               string `json:"fee"`
}

Orderbook Subgraph

type Redemption

type Redemption struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Redeemer  string `json:"redeemer"`
	Condition string `json:"condition"`
	Payout    string `json:"payout"`
}

type Split

type Split struct {
	ID          string `json:"id"`
	Timestamp   string `json:"timestamp"`
	Stakeholder string `json:"stakeholder"`
	Condition   string `json:"condition"`
	Amount      string `json:"amount"`
}

Activity Subgraph

type SubgraphClient

type SubgraphClient struct {
	HTTPClient *http.Client
}

func NewSubgraphClient

func NewSubgraphClient(httpClient *http.Client) *SubgraphClient

func (*SubgraphClient) GetCondition

func (c *SubgraphClient) GetCondition(conditionID string) (*Condition, error)

func (*SubgraphClient) GetConditions

func (c *SubgraphClient) GetConditions(params SubgraphQueryParams) ([]Condition, error)

func (*SubgraphClient) GetMakerFills

func (c *SubgraphClient) GetMakerFills(maker string, params SubgraphQueryParams) ([]OrderFilledEvent, error)

func (*SubgraphClient) GetMarketOpenInterest

func (c *SubgraphClient) GetMarketOpenInterest(conditionID string) (*MarketOpenInterest, error)

OI

func (*SubgraphClient) GetMerges

func (c *SubgraphClient) GetMerges(user string, params SubgraphQueryParams) ([]Merge, error)

func (*SubgraphClient) GetNetUserBalances

func (c *SubgraphClient) GetNetUserBalances(user string, params SubgraphQueryParams) ([]NetUserBalance, error)

func (*SubgraphClient) GetOrderFilledEvents

func (c *SubgraphClient) GetOrderFilledEvents(params SubgraphQueryParams) ([]OrderFilledEvent, error)

Orderbook

func (*SubgraphClient) GetRedemptions

func (c *SubgraphClient) GetRedemptions(user string, params SubgraphQueryParams) ([]Redemption, error)

func (*SubgraphClient) GetSplits

func (c *SubgraphClient) GetSplits(user string, params SubgraphQueryParams) ([]Split, error)

Activity

func (*SubgraphClient) GetTakerFills

func (c *SubgraphClient) GetTakerFills(taker string, params SubgraphQueryParams) ([]OrderFilledEvent, error)

func (*SubgraphClient) GetTopMarketsByOI

func (c *SubgraphClient) GetTopMarketsByOI(params SubgraphQueryParams) ([]MarketOpenInterest, error)

func (*SubgraphClient) GetUserBalances

func (c *SubgraphClient) GetUserBalances(user string, params SubgraphQueryParams) ([]UserBalance, error)

User Balances

func (*SubgraphClient) GetUserPositions

func (c *SubgraphClient) GetUserPositions(user string, params SubgraphQueryParams) ([]UserPosition, error)

PnL

func (*SubgraphClient) IsConditionResolved

func (c *SubgraphClient) IsConditionResolved(conditionID string) (bool, error)

type SubgraphName

type SubgraphName string
const (
	SubgraphPos           SubgraphName = "positions"
	SubgraphPnLType       SubgraphName = "pnl"
	SubgraphAct           SubgraphName = "activity"
	SubgraphOIType        SubgraphName = "oi"
	SubgraphOrderbookType SubgraphName = "orderbook"
)

type SubgraphQueryParams

type SubgraphQueryParams struct {
	First          *int                   `json:"first,omitempty"`
	Skip           *int                   `json:"skip,omitempty"`
	OrderBy        string                 `json:"orderBy,omitempty"`
	OrderDirection string                 `json:"orderDirection,omitempty"` // "asc" | "desc"
	Where          map[string]interface{} `json:"where,omitempty"`
}

Query Parameters

type UserBalance

type UserBalance struct {
	ID      string `json:"id"`
	User    string `json:"user"`
	Asset   string `json:"asset"`
	Balance string `json:"balance"` // BigInt as string
}

Positions Subgraph

type UserPosition

type UserPosition struct {
	ID          string `json:"id"`
	User        string `json:"user"`
	TokenID     string `json:"tokenId"` // BigInt as string
	Amount      string `json:"amount"`
	AvgPrice    string `json:"avgPrice"`
	RealizedPnl string `json:"realizedPnl"`
	TotalBought string `json:"totalBought"`
}

PnL Subgraph

Jump to

Keyboard shortcuts

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