mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
grid2: pull out debugGridOrders func
This commit is contained in:
parent
b8e5bf1ddd
commit
b0381fd927
|
@ -788,10 +788,18 @@ func (s *Strategy) openGrid(ctx context.Context, session *bbgo.ExchangeSession)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug info
|
s.debugGridOrders(submitOrders, lastPrice)
|
||||||
|
|
||||||
|
for _, order := range createdOrders {
|
||||||
|
s.logger.Info(order.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Strategy) debugGridOrders(submitOrders []types.SubmitOrder, lastPrice fixedpoint.Value) {
|
||||||
s.logger.Infof("GRID ORDERS: [")
|
s.logger.Infof("GRID ORDERS: [")
|
||||||
for i, order := range submitOrders {
|
for i, order := range submitOrders {
|
||||||
|
|
||||||
if i > 0 && lastPrice.Compare(order.Price) >= 0 && lastPrice.Compare(submitOrders[i-1].Price) <= 0 {
|
if i > 0 && lastPrice.Compare(order.Price) >= 0 && lastPrice.Compare(submitOrders[i-1].Price) <= 0 {
|
||||||
s.logger.Infof(" - LAST PRICE: %f", lastPrice.Float64())
|
s.logger.Infof(" - LAST PRICE: %f", lastPrice.Float64())
|
||||||
}
|
}
|
||||||
|
@ -799,12 +807,6 @@ func (s *Strategy) openGrid(ctx context.Context, session *bbgo.ExchangeSession)
|
||||||
s.logger.Info(" - ", order.String())
|
s.logger.Info(" - ", order.String())
|
||||||
}
|
}
|
||||||
s.logger.Infof("] END OF GRID ORDERS")
|
s.logger.Infof("] END OF GRID ORDERS")
|
||||||
|
|
||||||
for _, order := range createdOrders {
|
|
||||||
s.logger.Info(order.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoint.Value) ([]types.SubmitOrder, error) {
|
func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoint.Value) ([]types.SubmitOrder, error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user