The search API allows you to compare customers in the eToro system according to their periodic performance. A search query consists of several components

  • Period (Mandatory) specifying the period in which we would like to compare customers
  • Paging (Optional) specifying the page size and the requested page number
  • Order (Optional) specifying the sorting order of the result set
  • Filter (Optional) specifying the filter on the customers

The following sections will explain each component

Period

The period parameter specifies the periodic activity which we would like to compare. The full period list can be obtained using the Metadata/StatPeriods API

Paging

The following are the paging parameters

Parameter Name Description
Page integer Requested page number. Defaults to 1 if omitted
PageSize integer The requested page size

Using the combination of the Page and PageSize it is possible to create paging on the result set. Each response contains a member named totalItems which specifies the total number of customers who meet the criteria.

The result set which will be returned will be filtered, ordered and then we will attempt to retrieve the relevant page. If the calculation of (Page - 1) * PageSize exceeds the result set size, and empty result set will be returned

Ordering

The ordering section determines the sorting order of the result set. It is possible to sort multiple columns and define their order. The general syntax for sorting is as following:

Sort={sort column 1}[, {sort column 2}, ...]

The sort column is the member name. By default the order is Ascending. If Descending order is required a '-' sign should prefix the name. For example if we want to sort according to copiers in a descending order and a secondary sort according to the risk score in an ascending mode the following should be used:

Sort=-Copiers,Risk

Filtering

All the numeric columns in the response are eligible for filtering. A column can be filtered either with a numeric range or by discreet values. The filtering method of each property can be seen using the Discovery/Metadata API.

Here is a sample of two items in the metadata response:
[
{
"name": "UserName",
"displayName": "Username",
"description": "The username of the customer",
"type": "string",
"group": "Demographics",
"operation": "None"
},
{
"name": "WeeksSinceRegistration",
"displayName": "Weeks Since Registration",
"description": "Number of weeks since registration",
"type": "integer",
"group": "Demographics",
"operation": "MinMax"
},
{
"name": "CountryId",
"displayName": "Country ID",
"description": "The registerd country ID of the user",
"type": "integer",
"group": "Demographics",
"operation": "In"
}
]

As you can see we have three member descriptors. The filtering strategy is represented by the operation keyword. The first member (UserName) does not support filtering. The second member (WeeksSinceRegistration) supports a MinMax filtering strategy and the last member (CountryId) supports the In strategy.

MinMax Filtering

In the MinMax filtering strategy you may specify minimum and maximum values for the property. The method to specify it in the query string is by suffixing the property name with either or Max.

For example let's assume we want to filter customers who are in the system for at least 20 weeks, we should add a query parameter of

WeeksSinceRegistrationMin=20

If we would like to address customers who are in the system between 20 and 50 weeks, we should add the following query parameters

WeeksSinceRegistrationMin=20&WeeksSinceRegistrationMax=50

IN Filtering

IN Filtering enables us to specify discreet values for filtering. While constructing the query string the values should be comma delimited. For example, in order to filter customers from country IDs 3, 74 and 89 we'll add the following query string

CountryID=3,74,89