Documentation ¶
Index ¶
- Variables
- func CikPageParser(page io.Reader) (string, error)
- func FilingPageParser(page io.Reader, _ FilingType) map[string][]Document
- func Init(param InitParams)
- func ParseAllReports(cik string, an string) []int
- func ParseCikAndDocID(url string) (string, string)
- func ParseFilingScale(z *html.Tokenizer, docType string) (map[unitEntity]unit, []string, []string)
- func ParseHyperLinkTag(z *html.Tokenizer, token html.Token) (string, string)
- func ParseKeyName(data string) string
- func ParseTableData(z *html.Tokenizer, parseHref bool) (string, string)
- func ParseTableHeading(z *html.Tokenizer) ([]string, error)
- func ParseTableRow(useCase string, z *html.Tokenizer, parseHref bool) ([]string, []string, error)
- func ParseTableTitle(z *html.Tokenizer) []string
- func QueryPageParser(page io.Reader, docType FilingType) map[string]string
- type Company
- func (c *Company) AddReport(file *Report)
- func (c *Company) AvailableFilings(filingType FilingType) []time.Time
- func (c *Company) CIK() string
- func (c *Company) Filing(fileType FilingType, ts time.Time) (Filing, error)
- func (c *Company) Filings(fileType FilingType, ts ...time.Time) ([]Filing, error)
- func (c *Company) SaveFolder(w io.Writer) error
- func (c *Company) String() string
- func (c *Company) Ticker() string
- type CompanyFolder
- type DocValues
- type Document
- type Filing
- type FilingFetcher
- type FilingType
- type FinancialReport
- type InitParams
- type MenuCategory
- type Report
- func (f *Report) Assets() (float64, error)
- func (f *Report) CapitalExpenditure() (float64, error)
- func (f *Report) Cash() (float64, error)
- func (f *Report) CollectedData() []string
- func (f *Report) CostOfRevenue() (float64, error)
- func (f *Report) CurrentAssets() (float64, error)
- func (f *Report) CurrentLiabilities() (float64, error)
- func (f *Report) DeferredRevenue() (float64, error)
- func (f *Report) Dividend() (float64, error)
- func (f *Report) DividendPerShare() (float64, error)
- func (f *Report) FiledOn() time.Time
- func (f *Report) Goodwill() (float64, error)
- func (f *Report) GrossMargin() (float64, error)
- func (f *Report) Intangibles() (float64, error)
- func (f *Report) Interest() (float64, error)
- func (f *Report) Liabilities() (float64, error)
- func (f *Report) LongTermDebt() (float64, error)
- func (f *Report) NetIncome() (float64, error)
- func (f *Report) OperatingCashFlow() (float64, error)
- func (f *Report) OperatingExpense() (float64, error)
- func (f *Report) OperatingIncome() (float64, error)
- func (f *Report) RetainedEarnings() (float64, error)
- func (f *Report) Revenue() (float64, error)
- func (f *Report) Securities() (float64, error)
- func (f *Report) ShareCount() (float64, error)
- func (f *Report) ShortTermDebt() (float64, error)
- func (f Report) String() string
- func (f *Report) Ticker() string
- func (f *Report) TotalEquity() (float64, error)
- func (f *Report) Type() (FilingType, error)
- func (f *Report) WAShares() (float64, error)
- type Row
- type Section
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
var CategoryDocs = map[string][]Document{ "Cover": { { Category: "Cover", Name: "Cover Page", Type: "Entity Info", Keys: []string{"DOCUMENT", "ENTITY"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Cover", Name: "Cover Page", Type: "Entity Info", Keys: []string{"COVER"}, NotKeys: []string{}, IsRequired: false, }, }, "Financial statements": { { Category: "Financial statements", Name: "Balance sheet", Type: "Assets", Keys: []string{"BALANCE SHEET"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Financial statements", Name: "Balance sheet", Type: "Assets", Keys: []string{"FINANCIAL POSITION"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Financial statements", Name: "Operations statement", Type: "Operations", Keys: []string{"OPERATIONS"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Financial statements", Name: "Income statement", Type: "Income", Keys: []string{"INCOME"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Financial statements", Name: "Income statement", Type: "Income", Keys: []string{"INCOME", "EARNINGS"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Financial statements", Name: "Cash flow statement", Type: "Cash Flow", Keys: []string{"CASH FLOWS"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Financial statements", Name: "Parenthetical statement", Type: "Parenthetical", Keys: []string{"PARENTHETICAL"}, NotKeys: []string{}, IsRequired: false, }, }, "Notes to Financial statements": { { Category: "Notes to Financial statements", Name: "Notes - Notes on EPS", Type: "Notes on EPS", Keys: []string{"EARNINGS", "SHARE"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Notes to Financial statements", Name: "Notes - Notes on Equity", Type: "Notes on Equity", Keys: []string{"SHAREHOLDER", "EQUITY"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Notes to Financial statements", Name: "Notes - Notes on Debt", Type: "Notes on Debt", Keys: []string{"DEBT"}, NotKeys: []string{}, IsRequired: false, }, }, "Notes Tables": {{ Category: "Notes Tables", Name: "Notes - Notes on EPS", Type: "Tables", Keys: []string{"(TABLES)"}, NotKeys: []string{}, IsRequired: false, }, { Category: "Notes Tables", Name: "Accounting Policies (Tables)", Type: "PoliciesTable", Keys: []string{"Accounting Policies (Tables)"}, NotKeys: []string{""}, IsRequired: false, }, }, "Notes Details": { { Category: "}Notes Details", Name: "Notes Details", Type: "Details", Keys: []string{"(DETAILS)", "(DETAIL)"}, NotKeys: []string{""}, IsRequired: false, }, }, "Accounting Policies": { { Category: "Accounting Policies", Name: "Accounting Policies", Type: "Policies", Keys: []string{"(POLICIES)"}, NotKeys: []string{""}, IsRequired: false, }, }, }
var MenuCategories = []MenuCategory{ { Name: "Cover", Keys: []string{"cover"}, }, { Name: "Financial statements", Keys: []string{"financial", "statement"}, }, { Name: "Notes to Financial statements", Keys: []string{"note", "financial", "statement"}, }, { Name: "Notes Tables", Keys: []string{"table"}, }, { Name: "Notes Details", Keys: []string{"detail"}, }, { Name: "Accounting Policies", Keys: []string{"polic"}, }, }
var RequiredDocs = []Document{ { Category: "", Name: "Operations", Type: "Operations", Keys: []string{}, NotKeys: []string{}, IsRequired: true, }, { Name: "Income", Type: "Income", IsRequired: true, }, { Name: "Assets", Type: "Assets", IsRequired: true, }, { Name: "Cash Flow", Type: "Cash Flow", IsRequired: true, }, { Name: "Entity Info", Type: "Entity Info", IsRequired: true, }, }
var RestrictedTags = map[string]bool{}
var XBRLTags = map[string]string{}
A Map of XBRL tags to financial data type This map contains the corresponding GAAP tag and a version of the tag without the GAAP keyword in case the company has only file non-gaap
Functions ¶
func FilingPageParser ¶
func FilingPageParser(page io.Reader, _ FilingType) map[string][]Document
The filing page parser - The top of the page has a list of reports. - Get all the reports (link to all the reports) and put it in an array - The Accordian on the side of the page identifies what each report is - Get the text of the accordian and map the type of the report to the report - Create a map of the report to report link
func Init ¶
func Init(param InitParams)
func ParseAllReports ¶
parseAllReports gets all the reports filed under a given account normalizeNumber
func ParseCikAndDocID ¶
func ParseFilingScale ¶
func ParseHyperLinkTag ¶
func ParseKeyName ¶
func ParseTableRow ¶
func ParseTableTitle ¶
func QueryPageParser ¶
func QueryPageParser(page io.Reader, docType FilingType) map[string]string
This is the parsing of query page where we get the list of filings of a given types ex: https://www.sec.gov/cgi-bin/browse-edgar?CIK=AAPL&owner=exclude&action=getcompany&type=10-Q&count=1&dateb= Assumptions of the parser: - There is interactive data available and there is a button that allows the user to click it - Since it is a link the tag will be a hyperlink with a button with the id=interactiveDataBtn - The actual link is the href attribute in the "a" token just before the id attribute
Types ¶
type Company ¶
type Company struct { sync.Mutex Company string `json:"Company"` FilingLinks map[FilingType]map[string]string `json:"-"` Reports map[FilingType]map[string]*Report `json:"Financial Reports"` // contains filtered or unexported fields }
func (*Company) AvailableFilings ¶
func (c *Company) AvailableFilings(filingType FilingType) []time.Time
func (*Company) SaveFolder ¶
Save the Company folder into the writer in JSON format
type CompanyFolder ¶
type CompanyFolder interface { // Ticker gets the ticker of this company Ticker() string // CIK gets the CIK assigned to the company CIK() string // AvailableFilings gets the list of dates of available filings AvailableFilings(FilingType) []time.Time // Filing gets a filing given a filing type and date of filing. Filing(FilingType, time.Time) (Filing, error) // Filings gets a list of filings. Parallel fetch. Filings(FilingType, ...time.Time) ([]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 // String is a dump routine to view the contents of the folder String() string }
CompanyFolder interface used to get filing information about a company
type Filing ¶
type Filing interface { Ticker() string FiledOn() time.Time Type() (FilingType, 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) Interest() (float64, error) Cash() (float64, error) Securities() (float64, error) Goodwill() (float64, error) Intangibles() (float64, error) Assets() (float64, error) Liabilities() (float64, error) CollectedData() []string }
Filing interface for fetching financial data from a collected filing
type FilingFetcher ¶
type FilingFetcher interface { // CompanyFolder 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
NewFilingFetcher creates a new empty filing fetcher
type FilingType ¶
type FilingType string
FilingType is the type definition of various filing types
const FilingType10K FilingType = "10-K"
FilingType10K is a 10-K annual filing of a company with the SEC
const FilingType10Q FilingType = "10-Q"
FilingType10Q is a 10-Q quarterly filing of a company with the SEC
type FinancialReport ¶
type FinancialReport struct { Title string `json:"Title"` DocValues map[string][]DocValues `json:"DocValue"` DocType FilingType `json:"Filing Type"` Entity *entityData `json:"Entity Information"` Ops *opsData `json:"Operational Information"` Bs *bsData `json:"Balance Sheet Information"` Cf *cfData `json:"Cash Flow Information"` }
func FinReportParser ¶
func FinReportParser(page io.Reader, fr *FinancialReport, docType string) (*FinancialReport, error)
func ParseMappedReports ¶
func ParseMappedReports(typeDocs map[string][]Document, filingType FilingType) (*FinancialReport, error)
func (FinancialReport) String ¶
func (f FinancialReport) String() string
type InitParams ¶
type MenuCategory ¶
type Report ¶
type Report struct { Company string `json:"Company"` Date Timestamp `json:"Report date"` FinData *FinancialReport `json:"Financial Data"` // DocumentType/Document Documents map[string][]Document `json:"Documents"` }
func (*Report) CapitalExpenditure ¶
func (*Report) CollectedData ¶
func (*Report) CostOfRevenue ¶
func (*Report) CurrentAssets ¶
func (*Report) CurrentLiabilities ¶
func (*Report) DeferredRevenue ¶
func (*Report) DividendPerShare ¶
func (*Report) GrossMargin ¶
func (*Report) Intangibles ¶
func (*Report) Liabilities ¶
func (*Report) LongTermDebt ¶
func (*Report) OperatingCashFlow ¶
func (*Report) OperatingExpense ¶
func (*Report) OperatingIncome ¶
func (*Report) RetainedEarnings ¶
func (*Report) Securities ¶
func (*Report) ShareCount ¶
func (*Report) ShortTermDebt ¶
func (*Report) TotalEquity ¶
func (*Report) Type ¶
func (f *Report) Type() (FilingType, error)
type Timestamp ¶
Timestamp is the edgar package representation of time.Time
func (Timestamp) MarshalJSON ¶
MarshalJSON marshals Timestamp in a specific format for JSON marsahlling
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON unmarshals Timestamp in a specific format for JSON unmarshal