Documentation
¶
Index ¶
- Constants
- Variables
- func IntP(i int) *int
- type Condition
- type GlobalOpenInterest
- type MarketData
- type MarketOpenInterest
- type Merge
- type NetUserBalance
- type OrderFilledEvent
- type Redemption
- type Split
- type SubgraphClient
- func (c *SubgraphClient) GetCondition(conditionID string) (*Condition, error)
- func (c *SubgraphClient) GetConditions(params SubgraphQueryParams) ([]Condition, error)
- func (c *SubgraphClient) GetMakerFills(maker string, params SubgraphQueryParams) ([]OrderFilledEvent, error)
- func (c *SubgraphClient) GetMarketOpenInterest(conditionID string) (*MarketOpenInterest, error)
- func (c *SubgraphClient) GetMerges(user string, params SubgraphQueryParams) ([]Merge, error)
- func (c *SubgraphClient) GetNetUserBalances(user string, params SubgraphQueryParams) ([]NetUserBalance, error)
- func (c *SubgraphClient) GetOrderFilledEvents(params SubgraphQueryParams) ([]OrderFilledEvent, error)
- func (c *SubgraphClient) GetRedemptions(user string, params SubgraphQueryParams) ([]Redemption, error)
- func (c *SubgraphClient) GetSplits(user string, params SubgraphQueryParams) ([]Split, error)
- func (c *SubgraphClient) GetTakerFills(taker string, params SubgraphQueryParams) ([]OrderFilledEvent, error)
- func (c *SubgraphClient) GetTopMarketsByOI(params SubgraphQueryParams) ([]MarketOpenInterest, error)
- func (c *SubgraphClient) GetUserBalances(user string, params SubgraphQueryParams) ([]UserBalance, error)
- func (c *SubgraphClient) GetUserPositions(user string, params SubgraphQueryParams) ([]UserPosition, error)
- func (c *SubgraphClient) IsConditionResolved(conditionID string) (bool, error)
- type SubgraphName
- type SubgraphQueryParams
- type UserBalance
- type UserPosition
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 ¶
View Source
var SubgraphEndpoints = map[SubgraphName]string{ SubgraphPos: SubgraphPositions, SubgraphPnLType: SubgraphPnL, SubgraphAct: SubgraphActivity, SubgraphOIType: SubgraphOI, SubgraphOrderbookType: SubgraphOrderbook, }
Functions ¶
Types ¶
type GlobalOpenInterest ¶
type MarketData ¶
type MarketOpenInterest ¶
type MarketOpenInterest struct {
ID string `json:"id"` // condition id
Amount string `json:"amount"`
}
OI Subgraph
type NetUserBalance ¶
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 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 ¶
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
Click to show internal directories.
Click to hide internal directories.