mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
Merge pull request #1809 from c9s/chiahung/xalign/check-large-amount-alert-exist
FIX: [xalign] verify LargetAmountAlert is not nil
This commit is contained in:
commit
24e33fcdfd
|
@ -593,27 +593,29 @@ func (s *Strategy) align(ctx context.Context, sessions map[string]*bbgo.Exchange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price, ok := s.priceResolver.ResolvePrice(currency, s.LargeAmountAlert.QuoteCurrency); ok {
|
if s.LargeAmountAlert != nil {
|
||||||
quantity := q.Abs()
|
if price, ok := s.priceResolver.ResolvePrice(currency, s.LargeAmountAlert.QuoteCurrency); ok {
|
||||||
amount := price.Mul(quantity)
|
quantity := q.Abs()
|
||||||
if amount.Compare(s.LargeAmountAlert.Amount) > 0 {
|
amount := price.Mul(quantity)
|
||||||
alert := &LargeAmountAlert{
|
if amount.Compare(s.LargeAmountAlert.Amount) > 0 {
|
||||||
QuoteCurrency: s.LargeAmountAlert.QuoteCurrency,
|
alert := &LargeAmountAlert{
|
||||||
AlertAmount: s.LargeAmountAlert.Amount,
|
QuoteCurrency: s.LargeAmountAlert.QuoteCurrency,
|
||||||
SlackMentions: s.LargeAmountAlert.SlackMentions,
|
AlertAmount: s.LargeAmountAlert.Amount,
|
||||||
BaseCurrency: currency,
|
SlackMentions: s.LargeAmountAlert.SlackMentions,
|
||||||
Price: price,
|
BaseCurrency: currency,
|
||||||
Quantity: quantity,
|
Price: price,
|
||||||
Amount: amount,
|
Quantity: quantity,
|
||||||
}
|
Amount: amount,
|
||||||
|
}
|
||||||
|
|
||||||
if q.Sign() > 0 {
|
if q.Sign() > 0 {
|
||||||
alert.Side = types.SideTypeBuy
|
alert.Side = types.SideTypeBuy
|
||||||
} else {
|
} else {
|
||||||
alert.Side = types.SideTypeSell
|
alert.Side = types.SideTypeSell
|
||||||
}
|
}
|
||||||
|
|
||||||
bbgo.Notify(alert)
|
bbgo.Notify(alert)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user