Documentation ¶
Overview ¶
Package broker defines a REST client for the Alpaca Broker API.
Index ¶
- Constants
- type AccountClient
- func (ac *AccountClient) CreateAccount(ctx context.Context, data *model.CreateAccountRequest, ...) (*model.CreateAccountResponse, error)
- func (ac *AccountClient) GetAccount(ctx context.Context, params *model.GetAccountParams, ...) (*model.GetAccountResponse, error)
- func (ac *AccountClient) GetAccountHistory(ctx context.Context, params *model.GetAccountHistoryParams, ...) (*model.GetAccountHistoryResponse, error)
- func (ac *AccountClient) ListAccounts(ctx context.Context, params *model.ListAccountsParams, ...) (model.ListAccountsResponse, error)
- func (ac *AccountClient) UploadDocument(ctx context.Context, data *model.UploadDocumentRequest, ...) error
- type Client
- type DocumentClient
- type EventClient
- type OrderClient
- type TradeEventHandler
- type TransferEventHandler
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 ¶
AccountClient is a client for the broker account API.
func (*AccountClient) CreateAccount ¶
func (ac *AccountClient) CreateAccount(ctx context.Context, data *model.CreateAccountRequest, opts ...model.RequestOption) (*model.CreateAccountResponse, error)
func (*AccountClient) GetAccount ¶
func (ac *AccountClient) GetAccount(ctx context.Context, params *model.GetAccountParams, opts ...model.RequestOption) (*model.GetAccountResponse, error)
func (*AccountClient) GetAccountHistory ¶
func (ac *AccountClient) GetAccountHistory(ctx context.Context, params *model.GetAccountHistoryParams, opts ...model.RequestOption) (*model.GetAccountHistoryResponse, error)
func (*AccountClient) ListAccounts ¶
func (ac *AccountClient) ListAccounts(ctx context.Context, params *model.ListAccountsParams, opts ...model.RequestOption) (model.ListAccountsResponse, error)
func (*AccountClient) UploadDocument ¶
func (ac *AccountClient) UploadDocument(ctx context.Context, data *model.UploadDocumentRequest, params *model.UploadDocumentParams, opts ...model.RequestOption) error
type Client ¶
type Client struct { *client.Client AccountClient EventClient OrderClient }
Client defines a client for the Alpaca Broker API.
type DocumentClient ¶
DocumentClient is a client for the document API.
type EventClient ¶
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 ¶
func (*OrderClient) CreateOrder ¶
func (oc *OrderClient) CreateOrder(ctx context.Context, params *model.CreateOrderParams, data *model.CreateOrderRequest, opts ...model.RequestOption) (*model.CreateOrderResponse, error)
type TradeEventHandler ¶
type TradeEventHandler func(ctx context.Context, event *model.TradeEvent) error
type TransferEventHandler ¶
type TransferEventHandler func(ctx context.Context, event *model.TransferEvent) error
Click to show internal directories.
Click to hide internal directories.