Skip to content
Get started

Add Watchlist Item

client.V1.Watchlist.AddWatchlistItem(ctx, watchlistID, body) (*V1WatchlistAddWatchlistItemResponse, error)
POST/v1/watchlists/{watchlist_id}/items

Add an instrument to a watchlist

ParametersExpand Collapse
watchlistID string
body V1WatchlistAddWatchlistItemParams
InstrumentID param.Field[InstrumentIDOrSymbol]

OEMS instrument UUID

formatuuid
ReturnsExpand Collapse
type V1WatchlistAddWatchlistItemResponse struct{…}

Response data for adding a watchlist item

ItemID string

ID of the created item

formatuuid

Add Watchlist Item

package main

import (
  "context"
  "fmt"

  "github.com/clear-street/clear-street-go"
  "github.com/clear-street/clear-street-go/option"
)

func main() {
  client := clearstreet.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.V1.Watchlist.AddWatchlistItem(
    context.TODO(),
    "550e8400-e29b-41d4-a716-446655440000",
    clearstreet.V1WatchlistAddWatchlistItemParams{
      InstrumentID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
{
  "data": {
    "item_id": "770e8400-e29b-41d4-a716-446655440002"
  },
  "error": null,
  "metadata": {
    "request_id": "b2c3d4e5-f6a7-8901-2345-678901bcdefg"
  }
}
{
  "error": {
    "code": 400,
    "message": "Failed to parse the request body as JSON: trailing comma at line 3 column 1"
  },
  "metadata": {
    "request_id": "3dc2f3ee-b66f-4b4e-9206-2c7f8aa933f6"
  }
}
{
  "error": {
    "code": 400,
    "message": "Watchlist cannot exceed 1000 items"
  },
  "metadata": {
    "request_id": "d9766cbe-74fa-4cc7-a0a8-9a7dd5b5294c"
  }
}
{
  "error": {
    "code": 404,
    "message": "Instrument not found: 69fcb40a-1812-4856-b2d3-97dec805efee"
  },
  "metadata": {
    "request_id": "6cf943be-2a63-4af5-85f4-60c14ffcee08"
  }
}
{
  "error": {
    "code": 404,
    "message": "Some requested entity was not found"
  },
  "metadata": {
    "request_id": "ce99b89c-e465-423c-959c-73c8305f9244"
  }
}
{
  "error": {
    "code": 409,
    "message": "Instrument already exists in watchlist"
  },
  "metadata": {
    "request_id": "95d49456-75c6-480a-9695-fae2b1a8befd"
  }
}
Returns Examples
{
  "data": {
    "item_id": "770e8400-e29b-41d4-a716-446655440002"
  },
  "error": null,
  "metadata": {
    "request_id": "b2c3d4e5-f6a7-8901-2345-678901bcdefg"
  }
}
{
  "error": {
    "code": 400,
    "message": "Failed to parse the request body as JSON: trailing comma at line 3 column 1"
  },
  "metadata": {
    "request_id": "3dc2f3ee-b66f-4b4e-9206-2c7f8aa933f6"
  }
}
{
  "error": {
    "code": 400,
    "message": "Watchlist cannot exceed 1000 items"
  },
  "metadata": {
    "request_id": "d9766cbe-74fa-4cc7-a0a8-9a7dd5b5294c"
  }
}
{
  "error": {
    "code": 404,
    "message": "Instrument not found: 69fcb40a-1812-4856-b2d3-97dec805efee"
  },
  "metadata": {
    "request_id": "6cf943be-2a63-4af5-85f4-60c14ffcee08"
  }
}
{
  "error": {
    "code": 404,
    "message": "Some requested entity was not found"
  },
  "metadata": {
    "request_id": "ce99b89c-e465-423c-959c-73c8305f9244"
  }
}
{
  "error": {
    "code": 409,
    "message": "Instrument already exists in watchlist"
  },
  "metadata": {
    "request_id": "95d49456-75c6-480a-9695-fae2b1a8befd"
  }
}