Skip to content

Commit

Permalink
add AdjustQuantityByMinQuantity to types.Market
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Mar 18, 2024
1 parent 3f44092 commit 97c48e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/types/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ func (m Market) CanonicalizeVolume(val fixedpoint.Value) float64 {
return math.Trunc(p*val.Float64()) / p
}

func (m Market) AdjustQuantityByMinQuantity(quantity fixedpoint.Value) fixedpoint.Value {
return fixedpoint.Max(quantity, m.MinQuantity)
}

// AdjustQuantityByMinNotional adjusts the quantity to make the amount greater than the given minAmount
func (m Market) AdjustQuantityByMinNotional(quantity, currentPrice fixedpoint.Value) fixedpoint.Value {
// modify quantity for the min amount
Expand Down

0 comments on commit 97c48e5

Please sign in to comment.