update remaining references to internal.OpenFIGI
This commit is contained in:
@@ -98,7 +98,7 @@ func run(ctx context.Context) error {
|
||||
func getReader(platform string, ofAPIKey string) (internal.RecordReader, error) {
|
||||
switch platform {
|
||||
case "trading212":
|
||||
return trading212.NewRecordReader(os.Stdin, ofigi.NewClient(&http.Client{Timeout: 5 * time.Second}, ofAPIKey)), nil
|
||||
return trading212.NewRecordReader(os.Stdin, ofigi.NewOpenFIGI(&http.Client{Timeout: 5 * time.Second}, ofAPIKey)), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported platform: %s", platform)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/nmoniz/any2anexoj/internal"
|
||||
"github.com/nmoniz/any2anexoj/internal/ofigi"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
@@ -221,7 +222,7 @@ func TestRecordReader_ReadRecord_Split(t *testing.T) {
|
||||
func Test_figiNatureGetter(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string // description of this test case
|
||||
of *internal.OpenFIGI
|
||||
of *ofigi.Client
|
||||
want internal.Nature
|
||||
}{
|
||||
{
|
||||
@@ -272,7 +273,7 @@ func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return f(req)
|
||||
}
|
||||
|
||||
func NewFigiClientSecurityTypeStub(t testing.TB, securityType string) *internal.OpenFIGI {
|
||||
func NewFigiClientSecurityTypeStub(t testing.TB, securityType string) *ofigi.Client {
|
||||
t.Helper()
|
||||
|
||||
c := &http.Client{
|
||||
@@ -287,10 +288,10 @@ func NewFigiClientSecurityTypeStub(t testing.TB, securityType string) *internal.
|
||||
}),
|
||||
}
|
||||
|
||||
return internal.NewOpenFIGI(c, "")
|
||||
return ofigi.NewOpenFIGI(c, "")
|
||||
}
|
||||
|
||||
func NewFigiClientErrorStub(t testing.TB, err error) *internal.OpenFIGI {
|
||||
func NewFigiClientErrorStub(t testing.TB, err error) *ofigi.Client {
|
||||
t.Helper()
|
||||
|
||||
c := &http.Client{
|
||||
@@ -300,5 +301,5 @@ func NewFigiClientErrorStub(t testing.TB, err error) *internal.OpenFIGI {
|
||||
}),
|
||||
}
|
||||
|
||||
return internal.NewOpenFIGI(c, "")
|
||||
return ofigi.NewOpenFIGI(c, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user