Documentation
¶
Index ¶
- Variables
- func Cleanup(arqs []Arquivo) []string
- func DiaÚtil(d Data) bool
- func MinMax(itr []InformeTrimestral) (int, int)
- func NormalizeString(s string) string
- func ProcessarArquivoDFP(ctx context.Context, arq Arquivo, dfp *DFP) error
- func RangeAnos(itr []InformeTrimestral, reverse bool) []int
- func RangeAnosVTs(v1, v2 []ValoresTrimestrais) []int
- func Similar(s1, s2 string) bool
- func TrimestresComDados(itr []InformeTrimestral) []bool
- func Zerado(valores []ValoresTrimestrais) bool
- func ÚltimoTrimestre(ano int, valores []ValoresTrimestrais) int
- func ÚltimoTrimestreReal(itrs []InformeTrimestral) int
- type Arquivo
- type CVM
- type Conta
- type Cotação
- type CvmDataSource
- type CvmType
- type DFP
- type DFPEmpresa
- type Data
- type Dinheiro
- type Empresa
- type InformeTrimestral
- type ValoresTrimestrais
- func AddVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
- func DivVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
- func ManterÚltimoTrimestre(vts []ValoresTrimestrais) []ValoresTrimestrais
- func MultVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
- func OpVTs(op rune, v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
- func SubVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
- func TTM(acct []ValoresTrimestrais) []ValoresTrimestrais
- func (v ValoresTrimestrais) Add(other ValoresTrimestrais) ValoresTrimestrais
- func (v ValoresTrimestrais) Div(other ValoresTrimestrais) ValoresTrimestrais
- func (v ValoresTrimestrais) DivNum(divisor float64) ValoresTrimestrais
- func (v ValoresTrimestrais) Mult(other ValoresTrimestrais) ValoresTrimestrais
- func (v ValoresTrimestrais) MultNum(factor float64) ValoresTrimestrais
- func (v *ValoresTrimestrais) SetT(n int, val float64)
- func (v ValoresTrimestrais) Sub(other ValoresTrimestrais) ValoresTrimestrais
- func (v *ValoresTrimestrais) T(n int) float64
Constants ¶
This section is empty.
Variables ¶
var ( ErrCabeçalhoCsv = errors.New("cabeçalho") ErrFaltaItemCsv = errors.New("itens faltando") ErrDataInválidaCsv = errors.New("data inválida") )
var ErrDataInválida = errors.New("data inválida")
Functions ¶
func MinMax ¶
func MinMax(itr []InformeTrimestral) (int, int)
func NormalizeString ¶
func ProcessarArquivoDFP ¶
func RangeAnos ¶
func RangeAnos(itr []InformeTrimestral, reverse bool) []int
RangeAnos retorna a sequência de anos entre o mínimo e o máximo de anos presentes nos InformeTrimestral. Crescente se reverse for false, senão decrescente.
func RangeAnosVTs ¶
func RangeAnosVTs(v1, v2 []ValoresTrimestrais) []int
func TrimestresComDados ¶
func TrimestresComDados(itr []InformeTrimestral) []bool
func Zerado ¶
func Zerado(valores []ValoresTrimestrais) bool
func ÚltimoTrimestre ¶
func ÚltimoTrimestre(ano int, valores []ValoresTrimestrais) int
ÚltimoTrimestre retorna o último trimestre com valor não nulo
func ÚltimoTrimestreReal ¶
func ÚltimoTrimestreReal(itrs []InformeTrimestral) int
ÚltimoTrimestreReal retorna o último trimestre com valor não nulo usando o valor do Ativo Total como base.
Types ¶
type Conta ¶
type Conta struct {
Código string // 1, 1.01, 1.02...
Descr string // Descrição
Grupo string // BPA, BPP, DRE, DFC...
DataIniExerc string // AAAA-MM-DD
DataFimExerc string // AAAA-MM-DD
OrdemExerc string // ÚLTIMO ou PENÚLTIMO
Total Dinheiro // $
Meses int // Meses acumulados desde o início do período
Consolidado bool // Individual ou Consolidado
}
Conta com os dados das Demonstrações Financeiras Padronizadas (DFP) ou com as Informações Trimestrais (ITR).
type Cotação ¶
type Cotação struct {
Código string
Data Data
Abertura Dinheiro
Máxima Dinheiro
Mínima Dinheiro
Encerramento Dinheiro
Volume float64
}
func (*Cotação) PreçoTípico ¶
PreçoTípico é a média aritmética entre o preço máximo, o preço mínimo e o preço de fechamento
type CvmDataSource ¶
type DFP ¶
type DFP map[string]*DFPEmpresa
func (*DFP) AppendConta ¶
func (dfp *DFP) AppendConta(e *DFPEmpresa) bool
AppendConta adiciona uma conta ao DFP
type DFPEmpresa ¶
type Data ¶
Data ---------------------------------------------------
func DiaUtilAnterior ¶
DiaUtilAnterior retorna o dia útil anterior.
type Dinheiro ¶
Dinheiro -----------------------------------------------
type InformeTrimestral ¶
type InformeTrimestral struct {
Codigo string
Descr string
Valores []ValoresTrimestrais
}
func UnificarContasSimilares ¶
func UnificarContasSimilares(itr []InformeTrimestral) []InformeTrimestral
UnificarContasSimilares unifica as linhas similares do InformeTrimestral comparando o código, sem o último grupo (ex.: 1.02.05.01 => 1.02.05), com as próximas linhas. Cada linha (InformeTrimestral) possui o seguinte formato: Linha n => [Ano:ano Valor trimestre 1 | Valor T2 | Valor T3 | Valor T4] Exemplo: "Tributo a recuperar" => [2019 1|0|5|3; 2021 5|2|0|0] "Tributos a recuperar" => [2019 0|2|0|0; 2020 1|4|2|2; 2021 0|0|1|2] Resultado: "Tributo a recuperar" => [2019 1|2|5|3; 2020 1|4|2|2; 2021 5|2|1|2]
type ValoresTrimestrais ¶
ValoresTrimestrais armazena os valores ValoresTrimestrais de um determinado ano. Considera-se nulo o valor do trimestre se o valor for NaN.
func AddVTs ¶
func AddVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
func DivVTs ¶
func DivVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
func ManterÚltimoTrimestre ¶
func ManterÚltimoTrimestre(vts []ValoresTrimestrais) []ValoresTrimestrais
ManterÚltimoTrimestre mantém apenas o último trimestre não nulo de cada ano
func MultVTs ¶
func MultVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
func OpVTs ¶
func OpVTs(op rune, v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
func SubVTs ¶
func SubVTs(v1, v2 []ValoresTrimestrais) []ValoresTrimestrais
func TTM ¶
func TTM(acct []ValoresTrimestrais) []ValoresTrimestrais
TTM armazena a soma dos últimos 4 trimestres em cada um dos trimestres; usado em métricas que comparam como valores do balanço patrimonial. Exemplo: ROE = Lucro Líq. dos últimos 12 meses / Patrim.Líq.
func (ValoresTrimestrais) Add ¶
func (v ValoresTrimestrais) Add(other ValoresTrimestrais) ValoresTrimestrais
func (ValoresTrimestrais) Div ¶
func (v ValoresTrimestrais) Div(other ValoresTrimestrais) ValoresTrimestrais
func (ValoresTrimestrais) DivNum ¶
func (v ValoresTrimestrais) DivNum(divisor float64) ValoresTrimestrais
func (ValoresTrimestrais) Mult ¶
func (v ValoresTrimestrais) Mult(other ValoresTrimestrais) ValoresTrimestrais
func (ValoresTrimestrais) MultNum ¶
func (v ValoresTrimestrais) MultNum(factor float64) ValoresTrimestrais
func (*ValoresTrimestrais) SetT ¶
func (v *ValoresTrimestrais) SetT(n int, val float64)
SetT salva o valor do trimestre pelo índice (1 <= n <= 4)
func (ValoresTrimestrais) Sub ¶
func (v ValoresTrimestrais) Sub(other ValoresTrimestrais) ValoresTrimestrais
func (*ValoresTrimestrais) T ¶
func (v *ValoresTrimestrais) T(n int) float64
T retorna o valor do trimestre pelo índice (1 <= n <= 4)
