Q4API Docs
Q4 APISign inGet API key
DocumentationAPI Reference
Overview
API reference
Companies
GETList companiesGETRetrieve a companyGETList sectors
Market data
GETRetrieve a quoteGETList quotesGETRetrieve price historyGETRetrieve index historyGETRetrieve market summaryGETList market moversGETList sector performanceGETList tradesGETRetrieve order book depth
WebSocket
WSQuotes streamWSTrades streamWSDepth stream
Fundamentals
GETRetrieve standardised statementsGETRetrieve as-reported statementsGETList figuresGETRetrieve ratiosGETCompare companiesGETList dividendsGETList corporate actionsGETList stock eventsGETSearch notes
Documents
GETList documentsGETRetrieve a documentGETList document pagesGETRetrieve document textGETRetrieve document summaryGETList notesGETRetrieve a noteGETList sectionsGETRetrieve a sectionGETSearch board report sections
Earnings calls
GETList earnings callsGETRetrieve an earnings callGETRetrieve a transcriptGETRetrieve call audio
Announcements
GETList announcementsGETRetrieve an announcement
Economic data
GETList seriesGETList observations
Webhooks & alerts
POSTCreate a webhookGETList webhooksDELDelete a webhookPOSTCreate an alert ruleGETList alert rulesDELDelete an alert rule
Account
GETRetrieve usage
WebSocket

Depth stream

WSwss://api.q4.sa/v1/ws/depth
Pushes the top 10 levels of the order book whenever they change.
Business+

Authorization

api_keyqueryrequired
Your API key. See Authentication.

Messages

SENDsubscribe
Start receiving depth for these symbols.
RECEIVEdepth
The book changed. Always a full 10-level snapshot.
← Previous
Trades stream
Next →
Retrieve standardised statements
Connect
const ws = new WebSocket("wss://api.q4.sa/v1/ws/depth?api_key=" + process.env.Q4_API_KEY);

ws.onopen = () => ws.send(JSON.stringify({"action":"subscribe","symbols":["2222"]}));
ws.onmessage = (event) => console.log(JSON.parse(event.data));
Messages
{
  "action": "subscribe",
  "symbols": [
    "2222"
  ]
}