Websockets

You can access any endpoint via websockets if you have subscriped to the premium or enterprise package.

Websockets support bidirectional communication and reduce latency and are recommended for realtime data.

Getting Started

The format of the websocket request is the following:

json = {
  "action": <action>,
  "symbol": <symbol>,
}

and the data is the same as the body parameter that you will send to the REST-API.

The work similar to the REST-API:

  1. First connect to wss://ws.bavest.co/v0 and use the header {"x-api-key": "<API KEY>" }
  2. Send the json to the socket
  3. Response is the same as REST-API response

CLI command:
wscat -c "wss://ws.bavest.co/v0" -H "x-api-key: <API KEY>"

Actions

ActionDescriptionReference
pingPing the websocket to keep active.None
quoteThe quote endpoint. The difference between /quote and /stock/quote is that /quote is realtime.Quote
stock/candleThe stock candle endpoint returnss the candles for a given symbol or ISIN. Candles are from EURONEXT.Historical Stock Data
stock/dividendGet dividends data for common stocks going back 30 years.Stock Dividends
stock/fundamentalsThe stock fundamentals endpoint.Fundamentals
stock/esgThe stock ESG endpoint returnss company ESG data.ESG
stock/financialsThe stock financials endpoint returns the financials e.g. balance sheet, income sheet or cashflow statement.Financials
stock/metricGet company price performance statistics such as 52-week high/low, returns and growth rations.Metrics
stock/newsThe news endpoint returns the latest stock news.News
stock/peersThe stock widget peers endpoint.Peers
stock/profileGet general information of a company.Profile

For more information read the REST API documentation.

Other Actions

The pingcommand is used to keep the socket alive. The socket will close after 15min of inactivity. Therefore, it is required to send a periodically ping. The Websocket return pong to indicate that the socket is alive.