Add Watchlist Item
WatchlistAddWatchlistItemResponse v1().watchlist().addWatchlistItem(WatchlistAddWatchlistItemParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/watchlists/{watchlist_id}/items
Add Watchlist Item
package com.clear_street.api.example;
import com.clear_street.api.client.ClearStreetClient;
import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient;
import com.clear_street.api.models.v1.watchlist.WatchlistAddWatchlistItemParams;
import com.clear_street.api.models.v1.watchlist.WatchlistAddWatchlistItemResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
ClearStreetClient client = ClearStreetOkHttpClient.builder()
.fromEnv()
.apiKey("My API Key")
.build();
WatchlistAddWatchlistItemParams params = WatchlistAddWatchlistItemParams.builder()
.watchlistId("550e8400-e29b-41d4-a716-446655440000")
.instrumentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build();
WatchlistAddWatchlistItemResponse response = client.v1().watchlist().addWatchlistItem(params);
}
}{
"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"
}
}