client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package client implements API access to EDGAR data. It's rate limited, as required by 1, and uses User-Agent. Don't forget set correct User-Agent using WithUserAgent().

Also see 2 for details.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnexpectedStatus = &UnexpectedStatusError{}

Functions

This section is empty.

Types

type ArchiveIndex

type ArchiveIndex struct {
	Directory struct {
		Item      []ArchiveItem `json:"item"`
		Name      string        `json:"name"`
		ParentDir string        `json:"parent-dir"`
	} `json:"directory"`
}

func (*ArchiveIndex) Items

func (self *ArchiveIndex) Items() []ArchiveItem

func (*ArchiveIndex) Name

func (self *ArchiveIndex) Name() string

func (*ArchiveIndex) Parent

func (self *ArchiveIndex) Parent() string

type ArchiveItem

type ArchiveItem struct {
	LastModified string `json:"last-modified"`
	Name         string `json:"name"`
	Type         string `json:"type"`
	Href         string `json:"href"`
	Size         string `json:"size"`
}

type CIK

type CIK uint32

func (*CIK) UnmarshalJSON

func (self *CIK) UnmarshalJSON(b []byte) error

type Client

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

func New

func New(opts ...ClientOption) *Client

func (*Client) ArchivesBaseURL

func (self *Client) ArchivesBaseURL() string

func (*Client) CompanyFacts

func (self *Client) CompanyFacts(ctx context.Context, cik uint32,
) (facts CompanyFacts, err error)

func (*Client) CompanyTickers

func (self *Client) CompanyTickers(ctx context.Context) ([]CompanyTicker, error)

func (*Client) Get

func (self *Client) Get(ctx context.Context, url string) (*http.Response, error)

func (*Client) GetArchiveFile

func (self *Client) GetArchiveFile(ctx context.Context, path string,
) (*http.Response, error)

func (*Client) GetJSON

func (self *Client) GetJSON(ctx context.Context, url string, value any) error

func (*Client) IndexArchive

func (self *Client) IndexArchive(ctx context.Context, path string,
) (index ArchiveIndex, err error)

func (*Client) WithApiBaseURL

func (self *Client) WithApiBaseURL(u string) *Client

func (*Client) WithArchivesBaseURL

func (self *Client) WithArchivesBaseURL(url string) *Client

func (*Client) WithUserAgent

func (self *Client) WithUserAgent(ua string) *Client

type ClientOption

type ClientOption func(c *Client)

func WithHttpClient

func WithHttpClient(client HttpRequestDoer) ClientOption

func WithRateLimiter

func WithRateLimiter(l Limiter) ClientOption

type CompanyFact

type CompanyFact struct {
	Label       string                `json:"label"`
	Description string                `json:"description"`
	Units       map[string][]FactUnit `json:"units"`
}

type CompanyFacts

type CompanyFacts struct {
	CIK        CIK                               `json:"cik"`
	EntityName string                            `json:"entityName"`
	Facts      map[string]map[string]CompanyFact `json:"facts"`
}

func (*CompanyFacts) Id

func (self *CompanyFacts) Id() uint32

type CompanyTicker

type CompanyTicker struct {
	CIK    uint32 `json:"cik_str"`
	Ticker string `json:"ticker"`
	Title  string `json:"title"`
}

func (*CompanyTicker) URI

func (self *CompanyTicker) URI() string

type FactUnit

type FactUnit struct {
	Start string  `json:"start"`
	End   string  `json:"end"`
	Val   float64 `json:"val"`
	Accn  string  `json:"accn"`
	FY    uint    `json:"fy"`
	FP    string  `json:"fp"`
	Form  string  `json:"form"`
	Filed string  `json:"filed"`
	Frame string  `json:"frame"`
}

func (*FactUnit) EndTime

func (self *FactUnit) EndTime() (time.Time, error)

func (*FactUnit) FiledTime

func (self *FactUnit) FiledTime() (time.Time, error)

func (*FactUnit) ParseTimes

func (self *FactUnit) ParseTimes(fn func(startTime, endTime, filedTime time.Time),
) error

func (*FactUnit) StartTime

func (self *FactUnit) StartTime() (time.Time, error)

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Limiter

type Limiter interface{ Wait(context.Context) error }

type Qtr

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

func NewQtr

func NewQtr(date time.Time) Qtr

func (*Qtr) Next

func (self *Qtr) Next() string

func (*Qtr) Path

func (self *Qtr) Path() string

func (*Qtr) QTR

func (self *Qtr) QTR() string

type UnexpectedStatusError

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

func (*UnexpectedStatusError) Error

func (self *UnexpectedStatusError) Error() string

func (*UnexpectedStatusError) Is

func (self *UnexpectedStatusError) Is(target error) bool

func (*UnexpectedStatusError) Status

func (self *UnexpectedStatusError) Status() string

func (*UnexpectedStatusError) StatusCode

func (self *UnexpectedStatusError) StatusCode() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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