Documentation ¶
Index ¶
- Constants
- func BaseToQuote(rate uint64, base uint64) (quote uint64)
- func ConventionalRate(msgRate uint64, baseInfo, quoteInfo dex.UnitInfo) float64
- func ConventionalRateAlt(msgRate uint64, baseFactor, quoteFactor uint64) float64
- func MessageRate(conventionalRate float64, baseInfo, quoteInfo dex.UnitInfo) uint64
- func MessageRateAlt(conventionalRate float64, baseFactor, quoteFactor uint64) uint64
- func MinimumMarketRate(baseLotSize, quoteDust uint64) uint64
- func Parcels(makerQty, takerQty, lotSize uint64, parcelSize uint32) float64
- func QuoteToBase(rate uint64, quote uint64) (base uint64)
- func RequiredOrderFunds(swapVal, inputsSize, maxSwaps, swapSizeBase, swapSize, feeRate uint64) uint64
Constants ¶
const RateEncodingFactor = 1e8
RateEncodingFactor is used when encoding an exchange rate as an integer. https://github.com/decred/dcrdex/blob/master/spec/comm.mediawiki#Rate_Encoding
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 ConventionalRate ¶ added in v0.4.0
ConventionalRate converts an exchange rate in message-rate encoding to a conventional exchange rate, using the base and quote assets' UnitInfo.
func ConventionalRateAlt ¶ added in v0.4.0
ConventionalRateAlt converts an exchange rate in message-rate encoding to a conventional exchange rate using the base and quote assets' conventional conversion factors.
func MessageRate ¶ added in v1.0.0
MessageRate converts an exchange rate in conventional encoding to one in message-rate encoding using the base and quote assets' UnitInfo.
func MessageRateAlt ¶ added in v1.0.0
MessageRateAlt converts an exchange rate in conventional encoding to one in message-rate encoding using the base and quote assets' conventional conversion factors.
func MinimumMarketRate ¶ added in v1.0.0
func Parcels ¶ added in v1.0.0
Parcels calculates the number of parcels associated with the given order quantities, lot size and parcel size. Any quantity currently settling should be summed in with the makerQty.
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 ¶
func RequiredOrderFunds(swapVal, inputsSize, maxSwaps, swapSizeBase, swapSize, feeRate uint64) uint64
RequiredOrderFunds calculates the funds required for an order.
Types ¶
This section is empty.