Add `InvPosition() InvPosition` to `Position` interface.

This commit is contained in:
David Bartley 2023-03-12 04:50:59 -07:00 committed by Aaron Lindsay
parent 12aca9ab06
commit c2490e1c6a
1 changed files with 26 additions and 0 deletions

View File

@ -764,6 +764,7 @@ type InvPosition struct {
// Position is an interface satisfied by all the other *Position types // Position is an interface satisfied by all the other *Position types
type Position interface { type Position interface {
PositionType() string PositionType() string
InvPosition() InvPosition
} }
// DebtPosition represents a position held in a debt security // DebtPosition represents a position held in a debt security
@ -777,6 +778,11 @@ func (p DebtPosition) PositionType() string {
return "POSDEBT" return "POSDEBT"
} }
// InvPosition returns InvPos
func (p DebtPosition) InvPosition() InvPosition {
return p.InvPos
}
// MFPosition represents a position held in a mutual fund // MFPosition represents a position held in a mutual fund
type MFPosition struct { type MFPosition struct {
XMLName xml.Name `xml:"POSMF"` XMLName xml.Name `xml:"POSMF"`
@ -792,6 +798,11 @@ func (p MFPosition) PositionType() string {
return "POSMF" return "POSMF"
} }
// InvPosition returns InvPos
func (p MFPosition) InvPosition() InvPosition {
return p.InvPos
}
// OptPosition represents a position held in an option // OptPosition represents a position held in an option
type OptPosition struct { type OptPosition struct {
XMLName xml.Name `xml:"POSOPT"` XMLName xml.Name `xml:"POSOPT"`
@ -804,6 +815,11 @@ func (p OptPosition) PositionType() string {
return "POSOPT" return "POSOPT"
} }
// InvPosition returns InvPos
func (p OptPosition) InvPosition() InvPosition {
return p.InvPos
}
// OtherPosition represents a position held in a security type not covered by // OtherPosition represents a position held in a security type not covered by
// the other *Position elements // the other *Position elements
type OtherPosition struct { type OtherPosition struct {
@ -816,6 +832,11 @@ func (p OtherPosition) PositionType() string {
return "POSOTHER" return "POSOTHER"
} }
// InvPosition returns InvPos
func (p OtherPosition) InvPosition() InvPosition {
return p.InvPos
}
// StockPosition represents a position held in a stock // StockPosition represents a position held in a stock
type StockPosition struct { type StockPosition struct {
XMLName xml.Name `xml:"POSSTOCK"` XMLName xml.Name `xml:"POSSTOCK"`
@ -830,6 +851,11 @@ func (p StockPosition) PositionType() string {
return "POSSTOCK" return "POSSTOCK"
} }
// InvPosition returns InvPos
func (p StockPosition) InvPosition() InvPosition {
return p.InvPos
}
// PositionList represents a list of positions held in securities in an // PositionList represents a list of positions held in securities in an
// investment account // investment account
type PositionList []Position type PositionList []Position