Documentation
¶
Overview ¶
Package asset provides a client for the Longbridge Asset OpenAPI. It covers account asset queries and downloads.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetContext ¶
type AssetContext struct {
// contains filtered or unexported fields
}
AssetContext is a client for the Longbridge Asset API.
Example:
conf, err := config.New()
sctx, err := asset.NewFromCfg(conf)
items, err := sctx.Statements(context.Background(), &asset.GetStatementList{
StatementType: asset.StatementTypeDaily,
PageSize: 5,
})
func NewFromCfg ¶
func NewFromCfg(cfg *config.Config) (*AssetContext, error)
NewFromCfg creates a AssetContext from a *config.Config.
func NewFromEnv ¶
func NewFromEnv() (*AssetContext, error)
NewFromEnv returns a AssetContext configured from environment variables.
func (*AssetContext) StatementDownloadURL ¶
func (c *AssetContext) StatementDownloadURL(ctx context.Context, params *GetStatementDownloadURL) (downloadURL string, err error)
StatementDownloadURL returns a presigned URL to download the statement JSON.
Reference: GET /v1/statement/download
func (*AssetContext) Statements ¶
func (c *AssetContext) Statements(ctx context.Context, params *GetStatementList) (items []*StatementItem, err error)
Statements returns the list of available statements.
Reference: GET /v1/statement/list
type GetStatementDownloadURL ¶
type GetStatementDownloadURL struct {
// FileKey obtained from the list statements endpoint.
FileKey string
}
GetStatementDownloadURL contains parameters for getting a statement download URL.
func (*GetStatementDownloadURL) Values ¶
func (req *GetStatementDownloadURL) Values() url.Values
Values converts GetStatementDownloadURL to URL query parameters.
type GetStatementList ¶
type GetStatementList struct {
// StatementType: 1 = daily (default), 2 = monthly.
StatementType StatementType
// Page number for pagination.
Page int32
// PageSize is the number of results per page.
PageSize int32
}
GetStatementList contains parameters for listing statements.
func (*GetStatementList) Values ¶
func (req *GetStatementList) Values() url.Values
Values converts GetStatementList to URL query parameters.
type StatementItem ¶
type StatementItem struct {
// Date of the statement (integer, e.g. 20250301).
Date int32
// FileKey used to request the download URL.
FileKey string
}
StatementItem represents a single statement entry from the list API.
type StatementType ¶
type StatementType int32
StatementType represents the type of statement.
const ( // StatementTypeDaily is a daily statement. StatementTypeDaily StatementType = 1 // StatementTypeMonthly is a monthly statement. StatementTypeMonthly StatementType = 2 )