Documentation ¶
Index ¶
Constants ¶
const ( DateFormatDDMMYYYY = "dd/mm/yyyy" DateFormatMMDDYYYY = "mm/dd/yyyy" )
List of available date formats.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bond ¶
type Bond struct { Name string `json:"name"` Security string `json:"security"` Coupon float64 `json:"coupon"` Yield float64 `json:"yield"` Maturity *time.Time `json:"maturity"` LastPrice float64 `json:"lastPrice"` CurrentPrice *float64 `json:"currentPrice"` CurrentPriceURL *string `json:"currentPriceURL"` Accrued float64 `json:"accrued"` AccruedDays int64 `json:"accruedDays"` Duration float64 `json:"duration"` YearsToMaturity float64 `json:"yearsToMaturity"` MinimumPiece float64 `json:"minimumPiece"` Country string `json:"country"` Risk BondRisk `json:"risk"` Code string `json:"code"` }
Bond contains the bond descriptions.
func (Bond) Interesting ¶
Interesting returns if the bond is interesting according to some predefined rules.
type BondReport ¶
type BondReport struct { Filter XLXSReport string `json:"xlsxReport"` DateFormat DateFormat `json:"dateFormat"` }
BondReport contains all bonds data to be analyzed.
type BondRisk ¶
type BondRisk struct { StandardPoor string `json:"standardPoor"` Moody string `json:"moody"` Fitch string `json:"fitch"` }
BondRisk determinates the risk according to different entities.
type Bonds ¶
type Bonds []Bond
Bonds is a collection of Bond.
func FindBestBonds ¶
func FindBestBonds(ctx context.Context, report BondReport) (Bonds, error)
FindBestBonds determinates the best bonds from the bond report. It expects the report to contain a xlsx content (Excel) encoded in base64. After parsing the xlxs it performs some filtering and sorting actions to determinate the best bond.
func (Bonds) FillCurrentPrice ¶
func (b Bonds) FillCurrentPrice()
FillCurrentPrice looks for the current price from the given bonds.
type DateFormat ¶ added in v1.0.1
type DateFormat string
DateFormat defines all acceptable date formats used when parsing the report.
func (*DateFormat) UnmarshalJSON ¶ added in v1.0.1
func (d *DateFormat) UnmarshalJSON(data []byte) error
UnmarshalJSON parse the date format input value. It will return an error if the date format isn't acceptable.
type Duration ¶ added in v1.0.1
Duration stores the duration in years.
func (*Duration) UnmarshalJSON ¶ added in v1.0.1
UnmarshalJSON parse and store a duration in years.
type Filter ¶ added in v1.0.1
type Filter struct { MinimumCoupon float64 `json:"minCoupon"` MaximumMaturity Duration `json:"maxMaturity"` MinimumPrice float64 `json:"minPrice"` MaximumPrice float64 `json:"maxPrice"` MinimumPiece float64 `json:"minPiece"` MaximumPiece float64 `json:"maxPiece"` FocusedOnly bool `json:"focusedOnly"` }
Filter contains all filters that can be used to determinate the best bond.