financial

package
v1.2.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbbrToInt

func AbbrToInt(str string) int

The function AbbrToInt converts a string representation of a number with abbreviations (such as "1M" for 1 million) into its corresponding integer value.

func FormatAmount

func FormatAmount(inAmount float64, inCCY string) string

func FormatAmountFullDPS

func FormatAmountFullDPS(inAmount string, inCCY string) string

FormatAmountFullDPS returns a formated string version of a CCY amount to 7dps The function takes an amount and currency code as input, formats the amount with the specified precision and currency symbol, and returns the formatted amount as a string.

func FormatAmountToDPS

func FormatAmountToDPS(inAmount string, inCCY string, inPrec string) string

FormatAmountToDPS returns a formated string version of a CCY amount to a given DPS The function takes an amount, currency, and precision as input, and formats the amount to the specified decimal places with the currency symbol.

func GetDateFromTenor

func GetDateFromTenor(tenor Tenor, tradeDate time.Time, ccy ...string) (time.Time, error)

The function `GetDateFromTenor` calculates the settlement date based on the given tenor, trade date, and currency.

func GetFirstDayOfYear

func GetFirstDayOfYear(inTime time.Time) time.Time

The function "GetFirstDayOfYear" returns the first day of the year, assuming that January 1st is a holiday and the first day is shifted to January 2nd.

func GetSpotDate

func GetSpotDate(inTime time.Time) time.Time

GetSpotDate(inTime invalid type) The function "GetSpotDate" takes a time input and returns a modified time value.

func GetTenorDate

func GetTenorDate(inTime time.Time, inMonth string) time.Time

CalculateSpotDate(inTime invalid type) The function `GetTenorDate` takes a time and a month as input, adds the specified number of months to the time, and returns the resulting date.

func SettlementDate

func SettlementDate(major string, minor string, pivotDate time.Time) (time.Time, error)

func SettlementDateVia

func SettlementDateVia(major string, minor string, pivotDate time.Time, via string) (time.Time, error)

Types

type FinDate

type FinDate struct {
	Code     string
	Name     string
	Date     time.Time
	Index    int
	Simple   string
	External string
	Human    string
}

The "FinDate" type represents a date with various properties and formats. @property {string} Code - The "Code" property is a string that represents a code associated with the date. @property {string} Name - The "Name" property is a string that represents the name of the date. @property FinDate - The "FinDate" property is of type "time.Time" and represents a specific date and time. @property {int} Sort - The "Sort" property is an integer that is used to determine the order in which the dates should be sorted. It can be used to sort the dates in ascending or descending order based on this value. @property {string} Simple - The "Simple" property is a string that represents the date in a simplified format. It could be a formatted string that only includes the day, month, and year of the date. @property {string} External - The "External" property in the FinDate struct is a string that represents an external reference or identifier related to the date. @property {string} Human - The "Human" property in the "FinDate" struct represents the date in a human-readable format. It is likely used to display the date to users in a more understandable way, such as "January 1, 2022".

func GetLadder

func GetLadder(pivotDate time.Time, ccy ...string) ([]FinDate, int, error)

The function `GetLadder` takes a pivot date and a list of currency codes as input, and returns a list of dates based on a rate ladder.

type Tenor

type Tenor struct {
	// contains filtered or unexported fields
}

func GetTenorFromDate

func GetTenorFromDate(inDate, baseDate time.Time, ccy ...string) (Tenor, error)

The function `GetTenorFromDate` takes a date and optional currency as input and returns the corresponding tenor or an error.

func NewTenor

func NewTenor(term string) (Tenor, error)

The function NewTenor takes a string as input and returns a Tenor object.

func (*Tenor) Set

func (t *Tenor) Set(term string) (*Tenor, error)

The function Set takes a string as input and sets the term of a Tenor object.

func (*Tenor) String

func (t *Tenor) String() string

The function String returns the term of a Tenor object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL