mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
grid: improve error messages
This commit is contained in:
parent
ee68deb114
commit
a94c42d9c2
|
@ -132,12 +132,12 @@ func (s *Strategy) Validate() error {
|
||||||
func (s *Strategy) generateGridSellOrders(session *bbgo.ExchangeSession) ([]types.SubmitOrder, error) {
|
func (s *Strategy) generateGridSellOrders(session *bbgo.ExchangeSession) ([]types.SubmitOrder, error) {
|
||||||
currentPriceFloat, ok := session.LastPrice(s.Symbol)
|
currentPriceFloat, ok := session.LastPrice(s.Symbol)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("%s last price not found, skipping", s.Symbol)
|
return nil, fmt.Errorf("can not generate sell orders, %s last price not found", s.Symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPrice := fixedpoint.NewFromFloat(currentPriceFloat)
|
currentPrice := fixedpoint.NewFromFloat(currentPriceFloat)
|
||||||
if currentPrice > s.UpperPrice {
|
if currentPrice > s.UpperPrice {
|
||||||
return nil, fmt.Errorf("current price %f is higher than upper price %f", currentPrice.Float64(), s.UpperPrice.Float64())
|
return nil, fmt.Errorf("can not generate sell orders, the current price %f is higher than upper price %f", currentPrice.Float64(), s.UpperPrice.Float64())
|
||||||
}
|
}
|
||||||
|
|
||||||
priceRange := s.UpperPrice - s.LowerPrice
|
priceRange := s.UpperPrice - s.LowerPrice
|
||||||
|
|
Loading…
Reference in New Issue
Block a user