alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
142 stars 13 forks source link

API for "POST Add an asset" to Watchlist returns "Asset not found" for any valid asset #91

Closed Petersoj closed 4 years ago

Petersoj commented 4 years ago

The following request:

POST https://paper-api.alpaca.markets/v2/watchlists/<my watchlist uuid that is not the primary watchlist>

APCA-API-KEY-ID: <MY KEY ID>
APCA-API-SECRET-KEY: <MY SECRET>
Accept: */*
Content-Type: text/plain
Accept-Encoding: gzip, deflate
Accept-Language: en-us

{"symbols":["MSFT"]}

Returns the following response:

HTTP/1.1 422 Unprocessable Entity

Server: nginx/1.13.0
Date: Sun, 24 Nov 2019 19:47:09 GMT
Content-Type: application/json; charset=UTF-8
Connection: keep-alive
Vary: Origin
Content-Length: 47

{
    "code": 40010001,
    "message": "asset not found: "
}
jagg19 commented 4 years ago

I've had this same issue and I brought it up to directly to Alpaca's team. Should be a fix soon hopefully.   For now, I just use "PUT Update Watchlist" with a list of the current positions in the watchlist + new positions that I am trying to add. Not ideal, but a temporary solution while we wait for the fix. Hope this helps.

Neal commented 4 years ago

It looks like you're sending a json formatted body but the content type is set to text/plain - can you try again with the application/json content type?

Petersoj commented 4 years ago

Still no dice:

POST https://paper-api.alpaca.markets/v2/watchlists/<my watchlist uuid that is not the primary watchlist>

APCA-API-KEY-ID: <MY KEY ID>
APCA-API-SECRET-KEY: <MY SECRET>
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
Accept-Language: en-us

{"symbols":["MSFT"]}
HTTP/1.1 422 Unprocessable Entity

Server: nginx/1.13.0
Date: Thu, 05 Dec 2019 17:09:34 GMT
Content-Type: application/json; charset=UTF-8
Connection: keep-alive
Vary: Origin
Content-Length: 47

{
    "code": 40010001,
    "message": "asset not found: "
}
umitanuki commented 4 years ago

The POST endpoint is actually supposed to give a symbol but not symbols. The documentation has been addressed.

mtcliatt commented 4 years ago

It looks like this is also the case for "POST create a Watchlist".