I address alpaca sandbox via:
https://paper-api.alpaca.markets/stream
to set up a websocket connection.
Alpaca starts returning an error after a certain load:
{“message”: “too many requests.”},
which .NET converts to an exception:
System.Net.WebSockets.WebSocketException (0x80004005): The server returned status code ‘429’ when status code ‘101’ was expected.
at System.Net.WebSockets.WebSocketHandle.ValidateResponse(HttpResponseMessage response, String secValue)
at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options)
at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken)
at Websocket.Client.WebsocketClient.<>c.<<-ctor>b__19_0>d.MoveNext()
This restriction is imposed not on the account, but on the IP, because the same error is produced by a simple curl request of the form:
curl https://paper-api.alpaca.markets/stream
I couldn’t find how many calls I have for websocket calls. There is no info on this in the documentation. 200 call is for AN ACCOUNT, but I wonder about IP