Skip to main content
Total invested represents the total amount of capital you have allocated across all positions and pending orders. It is calculated by summing all position amounts, mirror position amounts, mirror available amounts (adjusted for closed positions), and pending order amounts.
Total invested only refers to your USD balance.
To retrieve the data needed for this calculation, use the P&L endpoint for either demo or real accounts.

The Calculation Process

Calculating total invested involves fetching your account data and summing all amounts allocated to positions and orders.

1. Endpoints

Use the P&L endpoint to retrieve your account information. Demo Account: GET https://public-api.etoro.com/api/v1/trading/info/demo/pnl Real Account: GET https://public-api.etoro.com/api/v1/trading/info/real/pnl

2. Header Requirements

Remember to include your authentication headers with every request.
  • x-api-key
  • x-user-key
  • x-request-id

3. Calculation Formula

Total Invested = Σ(positions[i].amount)
               + Σ(mirrors[i].positions[j].amount)
               + Σ(mirrors[i].availableAmount - mirrors[i].closedPositionsNetProfit)
               + Σ(ordersForOpen[i].amount where mirrorID = 0)
               + Σ(orders[i].amount)
               + Σ(ordersForOpen[i].totalExternalCosts where mirrorID = 0)
Where:
  • positions is an array of your open positions
  • mirrors is an array of your copy trading portfolios
  • mirrors[i].positions is an array of positions within each mirror portfolio
  • mirrors[i].availableAmount is the available amount in each mirror portfolio
  • mirrors[i].closedPositionsNetProfit is the net profit from closed positions in each mirror portfolio
  • ordersForOpen is an array of pending market orders (filtered to only include manual positions where mirrorID = 0)
  • orders is an array of pending Market-if-touched orders
  • totalExternalCosts is the total external costs for each order
  • amount is the allocated amount for each position or order

Examples

curl -X GET "https://public-api.etoro.com/api/v1/trading/info/demo/pnl" \
  -H "x-api-key: <YOUR_PUBLIC_KEY>" \
  -H "x-user-key: <YOUR_USER_KEY>" \
  -H "x-request-id: <UUID>"

Example Calculation

If your account has:
  • positions: Two positions with amount values of 500 and 300
  • mirrors: One mirror portfolio with:
    • Two positions with amount values of 200 and 150
    • availableAmount: 100
    • closedPositionsNetProfit: 50
  • ordersForOpen: One manual pending order with amount of 200 and totalExternalCosts of 10 (where mirrorID = 0)
  • orders: One existing order with amount value of 150
Then your total invested would be:
(500 + 300) + (200 + 150) + (100 - 50) + 200 + 150 + 10 = 1560

Best Practices

  1. Monitor Your Investment: Regularly check your total invested to understand your capital allocation across all positions and orders.
  2. Account for Mirror Portfolios: Remember that mirror portfolios contribute to your total invested through both their positions and adjusted available amounts.
  3. Include External Costs: Don’t forget to include external costs from manual pending orders in your calculation.
  4. Use the Correct Environment: Make sure to use the demo endpoint when testing and the real endpoint for live trading.