coinbase

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package coinbase reads a Coinbase account (the retail app and Advanced Trade) with a view-only CDP API key. Coinbase keeps one account per currency (plus vaults); they are treated as one: moves between them are not activities, and balances are summed per currency.

History comes from each account's ledger, GET /v2/accounts/{id}/transactions, which lists every balance change, Advanced Trade fills included. The v3 fills endpoint is not used: it only covers the key's portfolio and may ask EU users for a 2FA proof token, while the v2 ledger has both legs of every fill; reading both would count each fill twice.

A trade appears as one transaction in each account it touches (bought currency, paid currency); legs are joined into one Trade by the id they share (buy/sell/trade id, or the fill's order and time).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg source.Config) (source.Source, error)

New builds the connector from its settings.

Types

type APIError

type APIError struct {
	Status int
	ID     string
	Msg    string
	Path   string
}

APIError is an error answered by Coinbase. v2 sends {"errors": [{"id", "message"}]}, v3 {"error", "message"}.

func (*APIError) Error

func (e *APIError) Error() string

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source is a configured Coinbase connector.

func (*Source) Activities

func (s *Source) Activities(ctx context.Context, f source.Fetch) error

func (*Source) Balances

func (s *Source) Balances(ctx context.Context) ([]model.Balance, error)

func (*Source) State

func (s *Source) State() []byte

func (*Source) Test

func (s *Source) Test(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL