edgar

package module
v0.0.0-...-9af9f68 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

README

Edgar

A crawler to get company filing data from XBRL filings. The fetcher parses through the HTML pages and extracts data based on the XBRL tags that it finds and collects it into filing data arranged by filing date.

Goals

The primary requirement of any stock analysis is the data that the comapny files with the SEC. The filings, starting from 2010-11 required to be done using XBRL tags which required the filer to tag each data point with a tag. This made identifying and classifying the data a lot easier for machines.

The goal of this package is to get publically available filings on sec.gov and parse the filings to get data origanized into queriable data points. This package is being ddeveloped with the goal to provide an interface for other packages to get filing data for a company and use that data to create insights such as valuations and trends.

Design

The package is primarily organized as multiple interfaces into the provided functionality. The user is expected to make use of these interfaces to gather the data and query it as needed

Interfaces

All interfaces needed to use this package is defined in edgar.go and described below.

FilingFetcher

This is the starting point for use of this package. The package is initialized with a fetcher. The user will use the fetcher interface to provide a ticker and filing type to startup a company folder. The user has an additional API in the interface to initialize a company folder with a saved folder.

CompanyFolder

A user will be given a company folder with the filings (retrieved ones) for every company (ticker). The user uses the folder to get any filing information related to that company. The filings are indexed internally based on filing type and the date of filing. When a user of the package requests a filing, the filing is looked up in the cache and if not available, will be retrieved from edgar and populated into the folder.

Filing

Filing is an interface to get filing data related to a specific filing. The user uses this interface to extract required data. The Filing is retrieved from the company folder as needed. An error is returned if the data was unavailable.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompanyFolder

type CompanyFolder interface {

	// GetTicker gets the ticker of this company
	Ticker() string

	//AvailableFilings gets the list of dates of available filings
	AvailableFilings(FilingType) []Date

	// Filing gets a filing given a filing type and date of filing.
	Filing(FilingType, Date) (Filing, error)

	// SaveFolder persists the data from the company folder into a writer
	// provided by the user. This stored info can be presented back to
	// the fetcher (using CreateFolder API in fetcher) to recreate the
	// company folder with already parsed data
	SaveFolder(w io.Writer) error

	Cik() string
	// String is a dump routine to view the contents of the folder
	String() string
}

Company interface used to get information and filing about a company

type Date

type Date interface {
	Day() int
	Month() int
	Year() int
	String() string
}

Date defines an interface for filing date This is mainly to validate the date being passed into the package.

type Filing

type Filing interface {
	Ticker() string
	FiledOn() string
	Type() (FilingType, error)
	ShareCount() (float64, error)
	Revenue() (float64, error)
	CostOfRevenue() (float64, error)
	GrossMargin() (float64, error)
	OperatingIncome() (float64, error)
	OperatingExpense() (float64, error)
	NetIncome() (float64, error)
	TotalEquity() (float64, error)
	ShortTermDebt() (float64, error)
	LongTermDebt() (float64, error)
	CurrentLiabilities() (float64, error)
	CurrentAssets() (float64, error)
	DeferredRevenue() (float64, error)
	RetainedEarnings() (float64, error)
	OperatingCashFlow() (float64, error)
	CapitalExpenditure() (float64, error)
	Dividend() (float64, error)
	WAShares() (float64, error)
	DividendPerShare() (float64, error)
	Interest() (float64, error)
	CollectedData() []string
}

Filing interface for fetching financial data

type FilingFetcher

type FilingFetcher interface {

	// GetFilings creates a folder for the company with a list of
	// available filings. No financial data is pulled and the user
	// of the interface can selectively pull financial data into the
	// folder using the CompanyFolder interface
	CompanyFolder(string, ...FilingType) (CompanyFolder, error)

	// CreateFolder creates a company folder using a Reader
	// User can provoder a store of edgar data previous stored
	// by this package (using the Store function of the Company Folder)
	// This function is used to avoid reparsing edgar data and reusing
	// already parsed and stored information.
	CreateFolder(io.Reader, ...FilingType) (CompanyFolder, error)
}

FilingFetcher fetches the filing requested

func NewFilingFetcher

func NewFilingFetcher() FilingFetcher

type FilingType

type FilingType string
var (
	//Filing types
	FilingType10Q FilingType = "10-Q"
	FilingType10K FilingType = "10-K"
)

Jump to

Keyboard shortcuts

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