sec

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 16 Imported by: 0

README

sec-client

Documentation

Index

Constants

View Source
const AllCompanyFactsEndpoint = Protocol + SecUrl + CompanyFactsZip
View Source
const CompanyFactsEndpoint = Protocol + SecDataUrl + "/api/xbrl/companyfacts"
View Source
const CompanyFactsZip string = "/Archives/edgar/daily-index/xbrl/companyfacts.zip"
View Source
const FilingsUrlEndpoint = Protocol + SecReportUrl + "/Senate-Stock-Disclosures/Filings"
View Source
const Protocol string = "https://"
View Source
const SECDateFormat = "2006-01-02"
View Source
const SecDataUrl string = "data.sec.gov"
View Source
const SecReportUrl string = "www.sec.report"
View Source
const SecUrl string = "www.sec.gov"
View Source
const TickerEndpoint = Protocol + SecUrl + "/files/company_tickers.json"

Variables

This section is empty.

Functions

func CompleteUrl

func CompleteUrl(partial string) string

func StandardSecDateFormatParse

func StandardSecDateFormatParse(date string) (time.Time, error)

func StandardSecDateFormatParseSwallowError added in v0.3.1

func StandardSecDateFormatParseSwallowError(date string) time.Time

Types

type Client added in v0.4.0

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

func NewClient added in v0.4.0

func NewClient() *Client

NewClient creates a new client pointer without any persistence layer, meaning that all requests will go directly to sec.gov and will have to be rate limited.

func NewClientWithPersistence added in v0.4.0

func NewClientWithPersistence(persistenceLayer PersistenceLayer) *Client

NewClientWithPersistence creates a new client pointer with given persistence layer implementation

func (*Client) GetAllFactsForTicker added in v0.4.0

func (client *Client) GetAllFactsForTicker(ticker Ticker) (CompanyFacts, error)

func (*Client) GetAllTickers added in v0.4.0

func (client *Client) GetAllTickers() ([]Ticker, error)

GetAllTickers Fetches all current tickers from the sec.gov api, uses caching for speed

func (*Client) GetBulk added in v0.4.0

func (client *Client) GetBulk() (chan *TickerWithFacts, error)

GetBulk fetches ALL company facts, and provides them on the returned channel. This is highly dependent on your connection speed and your computational resources. Typically, it takes a minute or so before the first facts start appearing on the channel. Errors related to parsing of individual facts will be sent in the channel and will not be returned in this function call

func (*Client) GetTickerForCIK added in v0.4.0

func (client *Client) GetTickerForCIK(cik uint64) (Ticker, error)

func (*Client) GetTickerForSymbol added in v0.4.0

func (client *Client) GetTickerForSymbol(symbol string) (Ticker, error)

type CompanyFacts

type CompanyFacts struct {
	CIK        uint64 `json:"cik"`
	EntityName string `json:"entityName"`
	Facts      Facts  `json:"facts"`
}

func (CompanyFacts) MarshalEasyJSON added in v0.4.0

func (v CompanyFacts) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CompanyFacts) MarshalJSON added in v0.4.0

func (v CompanyFacts) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CompanyFacts) UnmarshalEasyJSON added in v0.4.0

func (v *CompanyFacts) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CompanyFacts) UnmarshalJSON added in v0.4.0

func (v *CompanyFacts) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Fact

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

func (Fact) MarshalEasyJSON added in v0.4.0

func (v Fact) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Fact) MarshalJSON added in v0.4.0

func (v Fact) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Fact) UnmarshalEasyJSON added in v0.4.0

func (v *Fact) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Fact) UnmarshalJSON added in v0.4.0

func (v *Fact) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Facts

type Facts struct {
	DEI    map[string]Fact `json:"dei"`
	UsGAAP map[string]Fact `json:"us-gaap"`
}

Facts A representation of a

func (Facts) MarshalEasyJSON added in v0.4.0

func (v Facts) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Facts) MarshalJSON added in v0.4.0

func (v Facts) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Facts) UnmarshalEasyJSON added in v0.4.0

func (v *Facts) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Facts) UnmarshalJSON added in v0.4.0

func (v *Facts) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PersistenceLayer added in v0.1.0

type PersistenceLayer interface {
	SaveFacts(Ticker, *CompanyFacts) error
	LoadFacts(Ticker) (*CompanyFacts, error)
}

PersistenceLayer is an interface that you can use to create custom persistence layers for the sec client The client makes no assumption about thread safety, that has to be handled by the implementation if required

type Ticker

type Ticker struct {
	// Central Index Key (CIK) is used on the SEC's computer systems to identify corporations
	// and individual people who have filed disclosure with the SEC
	CIK uint64 `json:"cik_str"`

	// The symbol of the company for example NDAQ
	Symbol string `json:"ticker"`

	// The name of the company
	Name string `json:"title"`
}

Ticker Represents a ticker in the given SEC format

type TickerWithFacts added in v0.4.0

type TickerWithFacts struct {
	Ticker       Ticker
	CompanyFacts CompanyFacts
	Error        error
}

type Unit

type Unit struct {
	Value float64 `json:"val"`

	Start string `json:"start"`
	End   string `json:"end"`

	FiscalYear   uint16 `json:"fy"`
	FiscalPeriod string `json:"fp"`

	Account string `json:"accn"`

	Form    string `json:"form"`
	FiledOn string `json:"filed"`
}

func (*Unit) EndAsTime added in v0.3.1

func (unit *Unit) EndAsTime() time.Time

func (*Unit) FiledOnAsTime added in v0.3.1

func (unit *Unit) FiledOnAsTime() time.Time

func (*Unit) IsInstant added in v0.3.1

func (unit *Unit) IsInstant() bool

func (*Unit) IsPeriod added in v0.3.1

func (unit *Unit) IsPeriod() bool

func (*Unit) IsQuarterRange added in v0.3.1

func (unit *Unit) IsQuarterRange() bool

func (*Unit) IsYearRange added in v0.3.1

func (unit *Unit) IsYearRange() bool

func (Unit) MarshalEasyJSON added in v0.4.0

func (v Unit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Unit) MarshalJSON added in v0.4.0

func (v Unit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Unit) StartAsTime added in v0.3.1

func (unit *Unit) StartAsTime() time.Time

func (*Unit) UnmarshalEasyJSON added in v0.4.0

func (v *Unit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Unit) UnmarshalJSON added in v0.4.0

func (v *Unit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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