Order Operations

(c *Client) PlaceOrder(ctx context.Context, req *PlaceOrderRequest) (string, error)

Places a buy or sell order in a market.

Parameters:

  • ctx: Context

  • req: Order details

Returns:

  • string: Order ID

  • error: Placement error

Request Structure:

gotype PlaceOrderRequest struct {
    MarketID      string
    Outcome       string  // "YES" or "NO"
    OrderType     string  // "LIMIT", "MARKET", "STOP_LOSS"
    Side          string  // "BUY" or "SELL"
    Quantity      float64
    Price         float64 // For LIMIT orders
    StopPrice     float64 // For STOP_LOSS orders
    PrivateKey    string
}

Example:

(c *Client) CancelOrder(ctx context.Context, orderID, privateKey string) error

Cancels an open order.

Parameters:

  • ctx: Context

  • orderID: Order to cancel

  • privateKey: Transaction signer

Returns:

  • error: Cancellation error

Example:

Last updated