Market Data Websocket

You can refer to the endpoints in this page to learn how to get websocket connection and use it in your application


Creating websocket url

Generates a WebSocket URL for connecting to real-time market data feeds. The returned URL remains valid until the user is deactivated or the connection is explicitly revoked.

curl --request POST \
  --url https://api.getlaplace.com/api/v2/ws/url \
  --header 'Authorization: Bearer your-api-key' \
  --header 'Content-Type: application/json' \
  --data '{
  "externalUserId": "1234",
  "feeds": "[live_price_tr]"
}'

Parameters

NameDescriptionExampleParameter TypeData Type
externalUserId
This is a value that you can use to correspond to user in your system, each non revoked and existing unique externalUserId will be counted towards your limit
1234bodystring
feeds
This denotes the feeds this websocket url can be connected to
[live_price_tr]bodyarray

Response

(Note: Actual response can be different length and other fields may be present)

▼"root" : { 1 items … }
"url" : string"wss://socket.finfree.app/api/v2/ws/61278cca-edf5-4848-9508-4d78d429e977"
}

Revoke websocket connection

Revokes an active WebSocket connection and invalidates the associated stream URL.

curl --request POST \
  --url https://api.getlaplace.com/api/v1/ws/user/revoke/61278cca-edf5-4848-9508-4d78d429e977 \
  --header 'Authorization: Bearer your-api-key'

Parameters

NameDescriptionExampleParameter TypeData Type
id
Pass the id from the last part of the websocket url
61278cca-edf5-4848-9508-4d78d429e977pathstring

Using the Websocket

This is used to connect to websocket. One socket connection can be used to get data from multiple feeds

curl --request  \
  --url https://api.getlaplace.com/api/v2/ws/61278cca-edf5-4848-9508-4d78d429e977 \
  --header 'Authorization: Bearer your-api-key' \
  --header 'Content-Type: application/json' \
  --data '{
  "feed": "live_price_tr",
  "type": "subscribe",
  "symbols": [
    "AKBNK",
    "ASELS"
  ]
}'

Parameters

NameDescriptionExampleParameter TypeData Type
id
Pass the id from the last part of the websocket url
61278cca-edf5-4848-9508-4d78d429e977pathstring
feed
This is the feed you want to connect, only the values that passed while creating the url can be used
live_price_trbodystring
type
Pass the id from the last part of the websocket url
bodystring
symbols
Pass the symbols you want to subscribe or unsubscribe
AKBNK, ASELSbodyarray

© 2024 Laplace API. All rights reserved.