eToro Public API
Base URL: INLINECODE0
About
This skill allows to interact with the user's eToro account programatically, including executing trades.
Authentication & Required Headers
Keys (request from the user on install)
- - Public API Key: application
- User Key: user account
- Environment: Real Portfolio or Virtual Portfolio (real/demo)
Key generation (user-facing):
- 1. Log in to eToro.
- Settings > Trading.
- Create New Key.
- Choose Environment (Real or Virtual/Demo) and Permissions (Read or Write).
- Verify identity and copy the generated User Key.
Headers (every request):
- -
x-request-id: unique UUID per request - INLINECODE2 : Public API Key (KEY>)
- INLINECODE3 : User Key (KEY>)
Example:
CODEBLOCK0
Request Conventions
- - All paths below are relative to the Base URL (which already includes
/api/v1).
Example:
GET /watchlists means
GET https://public-api.etoro.com/api/v1/watchlists.
- - Query params go in the URL, path params go in the URL path.
- For query params that are documented as
array, send them as comma-separated values (e.g., instrumentIds=1001,1002). - Pagination patterns vary by endpoint:
- Search:
pageNumber,
pageSize
- People search & trade history:
page,
pageSize
- Feeds:
take,
offset
- Watchlist items listing:
pageNumber,
itemsPerPage
- - Casing matters for request bodies:
- Trading execution uses
PascalCase fields (e.g.,
InstrumentID,
IsBuy,
Leverage).
- Market close body uses
InstrumentId (capital I, lowercase d).
- Watchlist items use
ItemId,
ItemType,
ItemRank.
- Feeds post body uses lower camel (
owner,
message,
tags,
mentions,
attachments).
- - Some responses may use different casing for similar concepts (e.g.,
instrumentId vs InstrumentID). When extracting IDs, handle both if present.
Demo vs Real Trading
- - Use demo execution endpoints (contain
/demo/) for testing and paper trading. - Use non-demo execution endpoints for real trading.
- For portfolio/PnL:
- Demo:
/trading/info/demo/*
- Real:
/trading/info/portfolio and
/trading/info/real/pnl
- - Ensure your key environment matches the endpoint (Virtual vs Real). Each User Key is associated with a specific environment.
Use Defaults
- - Important: You don't need to specify all parameters. If the user doesn't specify leverage for example, don't send it on the API request.
Quick Start (Demo Trade)
- 1. Resolve
instrumentId using search.
fields is required on search requests.
CODEBLOCK1
- 2. Place a demo market order by amount (PascalCase body):
CODEBLOCK2
Common IDs
- -
instrumentId: from Search or Instruments metadata - INLINECODE38 : from Portfolio endpoints
- INLINECODE39 : from execution responses or Portfolio endpoints
- INLINECODE40 : used by instrument feed endpoints (typically available in instrument metadata/search fields)
- INLINECODE41 : numeric eToro user ID (often referred to as CID in responses; discover via People endpoints/search)
- INLINECODE42 : from watchlists list/create endpoints
Market Data (Requests)
Search instruments
- - INLINECODE43
- Required query:
fields (comma-separated list of instrument fields to return) - Optional:
searchText, pageSize, pageNumber, INLINECODE48 - The Search endpoint supports filtering by fields returned in results; for exact symbol lookup, use
internalSymbolFull as a query param and verify the exact match. - Recommended minimal
fields when you need IDs: include the instrument identifier (may appear as instrumentId or InstrumentID), plus internalSymbolFull and displayname (and marketId if you plan to use Feeds).
Metadata
Filters:
instrumentIds,
exchangeIds,
stocksIndustryIds,
instrumentTypeIds.
Prices & history
Required:
instrumentIds (comma-separated).
Returns historical closing prices for all instruments (bulk).
direction:
asc or
desc.
candlesCount max 1000.
Use only supported
interval values (confirm via docs if unsure).
Reference data
- -
GET /market-data/exchanges (optional exchangeIds) - INLINECODE72
- INLINECODE73 (optional
stocksIndustryIds)
Trading Execution (Requests)
Requires a key with appropriate permissions (typically Write) and the correct environment (Demo vs Real).
Market Open Orders (by amount)
Endpoints:
- - INLINECODE75
- INLINECODE76
Body (PascalCase, JSON):
- - Required:
InstrumentID, IsBuy, Leverage, INLINECODE80 - Optional:
StopLossRate, TakeProfitRate, IsTslEnabled, IsNoStopLoss, INLINECODE85
Market Open Orders (by units)
Endpoints:
- - INLINECODE86
- INLINECODE87
Body (PascalCase, JSON):
- - Required:
InstrumentID, IsBuy, Leverage, INLINECODE91 - Optional:
StopLossRate, TakeProfitRate, IsTslEnabled, IsNoStopLoss, INLINECODE96
Cancel Market Open Orders
Endpoints:
- - INLINECODE97
- INLINECODE98
Market Close Orders
Endpoints:
- - INLINECODE99
- INLINECODE100
- INLINECODE101
- INLINECODE102
Body (JSON):
- - Required: INLINECODE103
- Optional:
UnitsToDeduct (number or null)
Partial close: set UnitsToDeduct.
Full close: set UnitsToDeduct to null.
You must close by positionId, not by symbol.
Market-if-touched (Limit) Orders
Endpoints:
- - INLINECODE110
- INLINECODE111
- INLINECODE112
- INLINECODE113
Body (PascalCase, JSON):
- - Required:
InstrumentID, IsBuy, Leverage, Rate, and one of Amount or INLINECODE119 - Optional:
StopLossRate, TakeProfitRate, IsTslEnabled, IsNoStopLoss, INLINECODE124 - Do not send:
IsDiscounted, INLINECODE126
Trading Info & Portfolio (Requests)
- - INLINECODE127
- INLINECODE128
- INLINECODE129
- INLINECODE130
Use these to discover
positionId and
orderId for close/cancel flows.
Required:
minDate (YYYY-MM-DD). Optional:
page,
pageSize.
Watchlists (Requests)
User watchlists
Optional:
itemsPerPageForSingle,
ensureBuiltinWatchlists,
addRelatedAssets.
Optional:
pageNumber,
itemsPerPage.
Query:
name (required),
type,
dynamicQuery (optional). (Uses query params, not a JSON body.)
Query:
newName (required). (Uses query params, not a JSON body.)
Watchlist items (body schema)
INLINECODE151 fields:
- -
ItemId (required, int) - INLINECODE153 (required, string:
Instrument or Person) - INLINECODE156 (optional, int)
Endpoints:
- - INLINECODE157
- INLINECODE158
- INLINECODE159
Example body:
CODEBLOCK3
Default watchlists
- - INLINECODE160
- INLINECODE161
Optional:
itemsLimit,
itemsPerPage.
Query:
name (required),
type,
dynamicQuery (optional).
- - INLINECODE168
- INLINECODE169
Query:
newRank (required).
Public watchlists
- - INLINECODE171
- INLINECODE172
Feeds (Requests)
Read feeds
Optional:
requesterUserId,
take,
offset,
badgesExperimentIsEnabled,
reactionsPageSize.
Optional:
requesterUserId,
take,
offset,
badgesExperimentIsEnabled,
reactionsPageSize.
Notes:
- -
marketId is associated with an instrument (typically available via instrument metadata/search if you include it in fields). - INLINECODE187 is a numeric user identifier (CID). If you only have a username, discover the numeric ID via People endpoints (see User Info & Analytics).
Create post
- - INLINECODE188
- Body fields (lower camel, JSON):
-
owner (int)
-
message (string)
-
tags:
{ "tags": [{ "name": "...", "id": "..." }] }
-
mentions:
{ "mentions": [{ "userName": "...", "id": "...", "isDirect": true }] }
-
attachments: array of objects with
url,
title,
host,
description,
mediaType, and optional
media.
Minimal example:
CODEBLOCK4
Curated Lists & Recommendations (Requests)
- - INLINECODE202
- INLINECODE203
Popular Investors (Copiers)
User Info & Analytics (Requests)
Optional:
usernames,
cidList.
Use this to map
username ↔ CID (userId) when you need numeric
userId for feeds/public watchlists.
Required:
period. Optional:
page,
pageSize,
sort,
popularInvestor,
gainMax,
maxDailyRiskScoreMin,
maxDailyRiskScoreMax,
maxMonthlyRiskScoreMin,
maxMonthlyRiskScoreMax,
weeksSinceRegistrationMin,
countryId,
instrumentId,
instrumentPctMin,
instrumentPctMax,
isTestAccount, and other filters.
- - INLINECODE226
- INLINECODE227
Required:
minDate,
maxDate,
type (
Daily or
Period).
- - INLINECODE233
- INLINECODE234
Required:
period (e.g.,
LastTwoYears).
Responses & Schemas
For response schemas and full examples, refer to:
- - https://api-portal.etoro.com/
- MCP server: INLINECODE237
eToro 公共 API
基础 URL:https://public-api.etoro.com/api/v1
关于
此技能允许以编程方式与用户的 eToro 账户进行交互,包括执行交易。
认证与必需请求头
密钥(安装时向用户索取)
- - 公共 API 密钥:应用程序
- 用户密钥:用户账户
- 环境:真实投资组合或虚拟投资组合(真实/演示)
密钥生成(面向用户):
- 1. 登录 eToro。
- 设置 > 交易。
- 创建新密钥。
- 选择环境(真实或虚拟/演示)和权限(读取或写入)。
- 验证身份并复制生成的用户密钥。
请求头(每个请求):
- - x-request-id:每个请求的唯一 UUID
- x-api-key:公共 API 密钥(KEY>)
- x-user-key:用户密钥(KEY>)
示例:
bash
curl -X GET https://public-api.etoro.com/api/v1/watchlists \
-H x-request-id: \
-H x-api-key: \
-H x-user-key:
请求约定
- - 以下所有路径均相对于基础 URL(已包含 /api/v1)。
示例:GET /watchlists 表示 GET https://public-api.etoro.com/api/v1/watchlists。
- - 查询参数放在 URL 中,路径参数放在 URL 路径中。
- 对于文档中标记为 array 的查询参数,请以逗号分隔值的形式发送(例如,instrumentIds=1001,1002)。
- 分页模式因端点而异:
- 搜索:pageNumber、pageSize
- 用户搜索与交易历史:page、pageSize
- 动态:take、offset
- 自选列表项列表:pageNumber、itemsPerPage
- 交易执行使用
帕斯卡命名法字段(例如,InstrumentID、IsBuy、Leverage)。
- 市价平仓请求体使用 InstrumentId(大写 I,小写 d)。
- 自选列表项使用 ItemId、ItemType、ItemRank。
- 动态发布请求体使用小驼峰命名法(owner、message、tags、mentions、attachments)。
- - 某些响应可能对类似概念使用不同的大小写(例如,instrumentId 与 InstrumentID)。提取 ID 时,如果两者都存在,请一并处理。
演示与真实交易
- - 使用演示执行端点(包含 /demo/)进行测试和模拟交易。
- 使用非演示执行端点进行真实交易。
- 对于投资组合/盈亏:
- 演示:/trading/info/demo/*
- 真实:/trading/info/portfolio 和 /trading/info/real/pnl
- - 确保您的密钥环境与端点匹配(虚拟与真实)。每个用户密钥都与特定环境相关联。
使用默认值
- - 重要提示:您无需指定所有参数。例如,如果用户未指定杠杆,则不要在 API 请求中发送它。
快速入门(演示交易)
- 1. 使用搜索解析 instrumentId。
搜索请求中需要 fields。
bash
curl -X GET https://public-api.etoro.com/api/v1/market-data/search?internalSymbolFull=BTC&fields=instrumentId,internalSymbolFull,displayname \
-H x-api-key: \
-H x-user-key: \
-H x-request-id:
- 2. 按金额下达演示市价单(帕斯卡命名法请求体):
bash
curl -X POST https://public-api.etoro.com/api/v1/trading/execution/demo/market-open-orders/by-amount \
-H x-api-key: \
-H x-user-key: \
-H x-request-id: \
-H Content-Type: application/json \
-d {
InstrumentID: 100000,
IsBuy: true,
Leverage: 1,
Amount: 100
}
通用 ID
- - instrumentId:来自搜索或工具元数据
- positionId:来自投资组合端点
- orderId:来自执行响应或投资组合端点
- marketId:由工具动态端点使用(通常可在工具元数据/搜索字段中找到)
- userId:数字型 eToro 用户 ID(在响应中常称为 CID;可通过用户端点/搜索发现)
- watchlistId:来自自选列表列表/创建端点
市场数据(请求)
搜索工具
- - GET /market-data/search
- 必需查询:fields(要返回的工具字段的逗号分隔列表)
- 可选:searchText、pageSize、pageNumber、sort
- 搜索端点支持按返回结果中的字段进行过滤;如需精确查找代码,请使用 internalSymbolFull 作为查询参数并验证精确匹配。
- 需要 ID 时的推荐最小 fields:包含工具标识符(可能显示为 instrumentId 或 InstrumentID),加上 internalSymbolFull 和 displayname(如果计划使用动态,还需加上 marketId)。
元数据
- - GET /market-data/instruments
过滤器:instrumentIds、exchangeIds、stocksIndustryIds、instrumentTypeIds。
价格与历史
- - GET /market-data/instruments/rates
必需:instrumentIds(逗号分隔)。
- - GET /market-data/instruments/history/closing-price
返回所有工具的收盘价历史(批量)。
- - GET /market-data/instruments/{instrumentId}/history/candles/{direction}/{interval}/{candlesCount}
direction:asc 或 desc。candlesCount 最大 1000。
仅使用支持的 interval 值(如有疑问,请通过文档确认)。
参考数据
- - GET /market-data/exchanges(可选 exchangeIds)
- GET /market-data/instrument-types
- GET /market-data/stocks-industries(可选 stocksIndustryIds)
交易执行(请求)
需要具有适当权限(通常为写入)和正确环境(演示与真实)的密钥。
市价开仓单(按金额)
端点:
- - POST /trading/execution/demo/market-open-orders/by-amount
- POST /trading/execution/market-open-orders/by-amount
请求体(帕斯卡命名法,JSON):
- - 必需: InstrumentID、IsBuy、Leverage、Amount
- 可选: StopLossRate、TakeProfitRate、IsTslEnabled、IsNoStopLoss、IsNoTakeProfit
市价开仓单(按单位)
端点:
- - POST /trading/execution/demo/market-open-orders/by-units
- POST /trading/execution/market-open-orders/by-units
请求体(帕斯卡命名法,JSON):
- - 必需: InstrumentID、IsBuy、Leverage、AmountInUnits
- 可选: StopLossRate、TakeProfitRate、IsTslEnabled、IsNoStopLoss、IsNoTakeProfit
取消市价开仓单
端点:
- - DELETE /trading/execution/demo/market-open-orders/{orderId}
- DELETE /trading/execution/market-open-orders/{orderId}
市价平仓单
端点:
- - POST /trading/execution/demo/market-close-orders/positions/{positionId}
- POST /trading/execution/market-close-orders/positions/{positionId}
- DELETE /trading/execution/demo/market-close-orders/{orderId}
- DELETE /trading/execution/market-close-orders/{orderId}
请求体(JSON):
- - 必需: InstrumentId
- 可选: UnitsToDeduct(数字或 null)
部分平仓:设置 UnitsToDeduct。
全部平仓:将 UnitsToDeduct 设置为 null