mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
xdepthmaker: improve HedgeMaxOrderQuantity check
This commit is contained in:
parent
42cd3cba1e
commit
f4e905833c
|
@ -604,7 +604,7 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) error {
|
|||
|
||||
quantity := pos.Abs()
|
||||
|
||||
if s.HedgeMaxOrderQuantity.Sign() > 0 {
|
||||
if s.HedgeMaxOrderQuantity.Sign() > 0 && quantity.Compare(s.HedgeMaxOrderQuantity) > 0 {
|
||||
s.logger.Infof("hedgeMaxOrderQuantity is set to %s, limiting the given quantity %s", s.HedgeMaxOrderQuantity.String(), quantity.String())
|
||||
quantity = fixedpoint.Min(s.HedgeMaxOrderQuantity, quantity)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user