New in 2.4: Test runs you can trust See what's new →

Stream a deterministic stock ticker as Server-Sent Events

GEThttps://api.testingapis.com/api/stream/sse/stock

Each event: tick carries symbol, price, change, changePercent, volume and timestamp. The same tick number always yields the same symbol and price. The stream ends with event: done.

Swagger UI cannot display streams. Use curl instead:``curl -N "https://api.testingapis.com/api/stream/sse/stock?count=5"

Parameters 2

NameTypeDescription
countquery · integer (int32)Number of ticks to send (1-100, default 20). Default: 20.
intervalquery · integer (int32)Delay between ticks in milliseconds (100-5000, default 1000). Default: 1000.

Responses

200
A text/event-stream of ticks.

Example

Request
curl -X GET "https://api.testingapis.com/api/stream/sse/stock?count=3"
Run in Studio
Response200 OK
Content-Type: text/event-stream
Cache-Control: no-cache

retry: 3000

id: 1
event: tick
data: {"tick":1,"symbol":"AAPL","name":"Apple Inc.","price":230.19,"change":2.67,"changePercent":1.17,"volume":10137,"timestamp":"2026-09-30T18:26:40.…

id: 2
event: tick
data: {"tick":2,"symbol":"MSFT","name":"Microsoft Corp.","price":444.51,"change":6.40,"changePercent":1.46,"volume":10274,"timestamp":"2026-09-30T18:2…

id: 3
event: tick
data: {"tick":3,"symbol":"GOOGL","name":"Alphabet Inc.","price":177.47,"change":1.13,"changePercent":0.64,"volume":10411,"timestamp":"2026-09-30T18:26…

… (1 more lines)

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/stream/sse/stock?count=3");
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/stream/sse/stock?count=3",
    allow_redirects=False,
)
print(response.status_code, response.text)
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.NEVER)
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.testingapis.com/api/stream/sse/stock?count=3"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}