const res = await fetch('https://app.trdrs.co/api/market/streams?subs=ESU6~5m%2CNQU6~1m', {
headers: { Authorization: `Bearer ${process.env.TRDRS_API_KEY}` },
})
const decoder = new TextDecoder()
for await (const chunk of res.body!) {
// Each SSE frame: "event: <name>\ndata: <json>\n\n". Snapshot first, then live events.
process.stdout.write(decoder.decode(chunk as Uint8Array))
}curl -N 'https://app.trdrs.co/api/market/streams?subs=ESU6~5m%2CNQU6~1m' \
-H "Authorization: Bearer $TRDRS_API_KEY"import requests
url = "https://app.trdrs.co/api/market/streams"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trdrs.co/api/market/streams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trdrs.co/api/market/streams"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.trdrs.co/api/market/streams")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trdrs.co/api/market/streams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body"<string>"{
"error": "invalid_instrument"
}Stream multiplexed live bars
Streams many bar subscriptions over one Server-Sent Events connection. Content-Type: text/event-stream. One connection carries every chart of a layout: browsers cap concurrent HTTP/1.1 connections per origin, so a client with several charts subscribes them all here rather than opening a stream per chart. subs is a comma-separated list of INSTRUMENT~tf tokens (percent-encode each instrument; ~ and , never occur in instrument symbols), max 24, duplicates collapse. Events are the single-stream events with every payload carrying instrument and tf for demultiplexing: snapshot { instrument, tf, bars: WireBar[] }, bar { instrument, tf, bar: WireBar }, quote { instrument, bid, ask }, and error { instrument, tf, code, message }. A refused or failed subscription (the 503 codes of the single-subscription route, or its terminal stream codes) becomes a tagged error event while the connection and every other subscription live on; only session_expired — the signed-in viewer’s own session ending — closes the whole channel. To change the subscription set, reconnect with the new subs: every (re)connect replays a fresh snapshot per subscription, so no client bookkeeping survives a reconnect. Junk tokens drop silently; a request whose tokens all drop answers 400.
const res = await fetch('https://app.trdrs.co/api/market/streams?subs=ESU6~5m%2CNQU6~1m', {
headers: { Authorization: `Bearer ${process.env.TRDRS_API_KEY}` },
})
const decoder = new TextDecoder()
for await (const chunk of res.body!) {
// Each SSE frame: "event: <name>\ndata: <json>\n\n". Snapshot first, then live events.
process.stdout.write(decoder.decode(chunk as Uint8Array))
}curl -N 'https://app.trdrs.co/api/market/streams?subs=ESU6~5m%2CNQU6~1m' \
-H "Authorization: Bearer $TRDRS_API_KEY"import requests
url = "https://app.trdrs.co/api/market/streams"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trdrs.co/api/market/streams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trdrs.co/api/market/streams"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.trdrs.co/api/market/streams")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trdrs.co/api/market/streams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body"<string>"{
"error": "invalid_instrument"
}