calc

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMarginRatioFromAmm

func CalcMarginRatioFromAmm(
	pos perptypes.Position,
	amm perptypes.AMM,
	marketLatestCpf sdk.Dec,
) (marginRatio sdk.Dec, posNot sdk.Dec, err error)

func CalcMarginRatioFromTwap

func CalcMarginRatioFromTwap(
	pos perptypes.Position,
	posNotFromTwap sdk.Dec,
	marketLatestCpf sdk.Dec,
) sdk.Dec

func DirectionMult

func DirectionMult(posSize sdk.Dec) (dirMult sdk.Int)

func PnlForNewMarginRatio

func PnlForNewMarginRatio(
	newMarginRatio sdk.Dec, pos perptypes.Position, amm perptypes.AMM,
	marketLatestCpf sdk.Dec,
) (pnl sdk.Dec, marginRatio sdk.Dec, posNot sdk.Dec, err error)

PnlForNewMarginRatio: PnL required to bring about the new margin ratio

func PriceFromMarginRatio

func PriceFromMarginRatio(
	newMarginRatio sdk.Dec, pos perptypes.Position, amm perptypes.AMM,
	marketLatestCpf sdk.Dec,
) (newPrice, newPosNot, marginRatio sdk.Dec, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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