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 interface{}, amountOut uint64) (uint64, error)
- func (BalancedReserves) OutGivenIn(_opts interface{}, amountIn uint64) (uint64, error)
- func (BalancedReserves) SpotPrice(_opts interface{}) (spotPrice decimal.Decimal, err error)
- type BalancedReservesOpts
Constants ¶
View Source
const (
BalancedReservesType = 1
)
Variables ¶
View Source
var ( // ErrInvalidOptsType ... ErrInvalidOptsType = errors.New("opts must be of type BalancedReservesOpts") // ErrAmountTooLow ... ErrAmountTooLow = errors.New("provided amount is too low") // ErrAmountTooBig ... ErrAmountTooBig = errors.New("provided amount is too big") // ErrBalanceTooLow ... ErrBalanceTooLow = errors.New("reserve balance amount is too low") )
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 interface{}, amountOut uint64) (uint64, 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 interface{}, amountIn uint64) (uint64, error)
OutGivenIn returns the amountOut of asset that will be exchanged for the given amountIn.
type BalancedReservesOpts ¶ added in v0.4.4
type BalancedReservesOpts struct { BalanceIn uint64 BalanceOut uint64 WeightIn uint64 WeightOut uint64 // The fee should be in satoshis and represents the calculated fee to take out from the swap. Fee uint64 // Defines if the fee should be charged on the way in (ie. on ) ChargeFeeOnTheWayIn bool }
BalancedReservesOpts defines the parameters needed to calculate the spot price
Click to show internal directories.
Click to hide internal directories.