parsers

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNDEF uint32 = iota
	SPACE

	// Balance Sheet
	Caixa
	AplicFinanceiras
	Estoque
	Equity
	DividaCirc
	DividaNCirc

	// Income Statement
	Vendas
	CustoVendas
	DespesasOp
	EBIT
	LucLiq

	// DFC
	FCO
	FCI
	FCF

	// Value Added Statement
	Deprec
	JurosCapProp
	Dividendos
)

Bookkeeping account codes If you add new const values, run 'go generate' to update the generated code

Variables

This section is empty.

Functions

func CodeAccounts

func CodeAccounts(db *sql.DB) (err error)

CodeAccounts code all the accounts with the bookkeeping accounts constants An account is a line in the financial statement (e.g., equity, cash, EBITDA, etc.) How to check entries: cat b??_cia_aberta_con_201* | iconv -f WINDOWS-1252 -t UTF-8 | awk -F ';' '{print $11 " "$12}' | sort | uniq -c | grep -Ei "Caixa" cat d??_cia_aberta_con_201* | iconv -f WINDOWS-1252 -t UTF-8 | awk -F ';' '{print $12 " "$13}' | sort | uniq -c | grep -Ei " 3\.01 "

func CreateIndexes

func CreateIndexes(db *sql.DB, group int) (err error)

CreateIndexes to optimize queries group 1: used for parsers.CodeAccounts group 2: used for reports group 3: all

func DropIndexes

func DropIndexes(db *sql.DB) (err error)

DropIndexes created by createIndexes

func FromSector added in v0.8.1

func FromSector(company, yamlFile string) (companies []string, sectorName string, err error)

FromSector returns all companies from the same sector as the 'company'

func FuzzyFind added in v0.8.1

func FuzzyFind(source string, targets []string, maxDistance int) (found string)

FuzzyFind returns the most approximate string inside 'list' that matches the 'src' string within a maximum 'distance'.

func FuzzyMatch added in v0.8.1

func FuzzyMatch(src string, list []string, distance int) bool

FuzzyMatch measures the Levenshtein distance between the source and the list, returning true if the distance is less or equal the 'distance'. Diacritics are removed from 'src' and 'list'.

func GetHash

func GetHash(s string) uint32

GetHash returns the FNV-1 non-cryptographic hash

func ImportCsv added in v0.9.0

func ImportCsv(db *sql.DB, dataType string, file string) (err error)

ImportCsv start the data import process, including the database creation if necessary

func RemoveDiacritics added in v0.8.1

func RemoveDiacritics(original string) (result string)

RemoveDiacritics transforms, for example, "žůžo" into "zuzo"

func SectorsToYaml added in v0.8.1

func SectorsToYaml(yamlFile string) (err error)

SectorsToYaml grab data from B3 website and prints out to a yaml file with all companies grouped by sector, subsector, segment

Types

type S added in v0.8.1

type S struct {
	Sectors []Sector `yaml:"Setores"`
}

S contains the sectors

type Sector added in v0.8.1

type Sector struct {
	Name       string      `yaml:"Setor"`
	Subsectors []Subsector `yaml:"Subsetores"`
}

Sector is divided into subsectors

type Segment added in v0.8.1

type Segment struct {
	Name      string   `yaml:"Segmento"`
	Companies []string `yaml:"Empresas"`
}

Segment contains companies from the same sector/subsector/segment

type Subsector added in v0.8.1

type Subsector struct {
	Name     string    `yaml:"Subsetor"`
	Segments []Segment `yaml:"Segmentos"`
}

Subsector is divided into segments

Jump to

Keyboard shortcuts

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