Internal state persistence (#27)
Badges / coveralls (push) Successful in 1m4s

Allow us to generate year over year reports without having to rerun everything from the beginning.

Co-authored-by: Natercio Moniz <[email protected]>
This commit was merged in pull request #27.
This commit is contained in:
2026-08-03 00:33:06 +01:00
committed by natercio
parent 1ce8561782
commit 9bd4230ff1
25 changed files with 1726 additions and 178 deletions
+4 -3
View File
@@ -12,6 +12,7 @@ import (
"github.com/biter777/countries"
"github.com/nmoniz/any2anexoj/internal"
"github.com/nmoniz/any2anexoj/internal/ofigi"
"github.com/shopspring/decimal"
)
@@ -70,10 +71,10 @@ func (r Record) Nature() internal.Nature {
type RecordReader struct {
reader *csv.Reader
figi *internal.OpenFIGI
figi *ofigi.Client
}
func NewRecordReader(r io.Reader, f *internal.OpenFIGI) *RecordReader {
func NewRecordReader(r io.Reader, f *ofigi.Client) *RecordReader {
return &RecordReader{
reader: csv.NewReader(r),
figi: f,
@@ -187,7 +188,7 @@ func (rr RecordReader) ReadRecord(ctx context.Context) (internal.Record, error)
}
}
func figiNatureGetter(ctx context.Context, of *internal.OpenFIGI, isin string) func() internal.Nature {
func figiNatureGetter(ctx context.Context, of *ofigi.Client, isin string) func() internal.Nature {
return sync.OnceValue(func() internal.Nature {
secType, err := of.SecurityTypeByISIN(ctx, isin)
if err != nil {