eToro

eToro Logo









The following section is the documentation of the Quotek SDK eToro OpenBook API Client.

eToro is the biggest social trading platform, and this client will allow you to enrich your trading algorithms with copy-trade functionalities.

You can for instance fetch the list of the most successul traders on the platform and get their open positions to correlate them with your own trading signals and indicators.

The eToro Client is also able to give you the market sentiment of the traders on the platform for a large amount of assets, using the insight() function.

class quotek::datasource::etoro

etoro is a class meant to make easy queries to the eToro OpenBook API.

Inherits from quotek::datasource::datasource

Public Functions

etoro()

Class Constructor.

~etoro()

Class Destructor.

std::vector<quotek::datasource::eto_user> ranking(int period, std::string risk_level, std::string sort_type)

Gets a ranking of the eToro users given specific parameters.

Return
a list of eto_users.
Parameters
  • period -

    Time period in days, for which you want to get the ranking.

  • risk_level -

    Tells for which kind of risk profile you want the ranking. risk_level can be “Low”, “Medium” or “High”.

  • sort_type -

    Tells how you want to sort the users list sorted. Can be “Copiers” or “Gain”.

std::vector<std::vector<quotek::datasource::eto_user>> top()

A little like ranking(), top returns the list of the 5 first eToro users that perfomed the most by copiers on 3 , 6 and 12 months period of time.

Return
a 3 elements vector of ranked users vectors

std::vector<quotek::core::position> positions(std::string username, std::string pos_type, std::string pos_time)

Gets the eToro portolio of an user, given his/her username and extra parameters.

Return
The user’s portfolio, under the form of vector of quotek position objects.
Parameters
  • username -

    User Name of the user you want to get the portfolio for.

  • pos_type -

    Type of positions you want to retrieve. pos_type can be “Real” or “Demo”.

  • pos_time -

    Tells if you to get current or historical positions. pos_time can be “Current” or “History”.

std::vector<std::string> symbols(std::string category)

Symbols fetch the full list of eToro symbols for a given market category.

Return
the list of symbols for the given market.
Parameters
  • category -

    Market Category we want to get symbols for. Can be either “currencies”, “commodities”, “indices” and “stocks”.

std::vector<float> insight(std::string symbol, std::string category)

insight is a function returning the long/short ratio of the eToro users positions for a given market. If open positions on GOLD are 70% long and 30% short, then the result of insight(“Gold”,”commodities”) will be (70,30).

Return
a 2-elements vector of float number containing both the long ratio and the short ratio.
Parameters
  • symbol -

    symbol of the market we want insight for.

  • category -

    Market Category the symbol is in. Can be either “currencies”, “commodities”, “indices” and “stocks”. If you want insight for symbol “Gold” then category will be “commodities”, for “EUR/USD” it will be “currentcies”, etc..

class quotek::datasource::eto_user

Public Members

std::string username

user name.

float max_drawdown

Maximum drawdown.

int copiers

Number of copiers follwing the user.

float gain

Amount of gain/losses in percents

float profitable_weeks

Number of weeks the user was in profit.

int rank

Rank of the user

Example

You will find below and sample source code about how to use the Quotek’s eToro OpenBook client.

#include <quotek/quotek.hpp>
#include <quotek/datasources/etoro.hpp>
using namespace quotek::datasource;
using namespace quotek::data;

int main(int argc, char** argv) {

  //creates a new etoro object
  etoro et1;

  /* Fetches the list of the most succesful traders for the last
  30 days and which use medium risk strategies. */
  std::vector<eto_user> e_users = et1.ranking(30, "Medium","Gain");

  /* Then prints their respective usernames and gains */
  for (int i=0;i< e_users.size(); i++) {
    std::cout << e_users[i].username << std::endl;
    std::cout << e_users[i].gain << std::endl;
  }

  /* Now we will get the trader's insight for the Gold asset. */
  std::vector<float> gsent = et1.insight("Gold","commodities");
  std::cout << "GOLD LONG/SHORT RATIO:" << gsent[0] << "/" << gsent[1];

}