decred.org/dcrdex@v1.0.5/dex/calc/parcels.go (about) 1 // This code is available on the terms of the project LICENSE.md file, 2 // also available online at https://blueoakcouncil.org/license/1.0.0. 3 4 package calc 5 6 import "math" 7 8 // Parcels calculates the number of parcels associated with the given order 9 // quantities, lot size and parcel size. Any quantity currently settling 10 // should be summed in with the makerQty. 11 func Parcels(makerQty, takerQty, lotSize uint64, parcelSize uint32) float64 { 12 parcelWeight := makerQty + takerQty*2 13 parcelQty := lotSize * uint64(parcelSize) 14 return float64(parcelWeight) / float64(parcelQty) 15 } 16 17 func MinimumMarketRate(baseLotSize, quoteDust uint64) uint64 { 18 return uint64(math.Ceil(float64(quoteDust) * RateEncodingFactor / float64(baseLotSize))) 19 }