Websocket Streaming

Receive realtime trades data

Trades/ Ticks Realtime-Data

The websocket streaming uses standard websockets, currently without restricted access. You can always get realtime data on behalf of an instrument. Therefore you have to subscribe to this instrument, using a so called specifier to define your type of data.

the URL of our ticks websocket endpoint is wss://api.lemon.markets/streams/v1/marketdata

Parameters to be send to the websocket as JSON:

Parameter Name

Parameter Value

action

"subscribe" or "unsubscribe"

specifier

"with-quantity" or "with-uncovered" or "with-quantity-with-uncovered".

  • with-quantity means that the data is delivered giving a quantity at execution

  • with-uncovered means that trades are delivered which would have been executed if someone would have bought the stock (this is special due to the Market Maker system at Lang & Schwarz) - this is default

  • with-quantity-with-uncovered combines both

value

ISIN of the instrument

Example for getting realtime data of Tesla:

SEND {"action": "subscribe", "specifier": "with-uncovered", "value": "US88160R1014"}

Afterwards, the websocket will deliver data like:

{"isin": "US88160R1014", "price": "410.22", "date": 1598990400.100}

Websockets follow the "fire-and-forget" approach. Nevertheless, if your websocket is not open you can still query the same data using the /ticks/ endpoint (documented in the next step).

Orderbook/ Quotes Realtime-Data

the URL of our quotes websocket endpoint is wss://api.lemon.markets/streams/v1/quotes

Subscribing to the real-time orderbook/ quotes data is similar to subscribing to the trades websocket. We only provide level one (L1) orderbook data. This L1 data is also named "quotes" due to the Market Maker system at Lang & Schwarz.

You have to subscribe to an instrument, using those parameters:

Parameter Name

Parameter Value

action

"subscribe" or "unsubscribe"

specifier

"with-quantity", "with-price" or "with-quantity-with-price"

  • with-quantity means that only the quantity of the bid/ ask prices are returned, not the prices itself

  • with-price means that only the bid/ ask prices will be returned, not their corresponding quantities. This is default

  • with-quantity-with-price means that both prices and their corresponding quantities are returned.

value

ISIN of the instrument

Example of getting getting realtime quotes data for Tesla:

SEND {"action": "subscribe", "specifier": "with-price", "value": "US88160R1014"}

You will get following response:

{"isin": "US88160R1014", "bid_price": 380.1, "ask_price": 380.15, "date": 1600000400.100}

Note that every websocket connection is short-lived. The connection will be dropped after one hour, so please use a reconnecting websocket.