Broker API HubMenu

Capital.com marketData.unsubscribe

messagemarketData.unsubscribeCapital.com WebSocket APIWebSocketLive prices

Stops live price updates for a list of epics. An answer confirms each epic that was unsubscribed.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Independent and unofficialopen-api.capital.comchecked

This is a message of the Capital.com WebSocket API, not an HTTP endpoint. It has no method and no path: it is sent as JSON over an open WebSocket connection.

The message

Name
marketData.unsubscribe
Direction
Request, sent by the client
Carried by
WebSocket. Capital.com's page says to ping the service at least once every 10 minutes to keep the connection alive.
WebSocket address
wss://api-streaming-capital.backend-capital.com/connect

Fields

The vendor's page does not say which of these fields are required or always present.

NameTypeDescription
destinationNot statedNames the message, in the way a path names a REST call. Here it is marketData.unsubscribe.
correlationIdNot statedAn id of your own. The answer carries the same value, which is how an answer is matched to its request.
cstNot statedThe token that identifies the client. It is the CST value returned when a session is started over REST.
securityTokenNot statedThe token that identifies the account in use. It is the X-SECURITY-TOKEN value returned when a session is started over REST.
payload.epicsNot statedThe epics to stop, as a list of strings.

What arrives

marketData.unsubscribe: The confirmation that the updates were stopped.

The vendor's page does not say which of these fields are required or always present.

NameTypeDescription
statusNot statedOK in the vendor's example of a successful answer.
destinationNot statedThe destination of the request it answers: marketData.unsubscribe.
correlationIdNot statedThe correlationId the request carried.
payload.subscriptionsNot statedAn object with one entry for each epic named. In the vendor's example the value is PROCESSED.

Sample

Written by this site from the fields recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where a field holds one, the placeholder says where it comes from. Nothing is entered on this site.

{
  "destination": "marketData.unsubscribe",
  "correlationId": "2",
  "cst": "<the CST token of your session, from your own environment>",
  "securityToken": "<the X-SECURITY-TOKEN of your session, from your own environment>",
  "payload": {
    "epics": [
      "OIL_CRUDE"
    ]
  }
}

Limits that apply at Capital.com

LimitValueScopeSource
Headline limit10/s per useruseropen-api.capital.comchecked