Documentation ¶
Overview ¶
Package formula defines the formulas that implements the MarketFormula interface
Index ¶
- Constants
- Variables
- type BalancedReserves
- func (BalancedReserves) FormulaType() int
- func (BalancedReserves) InGivenOut(opts *marketmaking.FormulaOpts, amountOut uint64) (amountIn uint64, err error)
- func (BalancedReserves) OutGivenIn(opts *marketmaking.FormulaOpts, amountIn uint64) (amountOut uint64, err error)
- func (BalancedReserves) SpotPrice(opts *marketmaking.FormulaOpts) (spotPrice decimal.Decimal, err error)
Constants ¶
View Source
const (
BalancedReservesType = 1
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BalancedReserves ¶
type BalancedReserves struct{}
BalancedReserves defines an AMM strategy with fixed 50/50 reserves
func (BalancedReserves) FormulaType ¶
func (BalancedReserves) FormulaType() int
func (BalancedReserves) InGivenOut ¶
func (BalancedReserves) InGivenOut(opts *marketmaking.FormulaOpts, amountOut uint64) (amountIn uint64, err error)
InGivenOut returns the amountIn of assets that will be needed for having the desired amountOut in return
func (BalancedReserves) OutGivenIn ¶
func (BalancedReserves) OutGivenIn(opts *marketmaking.FormulaOpts, amountIn uint64) (amountOut uint64, err error)
OutGivenIn returns the amountOut of asset that will be exchanged for the given amountIn
func (BalancedReserves) SpotPrice ¶
func (BalancedReserves) SpotPrice(opts *marketmaking.FormulaOpts) (spotPrice decimal.Decimal, err error)
SpotPrice calculates the spot price (without fees) given the balances fo the two reserves. The weight reserve ratio is fixed at 50/50
Click to show internal directories.
Click to hide internal directories.