edgar

package module
v0.0.0-...-12e865f Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 11 Imported by: 0

README

edgar-lib

A library for downloading and processing 10-K/Q documents from the SEC's EDGAR system.

Documentation

Index

Constants

View Source
const (
	TaxonomyGaap = "us-gaap"
	TaxonomyDei  = "dei"
	TaxonomyIfrs = "ifrs-full"
	TaxonomySrt  = "srt"
)

Variables

Functions

func DownloadIndex

func DownloadIndex(opts IndexOpts, client *Client, f *os.File) (err error)

DownloadIndex downloads an index based on opts and writes the file to f. If the "Current" option is true, the index for the current quarter is downloaded. Otherwise, the Year and Quarter options are used.

func GetConcept

func GetConcept(w io.Writer, client *Client, cik int, taxonomy Taxonomy, concept string) error

GetConcept accesses the Company Concept endpoint. The resulting json file is written to w. Returns RequestError on non-200 status.

func GetFacts

func GetFacts(w io.Writer, client *Client, cik int) error

GetFacts accesses the Company Facts endpoint. The resulting json file is written to w. Returns RequestError on non-200 status.

func GetFrame

func GetFrame(w io.Writer, client *Client, taxonomy Taxonomy, concept string, units string, period Period) error

GetFrame accesses the Frames endpoint. The resulting json file is written to w. Returns RequestError on non-200 status.

func GetReport

func GetReport(w io.Writer, cik int, accessionNumber string, client *Client) (err error)

GetReport copies the XBRL instance file for a given filing into w. The content of w can then be processed using the xbrl package. This function cannot download reports that do not have an XBRL instance file.

Types

type Client

type Client struct {
	HttpClient *http.Client
	Limiter    *Limiter
	UserAgent  string
}

func NewClient

func NewClient(userAgent string) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(url string) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(url string, contentType string, body io.Reader) (*http.Response, error)

type EnumQuarter

type EnumQuarter int
const (
	FirstQuarter EnumQuarter = iota
	SecondQuarter
	ThirdQuarter
	FourthQuarter
)

func (EnumQuarter) String

func (q EnumQuarter) String() string

type IndexEntry

type IndexEntry struct {
	FormType        string
	CompanyName     string
	CIK             int
	DateFiled       time.Time
	AccessionNumber string
}

IndexEntry represents report found in the index.

func ProcessIndex

func ProcessIndex(f *os.File) (entries []IndexEntry)

ProcessIndex reads the index file and generates a list of 10-K and 10-Q entries. The file is not closed after processing! It is the user's responsibility to close the file after processing is complete!

type IndexOpts

type IndexOpts struct {
	Year    int
	Quarter EnumQuarter
	Current bool
}

type Limiter

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

func NewLimiter

func NewLimiter(limit int) (l *Limiter)

func (*Limiter) Stop

func (l *Limiter) Stop()

func (*Limiter) Wait

func (l *Limiter) Wait()

type Period

type Period struct {
	Year    int
	Quarter int
	Instant bool
}

func (Period) String

func (p Period) String() string

type RequestError

type RequestError struct {
	StatusCode int
}

func (*RequestError) Error

func (e *RequestError) Error() string

type Taxonomy

type Taxonomy string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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