Documentation
¶
Index ¶
- func CalculateIndexPrice(baseSpotPrice string) (float64, error)
- func CalculateMarkPrice(basePrice, powerPrice, normalizationFactor string, scaleFactor int) (float64, error)
- func CalculatePremium(markPrice, indexPrice float64) float64
- func CalculateTargetPrice(basePrice, normalizationFactor string, scaleFactor int) (float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateIndexPrice ¶
func CalculateMarkPrice ¶
func CalculateMarkPrice(basePrice, powerPrice, normalizationFactor string, scaleFactor int) (float64, error)
CalculateMarkPrice calculates the mark price based on base price, power price, normalization factor, and scale factor. The function returns the calculated mark price as a float64. It handles the conversion of string inputs to big.Float for precise calculations, especially important for financial computations. If any of the string inputs are invalid or if there's an inexact conversion to float64, the function returns an error.
Parameters: - basePrice: The base asset price as a string. - powerPrice: The power asset price as a string. - normalizationFactor: A string representing the normalization factor to adjust the price. - scaleFactor: An integer representing the scale factor to be applied.
Returns: - The calculated mark price as float64. - An error if there is an issue with input parsing or inexact float conversion.
func CalculatePremium ¶
calculatePremium computes the premium based on markPrice and indexPrice.
Types ¶
This section is empty.