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

Quotes stream

WSwss://api.q4.sa/v1/ws/stocks
Pushes a quote every time a subscribed stock’s price, volume or best bid and ask changes.
Pro+

Connect with your key in the api_key query parameter, then send subscribe with up to 60 symbols on Pro and 120 on Business. See Connecting.

Authorization

api_keyqueryrequired
Your API key. See Authentication.

Messages

SENDsubscribe
Start receiving quotes for these symbols.
SENDunsubscribe
Stop receiving quotes for these symbols.
RECEIVEquote
A quote changed.
← Previous
Retrieve order book depth
Next →
Trades stream
Connect
const ws = new WebSocket("wss://api.q4.sa/v1/ws/stocks?api_key=" + process.env.Q4_API_KEY);

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