Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

go-trading212

БесплатноБез исполняемых скриптовНе проверен

Unofficial Go client for the Trading 212 Public API, generated with oapi-codegen from the OpenAPI document Trading 212 publishes. Package `trading212`…

psyb0tот psyb0t619 установок в других каталогах

Об этом скилле

go-trading212

Unofficial, typed Go client for the Trading 212 Public API, in package trading212 at the module root.

For install, the full operation list, pagination and response fields, see references/setup.md.

Security & safety

  • Trading 212 uses HTTP Basic auth: the API key is the username and the API secret the password. Read both from environment variables (TRADING212_API_KEY, TRADING212_API_SECRET). Never hardcode, commit or log them, and never print a request with its Authorization header.
  • Requests go only to https://demo.trading212.com (paper trading) or https://live.trading212.com (real money). A key works only on the environment it was made for. Default to demo.
  • Placing or cancelling orders and creating, updating, duplicating or deleting pies act on the account. Call them only when the user asked for that exact action, and use the live host only when the user said so.

When to use

  • Go code needs a Trading 212 account summary, positions, open orders or history.
  • Go code needs to place or cancel Trading 212 orders or manage pies, at the user's request.
  • The project already imports github.com/psyb0t/go-trading212.

When NOT to use

  • The code is not Go. This module ships only a Go package.
  • You need a client maintained by Trading 212. This one is unofficial and not affiliated with Trading 212.
  • You want to change the generated client itself. See AGENTS.md in 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-trading212, from inside your module:

go doc github.com/psyb0t/go-trading212 ClientWithResponsesInterface  # every endpoint method
go doc github.com/psyb0t/go-trading212 GetPositionsParams            # one method, params type or model
go doc -all github.com/psyb0t/go-trading212                          # the whole package

The same documentation is at https://pkg.go.dev/github.com/psyb0t/go-trading212.

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. Some operation IDs are generic or numbered; the note at the end of this file maps them.

Usage

import (
	"context"
	"fmt"
	"net/http"
	"os"

	"github.com/psyb0t/go-trading212"
)

auth := trading212.WithRequestEditorFn(
	func(_ context.Context, req *http.Request) error {
		req.SetBasicAuth(
			os.Getenv("TRADING212_API_KEY"),
			os.Getenv("TRADING212_API_SECRET"),
		)

		return nil
	},
)

client, err := trading212.NewClientWithResponses(
	"https://demo.trading212.com",
	auth,
)
if err != nil {
	return err
}

summary, err := client.GetAccountSummaryWithResponse(ctx)
if err != nil {
	return err // transport failure
}

if summary.JSON200 == nil {
	return fmt.Errorf("account summary: %s", summary.Status())
}

if total := summary.JSON200.TotalValue; total != nil { // *float64
	fmt.Println("account value:", *total)
}

positions, err := client.GetPositionsWithResponse(
	ctx,
	&trading212.GetPositionsParams{},
)
if err != nil {
	return err
}

if positions.JSON200 != nil {
	for _, position := range *positions.JSON200 {
		fmt.Println(*position.Instrument.Ticker, *position.Quantity)
	}
}

Most response fields are pointers; check for nil before dereferencing. The error return covers only transport and decoding failures. An API error (401, 403, 429 and so on) comes back with JSON200 nil: check StatusCode() and Body.

Some method names come straight from the spec's operation IDs and are generic: GetAll, Create, Update, Delete and GetDetailed are the pie endpoints, Orders1 is the order history, PlaceStopOrder1 places a stop order and PlaceStopOrder a stop-limit order.

Полный SKILL.md на ClawHub

Установить go-trading212 в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл go-trading212?

Unofficial Go client for the Trading 212 Public API, generated with oapi-codegen from the OpenAPI document Trading 212 publishes. Package `trading212` (`github.com/psyb0t/go-trading212`) has a typed `...WithResponse` method for every endpoint: account summary, positions, open orders, limit, market, stop and stop-limit orders, order, dividend and transaction history, CSV report exports, exchange and instrument metadata, and pies. Prices and amounts are `float64`. Use when Go code needs to read a Trading 212 account or place Trading 212 orders, or already imports go-trading212.

Как установить скилл go-trading212?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл go-trading212 запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить go-trading212 с