Config (Basic settings & Accesses)

Configuration endpoint description

Get config

GET/traderevolution/v1/config

This method is used to understand the data structure that will be returned in responses as well as to find out what panels are visible to your user at the moment. No additional parameters except the token are used in the request, see CURL example.

CURL

curl -X GET "https://sandbox-api.traderevolution.com/traderevolution/v1/config" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiI3NDhlZjYwZS1mZjZjZmEiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJpcnluYW0iLC...25Sfq5MqcUSbhS0U47YmrBq_OlfcTWaez-Y4Yy9KNsQw2aFCW40k9XTF7wY0cpJ6SMGEQ33ayUYQ_NmX5i-UQ"

Response

{
  "s": "ok",
  "d": {
    "customerAccess": {
      "orders": true,
      "ordersHistory": true,
      "filledOrders": true,
      "positions": true,
      "symbolInfo": true,
      "marketDepth": true
    },
    "positionsConfig": {
      "id": "positions",
      "title": "Positions",
      "columns": [
        {
          "id": "id"
        },
        {
          "id": "tradableInstrumentId"
        },
        {
          "id": "side"
        },
        {
          "id": "qty"
        },
        {
          "id": "avgPrice"
        },
        {
          "id": "stopLossId"
        },
        {
          "id": "takeProfitId"
        },
        {
          "id": "openDate"
        },
        {
          "id": "unrealizedPl"
        },
        {
          "id": "instrumentName"
        },
        {
          "id": "instrumentType"
        },
        {
          "id": "tradingExchange"
        },
        {
          "id": "stopLoss"
        },
        {
          "id": "takeProfit"
        },
        {
          "id": "commission"
        },
        {
          "id": "swaps"
        }
      ]
    },
    "ordersConfig": {
      "id": "orders",
      "title": "Orders",
      "columns": [
        {
          "id": "id"
        },
        {
          "id": "tradableInstrumentId"
        },
        {
          "id": "qty"
        },
        {
          "id": "side"
        },
        {
          "id": "type"
        },
        {
          "id": "status"
        },
        {
          "id": "filledQty"
        },
        {
          "id": "avgPrice"
        },
        {
          "id": "price"
        },
        {
          "id": "stopPrice"
        },
        {
          "id": "validity"
        },
        {
          "id": "expireDate"
        },
        {
          "id": "createdDate"
        },
        {
          "id": "lastModified"
        },
        {
          "id": "isOpen"
        },
        {
          "id": "positionId"
        },
        {
          "id": "stopLoss"
        },
        {
          "id": "stopLossType"
        },
        {
          "id": "takeProfit"
        },
        {
          "id": "takeProfitType"
        },
        {
          "id": "instrumentName"
        },
        {
          "id": "instrumentType"
        },
        {
          "id": "tradingExchange"
        },
        {
          "id": "userComment"
        },
        {
          "id": "overnightExecution"
        }
      ]
    },
    "ordersHistoryConfig": {
      "id": "ordersHistory",
      "title": "Orders history",
      "columns": [
        {
          "id": "id"
        },
        {
          "id": "tradableInstrumentId"
        },
        {
          "id": "qty"
        },
        {
          "id": "side"
        },
        {
          "id": "type"
        },
        {
          "id": "status"
        },
        {
          "id": "filledQty"
        },
        {
          "id": "avgPrice"
        },
        {
          "id": "price"
        },
        {
          "id": "stopPrice"
        },
        {
          "id": "validity"
        },
        {
          "id": "expireDate"
        },
        {
          "id": "createdDate"
        },
        {
          "id": "lastModified"
        },
        {
          "id": "isOpen"
        },
        {
          "id": "positionId"
        },
        {
          "id": "stopLoss"
        },
        {
          "id": "stopLossType"
        },
        {
          "id": "takeProfit"
        },
        {
          "id": "takeProfitType"
        },
        {
          "id": "instrumentName"
        },
        {
          "id": "instrumentType"
        },
        {
          "id": "tradingExchange"
        },
        {
          "id": "userComment"
        },
        {
          "id": "overnightExecution"
        }
      ]
    },
    "filledOrdersConfig": {
      "id": "filledOrders",
      "title": "Filled orders",
       "columns": [
        {
          "id": "id"
        },
        {
          "id": "price"
        },
        {
          "id": "side"
        },
        {
          "id": "createdDate"
        },
        {
          "id": "qty"
        },
        {
          "id": "orderId"
        },
        {
          "id": "positionId"
        },
        {
          "id": "tradableInstrumentId"
        },
        {
          "id": "instrumentName"
        },
        {
          "id": "instrumentType"
        },
        {
          "id": "tradingExchange"
        },
        {
          "id": "pnl"
        },
        {
          "id": "positionStatus"
        },
        {
          "id": "positionAmount"
        },
        {
          "id": "positionChange"
        },
        {
          "id": "eventTrigger"
        },
        {
          "id": "positionSide"
        },
        {
          "id": "eventId"
        }
      ]
    },
    "accountDetailsConfig": {
      "id": "accountDetails",
      "title": "Account details",
      "columns": [
        {
          "id": "balance",
          "description": "A current realized balance of an account."
        },
        {
          "id": "projectedBalance",
          "description": "A future balance which includes all accrued and not accrued profit/loss."
        },
        {
          "id": "availableFunds",
          "description": "Amount of funds which can be used for trading."
        },
        {
          "id": "blockedBalance",
          "description": "Balance blocked by a broker or by a user for withdrawal/transfer."
        },
        {
          "id": "cashBalance",
          "description": "A current cash position for an account with taken into account unsettled profit/loss."
        },
        {
          "id": "unsettledCash",
          "description": "Cash sum of unsettled account operations, which have not been delivered to an account yet and will be delivered in accordance with T+n settlement system."
        },
        {
          "id": "withdrawalAvailable",
          "description": "Shows an amount of cash that you can withdraw immediately from your account."
        },
        {
          "id": "stocksValue",
          "description": "A total cost of assets, traded with Stock pre-paid margin type, positions of which are open on a selected account."
        },
        {
          "id": "optionValue",
          "description": "Current option value in portfolio. Can be positive for a long Net position, or negative for a short Net position. Option value is calculated only for Options with Option trading style 'Premium-style' or 'Market-to-market'. Option trading style is set up by a broker."
        },
        {
          "id": "initialMarginReq",
          "description": "Amount of initial margin blocked for all positions and orders taking into account a margin crossing."
        },
        {
          "id": "maintMarginReq",
          "description": "Total margin used for maintenance of a current portfolio in account currency."
        },
        {
          "id": "marginWarningLevel",
          "description": "Shows Maintenance margin level."
        },
        {
          "id": "blockedForStocks",
          "description": "Amount of funds debited from a balance in case of trading with symbols with Stocks pre-paid margin type. After closing such position, funds will be returned to an account. Stock operations can be pending."
        },
        {
          "id": "stockOrdersReq",
          "description": "Total margin blocked for orders with Stock pre-paid margin type."
        },
        {
          "id": "stopOutLevel",
          "description": "Maintenance margin level value needed for the stop out to occur."
        },
        {
          "id": "warningMarginReq",
          "description": "Warning margin requirement for positions and orders."
        },
        {
          "id": "marginBeforeWarning",
          "description": "Margin available before warning triggering."
        },
        {
          "id": "todayGross",
          "description": "A gross profit for today."
        },
        {
          "id": "todayNet",
          "description": "A total profit or loss realized from positions today."
        },
        {
          "id": "todayFees",
          "description": "Fees paid today."
        },
        {
          "id": "todayVolume",
          "description": "A total volume traded for today."
        },
        {
          "id": "todayTradesCount",
          "description": "A number of trades done for today."
        },
        {
          "id": "openGrossPnL",
          "description": "A profit or loss on all currently opened positions and currency, recalculated in real-time based on the most recent quotes"
        },
        {
          "id": "openNetPnL",
          "description": "A net profit or loss on open positions."
        },
        {
          "id": "positionsCount",
          "description": "A number of currently opened positions."
        },
        {
          "id": "ordersCount",
          "description": "A number of currently placed pending orders."
        },
        {
          "id": "maintenanceMarginReqPercent",
          "description": "Shows how much maintenance margin is used in relation to available equity."
        },
        {
          "id": "initialMarginReqPercent",
          "description": "Shows how much initial margin is used in relation to available equity."
        },
        {
          "id": "warningMarginReqPercent",
          "description": "Shows how much warning margin is used in relation to available equity."
        },
        {
          "id": "stopOutValue",
          "description": "Shows maintenance margin level when stop out is triggered."
        },
        {
          "id": "availableCash",
          "description": "Amount of funds the user still has to invest before going into leverage."
        },
        {
          "id": "totalPositionsValue",
          "description": "Sum of all positions values at the moment calculated on base of a current market price."
        },
        {
          "id": "freeCommission",
          "description": "Available sum of free commission in accounts currency."
        },
        {
          "id": "creditValue",
          "description": "An amount of credit funds which account can’t withdraw, but can trade with."
        },
        {
          "id": "blockedForFixedIncome",
          "description": "Blocked for fixed income"
        },
        {
          "id": "fixedIncomeOrdersReq",
          "description": "Fixed income orders req"
        },
        {
          "id": "fixedIncomeValue",
          "description": "Fixed income value"
        }
      ]
    },
    "rateLimits": [
      {
        "rateLimitType": "GET_ACCOUNTS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_EXECUTIONS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_INSTRUMENTS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_ORDERS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_ORDERS_HISTORY",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_POSITIONS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 5
      },
      {
        "rateLimitType": "GET_ACCOUNTS_STATE",
        "measure": "SECONDS",
        "intervalNum": 2,
        "limit": 1
      },
      {
        "rateLimitType": "GET_INSTRUMENT_DETAILS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_TRADE_SESSIONS",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "GET_SESSION_STATUSES",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 2
      },
      {
        "rateLimitType": "PLACE_ORDER",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 1
      },
      {
        "rateLimitType": "MODIFY_ORDER",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 1
      },
      {
        "rateLimitType": "MODIFY_POSITION",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 1
      },
      {
        "rateLimitType": "DAILY_BAR",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 5
      },
      {
        "rateLimitType": "QUOTES",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 10
      },
      {
        "rateLimitType": "DEPTH",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 10
      },
      {
        "rateLimitType": "TRADES",
        "measure": "SECONDS",
        "intervalNum": 1,
        "limit": 5
      },
      {
        "rateLimitType": "QUOTES_HISTORY",
        "measure": "MINUTES",
        "intervalNum": 1,
        "limit": 60
      }
    ],
    "limits": [
      {
        "limitType": "QUOTES_HISTORY_BARS",
        "limit": 400000
      },
      {
        "limitType": "MAX_ORDERS_COUNT_IN_HISTORY",
        "limit": 200
      }
    ],
    "maxMDSubscriptionsInWS": null
  }
}

This endpoint contains basic settings and accesses for the application/service. The information from the ConfigResponse will help:

  1. To understand the structure of data that will be returned in AccountStateResponse, ExecutionsResponse, OrdersResponse, OrdersHistory model, and PositionsResponse. It is important because specified response models don't contain parameter names, but only an array of values. The names of returned values and their sequences are defined in config objects: accountDetailsConfig, filledOrdersConfig, ordersConfig, ordersHistoryConfig, and positionsConfig.

The current implementation contains the main parameters of each object (orders, position, etc). Additional parameters can be added on demand, but this will require additional development.

  1. To define which panels are available for the user.

The example above illustrates that all panels are available for your user. Access to panels can be managed via the Customer access settings of the BackOffice.

Note: The integrable front-end can use TraderEvolution permissions to grant access to its modules. Or use its own access distribution scheme, ignoring flags in the customerAccess object.

  1. To define limits that are applied for this user.

The first type of limit is the rateLimit. These type looks as follows in the response:

This type of limit defines the interval between requests so that the user cannot spam the server with them. As you can see from the example above, only one trade is allowed every 5 seconds for this user.

The limit is counted against each user (the accessToken defines the user in this case) and on each request that is rate-limited.

When exceeding the Rate Limit, the Server will respond with the X-Rate-Limit-Retry-After-Seconds header to the request that exceeds the limit. It is assumed that the client application will wait for the specified time and then try to perform the request again.

The next type limits the number of Quotes used to form history bars and the number of Orders in the history response. This type is configured on the server level. Here is how this one looks in the response:

The last type limits the number of subscriptions to market data events in the WebSocket connection. You can set this limit via the Stations tab on the User group/User level of the BackOffice.

Last updated