Documentation
¶
Index ¶
- Variables
- func BuildReport(ctx context.Context, reader RecordReader, writer ReportWriter) error
- type AggregatorWriter
- func (aw *AggregatorWriter) Iter() iter.Seq[ReportItem]
- func (aw *AggregatorWriter) TotalEarned() decimal.Decimal
- func (aw *AggregatorWriter) TotalFees() decimal.Decimal
- func (aw *AggregatorWriter) TotalSpent() decimal.Decimal
- func (aw *AggregatorWriter) TotalTaxes() decimal.Decimal
- func (aw *AggregatorWriter) Write(_ context.Context, ri ReportItem) error
- type Filler
- type FillerQueue
- type Nature
- type OpenFIGI
- type Record
- type RecordReader
- type ReportItem
- type ReportWriter
- type Side
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInsufficientBoughtVolume = fmt.Errorf("insufficient bought volume")
Functions ¶
func BuildReport ¶
func BuildReport(ctx context.Context, reader RecordReader, writer ReportWriter) error
Types ¶
type AggregatorWriter ¶
type AggregatorWriter struct {
// contains filtered or unexported fields
}
AggregatorWriter tracks ReportItem totals.
func NewAggregatorWriter ¶
func NewAggregatorWriter() *AggregatorWriter
func (*AggregatorWriter) Iter ¶
func (aw *AggregatorWriter) Iter() iter.Seq[ReportItem]
func (*AggregatorWriter) TotalEarned ¶
func (aw *AggregatorWriter) TotalEarned() decimal.Decimal
func (*AggregatorWriter) TotalFees ¶
func (aw *AggregatorWriter) TotalFees() decimal.Decimal
func (*AggregatorWriter) TotalSpent ¶
func (aw *AggregatorWriter) TotalSpent() decimal.Decimal
func (*AggregatorWriter) TotalTaxes ¶
func (aw *AggregatorWriter) TotalTaxes() decimal.Decimal
func (*AggregatorWriter) Write ¶
func (aw *AggregatorWriter) Write(_ context.Context, ri ReportItem) error
type Filler ¶
type Filler struct {
Record
// contains filtered or unexported fields
}
type FillerQueue ¶
type FillerQueue struct {
// contains filtered or unexported fields
}
func (*FillerQueue) Len ¶
func (fq *FillerQueue) Len() int
Len returns how many elements are currently on the queue
func (*FillerQueue) Peek ¶
func (fq *FillerQueue) Peek() (*Filler, bool)
Peek returns the front Filler of the queue in the 1st return value. If the list is empty returns false on the 2nd return value, true otherwise.
func (*FillerQueue) Pop ¶
func (fq *FillerQueue) Pop() (*Filler, bool)
Pop removes and returns the first Filler of the queue in the 1st return value. If the list is empty returns false on the 2nd return value, true otherwise.
func (*FillerQueue) Push ¶
func (fq *FillerQueue) Push(f *Filler)
Push inserts the Filler at the back of the queue.
type Nature ¶
type Nature string
const ( // NatureUnknown is the zero value of Nature type NatureUnknown Nature = "" // NatureG01 describes selling of stocks per table VII: Alienação onerosa de ações/partes sociais NatureG01 Nature = "G01" // NatureG20 describes selling units in investment funds (including ETFs) as per table VII: // Resgates ou alienação de unidades de participação ou liquidação de fundos de investimento NatureG20 Nature = "G20" )
type OpenFIGI ¶
type OpenFIGI struct {
// contains filtered or unexported fields
}
OpenFIGI is a small adapter for the openfigi.com api
func NewOpenFIGI ¶
type RecordReader ¶
type ReportItem ¶
type ReportItem struct {
Symbol string
Nature Nature
BrokerCountry int64
AssetCountry int64
BuyValue decimal.Decimal
BuyTimestamp time.Time
SellValue decimal.Decimal
SellTimestamp time.Time
Fees decimal.Decimal
Taxes decimal.Decimal
}
func (ReportItem) RealisedPnL ¶
func (ri ReportItem) RealisedPnL() decimal.Decimal
type ReportWriter ¶
type ReportWriter interface {
// ReportWriter writes report items
Write(context.Context, ReportItem) error
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.