Python
import asyncio
import json
import websockets
async def main():
url = "wss://api.pmxt.dev/ws?apiKey=YOUR_PMXT_API_KEY"
async with websockets.connect(url) as ws:
await ws.send(json.dumps({
"id": "btc-stream",
"action": "subscribe",
"method": "watchTicker",
"args": ["BTC/USDT"],
"feed": "binance",
}))
async for raw in ws:
msg = json.loads(raw)
if msg.get("event") == "data":
print(f'{msg["data"]["symbol"]}: ${msg["data"]["last"]}')
asyncio.run(main())const ws = new WebSocket("wss://api.pmxt.dev/ws?apiKey=YOUR_PMXT_API_KEY");
ws.onopen = () => {
ws.send(JSON.stringify({
id: "btc-stream",
action: "subscribe",
method: "watchTicker",
args: ["BTC/USDT"],
feed: "binance",
}));
};
ws.onmessage = (e) => {
const msg = JSON.parse(e.data);
if (msg.event === "data") {
console.log(`${msg.data.symbol}: $${msg.data.last}`);
}
};curl --request GET \
--url https://api.pmxt.dev/api/feeds/{feed}/watchTicker \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pmxt.dev/api/feeds/{feed}/watchTicker"
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://api.pmxt.dev/api/feeds/{feed}/watchTicker")
.header("Authorization", "Bearer <token>")
.asString();{
"success": true,
"data": {
"symbol": "<string>",
"info": "<unknown>",
"timestamp": 123,
"datetime": "2023-11-07T05:31:56Z",
"high": 123,
"low": 123,
"bid": 123,
"bidVolume": 123,
"ask": 123,
"askVolume": 123,
"vwap": 123,
"open": 123,
"close": 123,
"last": 123,
"previousClose": 123,
"change": 123,
"percentage": 123,
"average": 123,
"quoteVolume": 123,
"baseVolume": 123,
"indexPrice": 123,
"markPrice": 123
}
}Data Feeds
Watch Ticker (WebSocket)
Stream live ticker updates for a symbol via WebSocket.
Transport: WebSocket
| Environment | URL |
|---|---|
| Hosted API | wss://api.pmxt.dev/ws?apiKey=YOUR_KEY |
Subscribe:
{ "id": "btc-stream", "action": "subscribe", "method": "watchTicker", "args": ["BTC/USDT"], "feed": "binance" }
Server response:
{ "event": "data", "id": "btc-stream", "method": "watchTicker", "symbol": "BTC/USDT", "source": "binance", "data": { "symbol": "BTC/USDT", "last": 76949.16, "timestamp": 1716148800000, ... } }
Unsubscribe:
{ "id": "btc-stream", "action": "unsubscribe" }
Currently supports Binance feeds only. Tickers stream as they arrive from the Binance trade relay.
GET
/
api
/
feeds
/
{feed}
/
watchTicker
Python
import asyncio
import json
import websockets
async def main():
url = "wss://api.pmxt.dev/ws?apiKey=YOUR_PMXT_API_KEY"
async with websockets.connect(url) as ws:
await ws.send(json.dumps({
"id": "btc-stream",
"action": "subscribe",
"method": "watchTicker",
"args": ["BTC/USDT"],
"feed": "binance",
}))
async for raw in ws:
msg = json.loads(raw)
if msg.get("event") == "data":
print(f'{msg["data"]["symbol"]}: ${msg["data"]["last"]}')
asyncio.run(main())const ws = new WebSocket("wss://api.pmxt.dev/ws?apiKey=YOUR_PMXT_API_KEY");
ws.onopen = () => {
ws.send(JSON.stringify({
id: "btc-stream",
action: "subscribe",
method: "watchTicker",
args: ["BTC/USDT"],
feed: "binance",
}));
};
ws.onmessage = (e) => {
const msg = JSON.parse(e.data);
if (msg.event === "data") {
console.log(`${msg.data.symbol}: $${msg.data.last}`);
}
};curl --request GET \
--url https://api.pmxt.dev/api/feeds/{feed}/watchTicker \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pmxt.dev/api/feeds/{feed}/watchTicker"
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://api.pmxt.dev/api/feeds/{feed}/watchTicker")
.header("Authorization", "Bearer <token>")
.asString();{
"success": true,
"data": {
"symbol": "<string>",
"info": "<unknown>",
"timestamp": 123,
"datetime": "2023-11-07T05:31:56Z",
"high": 123,
"low": 123,
"bid": 123,
"bidVolume": 123,
"ask": 123,
"askVolume": 123,
"vwap": 123,
"open": 123,
"close": 123,
"last": 123,
"previousClose": 123,
"change": 123,
"percentage": 123,
"average": 123,
"quoteVolume": 123,
"baseVolume": 123,
"indexPrice": 123,
"markPrice": 123
}
}Authorizations
Required when calling the hosted API directly (curl, requests, fetch). SDK users pass credentials via constructor params instead.
Path Parameters
The data feed provider.
Available options:
binance, chainlink Query Parameters
Trading pair to stream (e.g. BTC/USDT)
Was this page helpful?

