微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📈

社交交易官方 API · 模拟实盘双支持

eToro API · v1.0.0
效率 安全 B 级 作者 marian2js 公开目录收录
1k 下载 0 安装 2.2k 收藏 14 浏览

简介

通过 eToro 官方 API 实现程序化交易,支持模拟/实盘双环境、社交跟单及投资组合管理,适合量化交易者与社交投资者。

原始描述

Enables agents to interact with the eToro API to access market data, portfolio and social features, and execute trades programmatically.

通过你的 Agent 添加

安装目录:etoro-api/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/etoro-api/
Codex CLI~/.codex/skills/etoro-api/
DeepSeek Harness~/.agents/skills/etoro-api/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

etoro-api 是连接全球知名社交交易平台 eToro 的官方程序化接口,提供从市场数据获取到实盘交易执行的完整链路。该技能支持 双环境切换(Demo 模拟盘 / Real 实盘),用户可通过申请 API Key 实现自动化策略部署。

主要功能模块

  • 市场数据:实时行情、历史 K 线(最多 1000 根)、 instrument 元数据搜索
  • 交易执行:市价开仓(按金额/按数量)、限价单、止损止盈设置、仓位平仓
  • 组合管理:查询 PnL、交易历史、持仓明细
  • 社交功能:访问关注列表、热门投资者筛选、Feeds 社交动态发布与阅读

显著优点

  1. 官方背书:直接对接 eToro 官方 API,数据实时性与执行可靠性有保障
  2. 零风险测试:内置 Demo 环境,支持完整交易流程的 Paper Trading
  3. 社交化投资:可获取 Popular Investors 绩效数据,实现跟单策略的量化分析
  4. 灵活风控:支持 TSL(追踪止损)、自定义止损止盈、部分平仓等精细操作

潜在局限

  • 权限分级:Write 权限需额外申请,且 Demo/Real 环境 Key 不可混用
  • 命名混乱:请求体字段大小写不统一(PascalCase / camelCase / 小写),易引发 400 错误
  • 分页不一致:不同端点采用 page/pageNumber/take/offset 多种分页参数,需特别注意
  • 地域限制:eToro 服务受监管限制,部分地区用户无法开户或调用 API

适合人群

  • 量化交易开发者(Python/JS 自动化策略)
  • 社交投资分析师(追踪 Popular Investors 绩效)
  • 投资组合管理工具构建者
  • 希望用模拟盘验证策略后再实盘的谨慎型交易者

常规风险

风险类型 说明
密钥泄露 User Key 拥有交易权限,泄露可能导致账户资金损失
环境误用 将 Real Key 用于 Demo 端点或反之,会导致认证失败或意外实盘交易
杠杆风险 API 支持最高 30 倍杠杆(依品种而定),程序化高频操作可能快速放大亏损
流动性风险 非美交易时段或小众品种可能出现滑点,API 返回的 Rate 与实际成交价存在偏差
监管合规 自动化交易需符合 eToro 用户协议,过度频繁请求可能触发风控限制

建议在正式部署前,充分使用 Demo 环境验证字段命名、分页逻辑及异常处理流程。

技能正文


name: etoro-api version: 1.0.0 description: Enables agents to interact with the eToro API to access market data, portfolio and social features, and execute trades programmatically. homepage: https://api-portal.etoro.com/ metadata: { "openclaw": { "emoji": "📈", "category": "finance", "api_base": "https://public-api.etoro.com/api/v1", }, }

eToro Public API

Base URL: https://public-api.etoro.com/api/v1

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.
  2. Settings > Trading.
  3. Create New Key.
  4. Choose Environment (Real or Virtual/Demo) and Permissions (Read or Write).
  5. Verify identity and copy the generated User Key.

Headers (every request):

  • x-request-id: unique UUID per request
  • x-api-key: Public API Key (<PUBLIC_KEY>)
  • x-user-key: User Key (<USER_KEY>)

Example:

curl -X GET "https://public-api.etoro.com/api/v1/watchlists" \
  -H "x-request-id: <UUID>" \
  -H "x-api-key: <PUBLIC_KEY>" \
  -H "x-user-key: <USER_KEY>"

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.
curl -X GET "https://public-api.etoro.com/api/v1/market-data/search?internalSymbolFull=BTC&fields=instrumentId,internalSymbolFull,displayname" \
  -H "x-api-key: <PUBLIC_KEY>" \
  -H "x-user-key: <USER_KEY>" \
  -H "x-request-id: <UUID>"
  1. Place a demo market order by amount (PascalCase body):
curl -X POST "https://public-api.etoro.com/api/v1/trading/execution/demo/market-open-orders/by-amount" \
  -H "x-api-key: <PUBLIC_KEY>" \
  -H "x-user-key: <USER_KEY>" \
  -H "x-request-id: <UUID>" \
  -H "Content-Type: application/json" \
  -d '{
    "InstrumentID": 100000,
    "IsBuy": true,
    "Leverage": 1,
    "Amount": 100
  }'

Common IDs

  • instrumentId: from Search or Instruments metadata
  • positionId: from Portfolio endpoints
  • orderId: from execution responses or Portfolio endpoints
  • marketId: used by instrument feed endpoints (typically available in instrument metadata/search fields)
  • userId: numeric eToro user ID (often referred to as CID in responses; discover via People endpoints/search)
  • watchlistId: from watchlists list/create endpoints

Market Data (Requests)

Search instruments

  • GET /market-data/search
  • Required query: fields (comma-separated list of instrument fields to return)
  • Optional: searchText, pageSize, pageNumber, sort
  • 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

  • GET /market-data/instruments
    Filters: instrumentIds, exchangeIds, stocksIndustryIds, instrumentTypeIds.

Prices & history

  • GET /market-data/instruments/rates
    Required: instrumentIds (comma-separated).
  • GET /market-data/instruments/history/closing-price
    Returns historical closing prices for all instruments (bulk).
  • GET /market-data/instruments/{instrumentId}/history/candles/{direction}/{interval}/{candlesCount}
    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)
  • GET /market-data/instrument-types
  • GET /market-data/stocks-industries (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:

  • POST /trading/execution/demo/market-open-orders/by-amount
  • POST /trading/execution/market-open-orders/by-amount

Body (PascalCase, JSON):

  • Required: InstrumentID, IsBuy, Leverage, Amount
  • Optional: StopLossRate, TakeProfitRate, IsTslEnabled, IsNoStopLoss, IsNoTakeProfit

Market Open Orders (by units)

Endpoints:

  • POST /trading/execution/demo/market-open-orders/by-units
  • POST /trading/execution/market-open-orders/by-units

Body (PascalCase, JSON):

  • Required: InstrumentID, IsBuy, Leverage, AmountInUnits
  • Optional: StopLossRate, TakeProfitRate, IsTslEnabled, IsNoStopLoss, IsNoTakeProfit

Cancel Market Open Orders

Endpoints:

  • DELETE /trading/execution/demo/market-open-orders/{orderId}
  • DELETE /trading/execution/market-open-orders/{orderId}

Market Close Orders

Endpoints:

  • 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}

Body (JSON):

  • Required: InstrumentId
  • 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:

  • POST /trading/execution/demo/limit-orders
  • DELETE /trading/execution/demo/limit-orders/{orderId}
  • POST /trading/execution/limit-orders
  • DELETE /trading/execution/limit-orders/{orderId}

Body (PascalCase, JSON):

  • Required: InstrumentID, IsBuy, Leverage, Rate, and one of Amount or AmountInUnits
  • Optional: StopLossRate, TakeProfitRate, IsTslEnabled, IsNoStopLoss, IsNoTakeProfit
  • Do not send: IsDiscounted, CID

Trading Info & Portfolio (Requests)

  • GET /trading/info/demo/pnl
  • GET /trading/info/real/pnl
  • GET /trading/info/demo/portfolio
  • GET /trading/info/portfolio
    Use these to discover positionId and orderId for close/cancel flows.
  • GET /trading/info/trade/history
    Required: minDate (YYYY-MM-DD). Optional: page, pageSize.

Watchlists (Requests)

User watchlists

  • GET /watchlists
    Optional: itemsPerPageForSingle, ensureBuiltinWatchlists, addRelatedAssets.
  • GET /watchlists/{watchlistId}
    Optional: pageNumber, itemsPerPage.
  • POST /watchlists
    Query: name (required), type, dynamicQuery (optional). (Uses query params, not a JSON body.)
  • PUT /watchlists/{watchlistId}
    Query: newName (required). (Uses query params, not a JSON body.)
  • DELETE /watchlists/{watchlistId}

Watchlist items (body schema)

WatchlistItemDto fields:

  • ItemId (required, int)
  • ItemType (required, string: Instrument or Person)
  • ItemRank (optional, int)

Endpoints:

  • POST /watchlists/{watchlistId}/items
  • PUT /watchlists/{watchlistId}/items
  • DELETE /watchlists/{watchlistId}/items

Example body:

[
  { "ItemId": 12345, "ItemType": "Instrument", "ItemRank": 1 },
  { "ItemId": 67890, "ItemType": "Instrument", "ItemRank": 2 }
]

Default watchlists

  • POST /watchlists/default-watchlist/selected-items
  • GET /watchlists/default-watchlists/items
    Optional: itemsLimit, itemsPerPage.
  • POST /watchlists/newasdefault-watchlist
    Query: name (required), type, dynamicQuery (optional).
  • PUT /watchlists/setUserSelectedUserDefault/{watchlistId}
  • PUT /watchlists/rank/{watchlistId}
    Query: newRank (required).

Public watchlists

  • GET /watchlists/public/{userId}
  • GET /watchlists/public/{userId}/{watchlistId}

Feeds (Requests)

Read feeds

  • GET /feeds/instrument/{marketId}
    Optional: requesterUserId, take, offset, badgesExperimentIsEnabled, reactionsPageSize.
  • GET /feeds/user/{userId}
    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).
  • userId 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

  • POST /feeds/post
  • 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:

{ "message": "Hello eToro feed!" }

Curated Lists & Recommendations (Requests)

  • GET /curated-lists
  • GET /market-recommendations/{itemsCount}

Popular Investors (Copiers)

  • GET /pi-data/copiers

User Info & Analytics (Requests)

  • GET /user-info/people
    Optional: usernames, cidList.
    Use this to map username ↔ CID (userId) when you need numeric userId for feeds/public watchlists.
  • GET /user-info/people/search
    Required: period. Optional: page, pageSize, sort, popularInvestor, gainMax, maxDailyRiskScoreMin, maxDailyRiskScoreMax, maxMonthlyRiskScoreMin, maxMonthlyRiskScoreMax, weeksSinceRegistrationMin, countryId, instrumentId, instrumentPctMin, instrumentPctMax, isTestAccount, and other filters.
  • GET /user-info/people/{username}/gain
  • GET /user-info/people/{username}/daily-gain
    Required: minDate, maxDate, type (Daily or Period).
  • GET /user-info/people/{username}/portfolio/live
  • GET /user-info/people/{username}/tradeinfo
    Required: period (e.g., LastTwoYears).

Responses & Schemas

For response schemas and full examples, refer to:

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

tradingsocial-tradingapibrokerportfoliocopy-tradingcfdstockscryptopaper-trading

同类 Skill