Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormulaOpts ¶
type FormulaOpts 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 }
FormulaOpts defines the parameters needed to calculate the spot price
type MakingFormula ¶
type MakingFormula interface { SpotPrice(spotPriceOpts *FormulaOpts) (spotPrice decimal.Decimal, err error) OutGivenIn(outGivenInOpts *FormulaOpts, amountIn uint64) (amountOut uint64, err error) InGivenOut(inGivenOutOpts *FormulaOpts, amountOut uint64) (amountIn uint64, err error) FormulaType() int }
MakingFormula defines the interface for implementing the formula to derive the spot price
type MakingStrategy ¶
type MakingStrategy struct { Type int // contains filtered or unexported fields }
MakingStrategy defines the automated market making strategy, usingi a formula to be applied to calculate the price of next trade.
func NewStrategyFromFormula ¶
func NewStrategyFromFormula( formula MakingFormula, ) MakingStrategy
NewStrategyFromFormula returns the strategy struct with the name
func (MakingStrategy) Formula ¶
func (ms MakingStrategy) Formula() MakingFormula
Formula returns the mathematical formula of the MM strategy
func (MakingStrategy) IsZero ¶
func (ms MakingStrategy) IsZero() bool
IsZero checks if the given strategy is the zero value
Click to show internal directories.
Click to hide internal directories.