Skip to main content

Making Snapshots

In contrast to events, making snapshots is done by performing HTTP requests to various endpoints. You can send these requests using any HTTP client of your choice.

info

All endpoints listed below are relative to https://HOST:PORT/repo. The value of HOST:PORT is provided by Spotware's service assurance team upon request.

info

Note that all requests listed below return arrays of bytes that you can serialise into the required entities. For example, in Java this can be done by calling the parseFrom() method from a suitable static class.

warning

It is only possible to send a maximum of two concurrent requests per server when making shapshots. When requesting a snapshot, make sure to set a timeout of no less than 20 seconds.

It is possible to make snapshots for the following types of entities.

Entity Types

Assets and Symbols

  • assets
  • assetClasses
  • symbols
  • symbolCategories

Traders, Balance, and Bonus

  • traders
  • traderGroups
  • balanceHistories
  • bonusHistories

Orders, Deals, and Positions

  • deals
  • dealOffsets
  • orders
  • positions

Authentications and Actions

  • authentications
  • actions

Reports

  • eodSpotSnapshotReports
  • eodOpenPositionReports
  • eodTraderReports

Prices, Price Streams, and Swaps

  • priceSnapshots
  • priceStreams
  • swapCalculations

Profiles and Holidays

  • commissionProfiles
  • dynamicLeverageProfiles
  • volumeProfiles
  • executionProfiles
  • protectionProfiles
  • swapFreeProfiles
  • scheduleProfiles
  • gslScheduleProfiles
  • swapAndDividendProfiles
  • holidayProfiles
  • holidays

Countries

  • countries

Request a List of Entities

The structure of this request varies depending on the type of entity that you want to learn more about.

Entity Request

All Entity Types Except Reports

HTTP MethodURL
GET/{entity}

Gets a sorted list of entities of the entity type (any type except for eodSpotSnapshotReports, eodOpenPositionReports, and eodTraderReports).

Parameters

ParameterParameter TypeRequired?Data TypeDescription
entitypathYesstringThe type of the entity that you would like to request information about. The full list of permissable entity types is given above.
directionqueryYesstringThe direction in which the requested list of entities should be sorted. This parameter can only take two values.
asc. The list is sorted in ascending order.
desc. The list is sorted in descending order.
sizequeryYesintegerThe maximum possible number of entities that should be returned in the response.
For the traderGroups entity, this parameter can take values ranging from 1 to 5.
For all other entities, this parameter can take values ranging from 100 to 15000.
idqueryNointegerThe entity ID serving as a cut-off point for requesting information.
If direction=asc, the cTrader backend will return all entities whose ID is greater than the specified id.
If direction=desc, the cTrader backend will return all entities whose ID is less than the specified id.

Request Body

No request body.

Output

An array of bytes representing the requested entity(ies).

Request Examples

Requesting the first 100 deals.

curl -X GET "https://HOST:PORT/repo/deals?size=100&direction=asc"

Requesting 100 deals whose IDs are less than 1001.

curl -X GET "https://HOST:PORT/repo/deals?id=1001&size=100&direction=desc"

Requesting the latest 100 deals.

curl -X GET "https://HOST:PORT/repo/deals?size=100&direction=desc"

Response Example

As the response contains only an array of bytes, no specific example can be provided.

Report Entities

HTTP MethodURL
GET/{entity}

Gets a sorted list of entities of the entity type (only eodSpotSnapshotReports, eodOpenPositionReports, and eodTraderReports are accepted as valid types).

Parameters

ParameterParameter TypeRequired?Data TypeDescription
entitypathYesstringThe type of the entity that you would like to request information about. The full list of permissable entity types is given above.
datequeryYesstringThe report date in the YYYY-MM-DD format.
directionqueryYesstringThe direction in which the requested list of entities should be sorted. This parameter can only take two values.
asc. The list is sorted in ascending order.
desc. The list is sorted in descending order.
sizequeryYesintegerThe maximum possible number of entities that should be returned in the response.
For the traderGroups entity, this parameter can take values ranging from 1 to 5.
For all other entities, this parameter can take values ranging from 100 to 15000.
pagequeryYesintegerThe report page number. This parameter can only take positive integer values.

Request Body

No request body.

Output

An array of bytes representing the requested entity(-ies).

Request Examples

Requesting the first 100 reports for 23/12/2021.

curl -X GET "https://HOST:PORT/repo/eodSpotSnapshotReports/2021-12-23?size=100&page=0&direction=asc" -H "Accept: application/x-protobuf"

Response Example

As the response contains only an array of bytes, no specific example can be provided.

Request an Entity by ID

HTTP MethodURL
GET/{entity}/{id}

Gets a single entity with the specified id.

warning

This API call is not available for the actions, eodSpotSnapshotReports, eodOpenPositionReports, and eodTraderReports entities.

Parameters

ParameterParameter TypeRequired?Data TypeDescription
entitypathYesstringThe type of the entity that you would like to request information about. The full list of permissable entity types is given above.
idpathYesintegerThe ID of the entity that you would like to request information about.

Request Body

No request body.

Output

An array of bytes representing the requested entity(ies).

Request Examples

Requesting the authentication entity with id=70.

curl -X GET "https://HOST:PORT/repo/authentications/70"

Response Example

As the response contains only an array of bytes, no specific example can be provided.