Documentation ¶
Index ¶
- func BaseToQuote(rate uint64, base uint64) (quote uint64)
- func QuoteToBase(rate uint64, quote uint64) (base uint64)
- func RequiredOrderFunds(swapVal, inputsSize, maxSwaps uint64, nfo *dex.Asset) uint64
- func RequiredOrderFundsAlt(swapVal, inputsSize, maxSwaps uint64, swapSizeBase, swapSize, feeRate uint64) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseToQuote ¶
BaseToQuote computes a quote asset amount based on a base asset amount and an integer representation of the price rate. That is,
quoteAmt = rate * baseAmt / atomsPerCoin
func QuoteToBase ¶
QuoteToBase computes a base asset amount based on a quote asset amount and an integer representation of the price rate. That is,
baseAmt = quoteAmt * atomsPerCoin / rate
func RequiredOrderFunds ¶
RequiredOrderFunds calculates the required amount needed to fulfill the swap amount and pay transaction fees. swapVal is the total quantity needed to fulfill an order. inputsSize is the size of the serialized inputs associated with a set of UTXOs to be spent in the *first* swap txn. maxSwaps is the number of lots in the order. For the quote asset, maxSwaps is not swapVal / nfo.LotSize, so it must be a separate parameter. The chained swap txns will be the standard size as they will spend a previous swap's change output.
func RequiredOrderFundsAlt ¶ added in v0.2.0
func RequiredOrderFundsAlt(swapVal, inputsSize, maxSwaps uint64, swapSizeBase, swapSize, feeRate uint64) uint64
RequiredOrderFundsAlt is the same as RequiredOrderFunds, but built-in type parameters.
Types ¶
This section is empty.