Position Operations

(c *Client) GetPosition(ctx context.Context, userAddress, marketID, outcome string) (*Position, error)

Gets a user's position in a specific market outcome.

Parameters:

  • ctx: Context

  • userAddress: User's wallet address

  • marketID: Market identifier

  • outcome: Outcome name (e.g., "YES")

Returns:

  • *Position: Position details

  • error: Query error

Example:

goposition, err := client.GetPosition(ctx, "0x123...", "market-1", "YES")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Shares: %f, Current Value: %f\n", position.Shares, position.CurrentValue)

(c *Client) GetUserPositions(ctx context.Context, userAddress string) ([]*Position, error)

Gets all positions for a user across all markets.

Parameters:

  • ctx: Context

  • userAddress: User's wallet address

Returns:

  • []*Position: Array of all user positions

  • error: Query error

Example:

Last updated