maths

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateIndexPrice

func CalculateIndexPrice(baseSpotPrice string) (float64, error)

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

func CalculatePremium(markPrice, indexPrice float64) float64

calculatePremium computes the premium based on markPrice and indexPrice.

func CalculateTargetPrice

func CalculateTargetPrice(basePrice, normalizationFactor string, scaleFactor int) (float64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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