go-etoro
БесплатноБез исполняемых скриптовНе проверенUnofficial Go clients for the eToro public API, generated from the specs eToro publishes. The root package `etoro` (`github.com/psyb0t/go-etoro`) is an…
от psyb0t1 365 установок в других каталогахОб этом скилле
go-etoro
Unofficial, typed Go clients for the eToro public API: REST in the root package etoro, WebSocket in etorows under ws/.
For install details, the request ID header, rate limit headers and the WebSocket push types, see references/setup.md.
Security & safety
- eToro authenticates with two keys,
x-api-keyandx-user-key. Read them from environment variables (ETORO_API_KEY,ETORO_USER_KEY). Never hardcode them, commit them or log them, and never print a request with its headers. - Requests go only to
https://public-api.etoro.comandwss://ws.etoro.com/ws. Do not point the client at another host with the keys attached. - The API can move real money and publish content: transfers (
PostMoneyTransfer...), posts, comments, likes and deletes. Call those only when the user asked for that exact action. Default to read-only endpoints.
When to use
- Go code needs eToro account balances, instruments, rates, candles, feeds or portfolio data.
- Go code needs a live stream of eToro instrument rates, candles, market status or the user's order and position updates.
- The project already imports
github.com/psyb0t/go-etoroorgithub.com/psyb0t/go-etoro/ws.
When NOT to use
- The code is not Go. This module ships only Go packages.
- You need a broker other than eToro, or an SDK maintained by eToro. This one is unofficial and not affiliated with eToro.
- You want to change the generated client itself.
client.gen.goandws/etorows.gen.goare generated; seeAGENTS.mdin the repo.
Finding endpoints and types
The examples below cover a few calls. Every operation in the spec has a generated method, and the spec's descriptions are on them as Go doc comments. Look names and fields up instead of guessing. After go get github.com/psyb0t/go-etoro, from inside your module:
go doc github.com/psyb0t/go-etoro ClientWithResponsesInterface # every endpoint method
go doc github.com/psyb0t/go-etoro GetMarketDataInstrumentsRatesParams # one method, params type or model
go doc -all github.com/psyb0t/go-etoro # the whole package
go doc github.com/psyb0t/go-etoro/ws Handler # every WebSocket message handler
go doc github.com/psyb0t/go-etoro/ws Client # the WebSocket Send methods and Run
The same documentation is at https://pkg.go.dev/github.com/psyb0t/go-etoro.
Method names come from the spec's operation IDs. <OperationId>WithResponse takes the context, then the path parameters in order, then *<OperationId>Params when the operation has query or header parameters, then the request body when it has one. The JSON200 field (or JSON201 and so on, per declared status) holds the decoded body; it is nil for any other status. Where a response type name clashes with a schema name, the response wrapper gets a 2 suffix, so GetBalancesWithResponse returns *etoro.GetBalancesResponse2.
REST
Every endpoint is a method on ClientWithResponses named after its operation ID plus WithResponse. Most take a *...Params struct, and most params structs carry a required XRequestId (a UUID per request).
import (
"context"
"fmt"
"net/http"
"os"
"github.com/google/uuid"
"github.com/psyb0t/go-etoro"
)
auth := etoro.WithRequestEditorFn(
func(_ context.Context, req *http.Request) error {
req.Header.Set("x-api-key", os.Getenv("ETORO_API_KEY"))
req.Header.Set("x-user-key", os.Getenv("ETORO_USER_KEY"))
return nil
},
)
client, err := etoro.NewClientWithResponses(
"https://public-api.etoro.com",
auth,
)
if err != nil {
return err
}
balances, err := client.GetBalancesWithResponse(
ctx,
&etoro.GetBalancesParams{XRequestId: uuid.New()},
)
if err != nil {
return err // transport failure
}
if balances.JSON200 == nil {
return fmt.Errorf("balances: %s", balances.Status())
}
total := balances.JSON200.TotalBalance // *float64
rates, err := client.GetMarketDataInstrumentsRatesWithResponse(
ctx,
&etoro.GetMarketDataInstrumentsRatesParams{
InstrumentIds: []int32{1001},
XRequestId: uuid.New(),
},
)
The error return covers only transport and decoding failures. An HTTP error status comes back as a response with JSON200 nil: check StatusCode() and Body, and on 429 read Headers429.RetryAfter.
WebSocket
import (
"crypto/rand"
"github.com/psyb0t/gen-asyncapi/asyncapirt/gorillaws"
"github.com/psyb0t/go-etoro/ws"
)
type handler struct {
etorows.UnimplementedHandler
}
func (handler) HandleInstrumentRateMessage(
ctx context.Context,
envelope etorows.InstrumentRateEnvelope,
) error {
for _, item := range envelope.Messages {
rate, err := item.ContentValue()
if err != nil {
return err
}
_ = rate.Ask // *string, rates arrive as strings such as "1.25"
}
return nil
}
conn, err := gorillaws.Dial(ctx, etorows.ServerEtoroURL)
if err != nil {
return err
}
client := etorows.NewClient(conn)
defer client.Close()
Установить go-etoro в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл go-etoro?
Unofficial Go clients for the eToro public API, generated from the specs eToro publishes. The root package `etoro` (`github.com/psyb0t/go-etoro`) is an oapi-codegen REST client for `https://public-api.etoro.com` with a typed `...WithResponse` method per endpoint (balances, market data, instruments, rates, candles, feeds, portfolios, transfers, posts). The `etorows` package (`github.com/psyb0t/go-etoro/ws`) is a typed WebSocket client for `wss://ws.etoro.com/ws` that authenticates, subscribes to topics and decodes instrument rate, candle and market status pushes and order and position updates through a `Handler`. Use when Go code needs to call the eToro API or stream eToro market data, or already imports go-etoro.
Как установить скилл go-etoro?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл go-etoro запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic