Documentation ¶
Index ¶
- Constants
- Variables
- func FromSector(company, yamlFile string) (companies []string, sectorName string, err error)
- func FuzzyFind(source string, targets []string, maxDistance int) (found string)
- func FuzzyMatch(src string, list []string, distance int) bool
- func Hash(s string) uint32
- func ImportCsv(db *sql.DB, dataType string, file string) (err error)
- func RemoveDiacritics(original string) (result string)
- func SectorsToYaml(yamlFile string) (err error)
- type FIIParser
- func (fii *FIIParser) Details(code string) (*rapina.FIIDetails, error)
- func (fii *FIIParser) Dividends(code, monthYear string) (*[]rapina.Dividend, error)
- func (fii *FIIParser) SaveDetails(stream []byte) error
- func (fii *FIIParser) SaveDividend(stream map[string]string) (*rapina.Dividend, error)
- func (fii *FIIParser) SelectFIIDetails(code string) (*rapina.FIIDetails, error)
- type S
- type Sector
- type Segment
- type StockParser
- type Subsector
Constants ¶
const ( UNDEF uint32 = iota SPACE // Balance Sheet Caixa AplicFinanceiras Estoque Equity ContasARecebCirc ContasARecebNCirc AtivoCirc AtivoNCirc AtivoTotal PassivoCirc PassivoNCirc PassivoTotal DividaCirc DividaNCirc DividendosJCP DividendosMin // Income Statement Vendas CustoVendas DespesasOp EBIT ResulFinanc ResulOpDescont LucLiq // DFC FCO FCI FCF // Value Added Statement Deprec JurosCapProp Dividendos // Values stored on table 'fre' FreeFloat // Financial ratios EstoqueMedio EquityAvg // Financial scale (unit, thousand) Escala // Stock quote from last day of year Quote )
Bookkeeping account codes If you add new const values, run 'go generate' to update the generated code
Variables ¶
var ( ErrDBUnset = errors.New("database not set") ErrNotFound = errors.New("not found") )
Error codes
var ( // ErrAccumITR error for accumulatd quarterly results ErrAccumITR = fmt.Errorf("accumulated quarterly results") )
var ( // ErrCNPJNotFound error ErrCNPJNotFound = fmt.Errorf("CNPJ not found") )
Functions ¶
func FromSector ¶ added in v0.8.1
FromSector returns all companies from the same sector as the 'company'
func FuzzyFind ¶ added in v0.8.1
FuzzyFind returns the most approximate string inside 'list' that matches the 'src' string within a maximum 'distance'.
func FuzzyMatch ¶ added in v0.8.1
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 ImportCsv ¶ added in v0.9.0
ImportCsv start the data import process, including the database creation if necessary
func RemoveDiacritics ¶ added in v0.8.1
RemoveDiacritics transforms, for example, "žůžo" into "zuzo"
func SectorsToYaml ¶ added in v0.8.1
SectorsToYaml grab data from B3 website and prints out to a yaml file with all companies grouped by sector, subsector, segment
Types ¶
type FIIParser ¶ added in v1.0.0
type FIIParser struct {
// contains filtered or unexported fields
}
FIIParser implements sqlite storage for a rapina.FIIParser object.
func (*FIIParser) Details ¶ added in v1.0.0
func (fii *FIIParser) Details(code string) (*rapina.FIIDetails, error)
Details returns the FII Details for the 'code' or an empty string if not found in the db.
func (*FIIParser) SaveDetails ¶ added in v1.1.0
StoreFIIDetails parses the stream data into FIIDetails and returns the *FIIDetails.
func (*FIIParser) SaveDividend ¶ added in v1.0.0
SaveDividend parses and stores the map in the db. Returns the parsed stream.
func (*FIIParser) SelectFIIDetails ¶ added in v1.0.0
func (fii *FIIParser) SelectFIIDetails(code string) (*rapina.FIIDetails, error)
type StockParser ¶ added in v1.0.0
type StockParser struct {
// contains filtered or unexported fields
}
func NewStock ¶ added in v1.0.0
NewStock creates the required tables, if necessary, and returns a StockParser instance.
func (*StockParser) Code ¶ added in v1.1.0
func (s *StockParser) Code(companyName, stockType string) (string, error)
Quote returns the company ON stock code, where stockType is: ON, PN, UNT, CI [CI = FII]
func (*StockParser) Quote ¶ added in v1.0.0
func (s *StockParser) Quote(code, date string) (float64, error)
Quote returns the quote from DB.
func (*StockParser) Save ¶ added in v1.0.0
Save parses the 'stream', get the 'code' stock quotes and store it on 'db'. Returns the number of registers saved.
func (*StockParser) SaveB3Quotes ¶ added in v1.0.0
func (s *StockParser) SaveB3Quotes(filename string) error