TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Open a WebSocket that pushes a stock tick every second

GETwss://api.testingapis.com/ws/tickerSign in to see this endpoint's URL

Each message is {"type":"tick","data":{...}}. After the last tick the server sends {"type":"complete"} and closes with 1000 "Ticker finished". Closing from the client stops the ticker early.

Swagger UI cannot open WebSockets. Use a WebSocket client instead:``wscat -c "wss://api.testingapis.com/ws/ticker?count=10"Swagger UI cannot open WebSockets. Use a WebSocket client instead:``wscat -c "wss://api.testingapis.com…"

Parameters 1

NameTypeDescription
countquery · integer (int32)Number of ticks before the server closes (1-300, default 30). Default: 30.

Responses

200
OK
101
Switching Protocols: the WebSocket is open.
400
The request was plain HTTP rather than a WebSocket upgrade.

Example

Request
curl -X GET "https://api.testingapis.com/ws/ticker?count=3" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response
WebSocket. Connect with ws://{host}/ws/ticker?count=3. The server pushes one JSON tick per second, then a completion message and a normal close.
< {"type":"tick","seq":1,"symbol":"APIB","price":101.25,…}
< {"type":"tick","seq":2,…}
< {"type":"complete","ticks":3}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.