broker

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package broker defines a REST client for the Alpaca Broker API.

Index

Constants

View Source
const (
	CreateAccountPath     = "/v1/accounts"
	ListAccountsPath      = "/v1/accounts"
	GetAccountPath        = "/v1/accounts/:id"
	GetAccountHistoryPath = "/v1/trading/accounts/:id/account/portfolio/history"
)
View Source
const (
	GetTradeEventsPath    = "/v2beta1/events/trades"
	GetTransferEventsPath = "/v1/events/transfers/status"
)
View Source
const (
	CreateOrderPath = "/v1/trading/accounts/:id/orders"
)
View Source
const (
	UploadDocumentPath = "/v1/accounts/:id/documents/upload"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountClient

type AccountClient struct {
	*client.Client
}

AccountClient is a client for the broker account API.

func (*AccountClient) CreateAccount

func (*AccountClient) GetAccount

func (*AccountClient) GetAccountHistory

func (*AccountClient) ListAccounts

func (*AccountClient) UploadDocument

type Client

Client defines a client for the Alpaca Broker API.

func NewClient

func NewClient(
	apiURL string,
	apiKey string,
	apiSecret string,
	reader client.EventReader,
	logger *slog.Logger,
) *Client

NewClient returns a new client with the specified API key and config.

type DocumentClient

type DocumentClient struct {
	*client.Client
}

DocumentClient is a client for the document API.

type EventClient

type EventClient struct {
	*client.Client
}

EventClient defines a client for the Alpaca Broker Event API.

func (*EventClient) WatchTradeEvents

func (c *EventClient) WatchTradeEvents(ctx context.Context, params *model.WatchParams, handler TradeEventHandler, opts ...model.RequestOption) error

func (*EventClient) WatchTransferEvents

func (c *EventClient) WatchTransferEvents(ctx context.Context, params *model.WatchParams, handler TransferEventHandler, opts ...model.RequestOption) error

type OrderClient

type OrderClient struct {
	*client.Client
}

func (*OrderClient) CreateOrder

type TradeEventHandler

type TradeEventHandler func(ctx context.Context, event *model.TradeEvent) error

type TransferEventHandler

type TransferEventHandler func(ctx context.Context, event *model.TransferEvent) error

Jump to

Keyboard shortcuts

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