CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 76% of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money.
US English

API Documentation

WebSocket API

Starting a stream

In order to start using WebSocket connect to wss://api-streaming-capital.backend-capital.com/connect . In order to keep the connection alive, ping service at least once every 10 minutes.

Streams available

marketData.subscribe

To subscribe to the price updates by mentioning the epics.
Note: the max number of epics = 40

Request:
{
 "destination": "marketData.subscribe",
 "correlationId": 1,
 "cst": "zvkT26****nsHKk",
 "securityToken": "g6K90****QKvCS7",
 "payload": {
 "epics": [
 "OIL_CRUDE"
 ]
 }
}
Response:
{
 "status": "OK",
 "destination": "marketData.subscribe",
 "correlationId": "1",
 "payload": {
 "subscriptions": {
 "OIL_CRUDE": "PROCESSED"
 }
 }
}

marketData.unsubscribe

To unsubscribe from the prices updates.

Request:
{
 "destination": "marketData.unsubscribe",
 "correlationId": 1,
 "cst": "zvkT26****nsHKk",
 "securityToken": "g6K90****QKvCS7",
 "payload": {
 "epics": [
 "OIL_CRUDE"
 ]
 }
}
Response:
{
 "status": "OK",
 "destination": "marketData.unsubscribe",
 "correlationId": "1",
 "payload": {
 "subscriptions": {
 "OIL_CRUDE": "PROCESSED"
 }
 }
}

Ping

To ping the service for keeping the connection alive.

Response:
 {
 "destination": "ping",
 "correlationId": 1,
 "cst": "zvkT26****nsHKk",
 "securityToken": "g6K90****QKvCS7"
 } 
Response:
{
 "status": "OK",
 "destination": "ping",
 "correlationId": "1",
 "payload": {}
}

Still looking for a broker you can trust?

Join the 650,000+ traders worldwide that chose to trade with Capital.com

1. Create & verify your account 2. Make your first deposit 3. You’re all set. Start trading