mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
bollgrid: submit buy/sell orders separately
This commit is contained in:
parent
aa950b3dc4
commit
980f1ae3e7
|
@ -240,20 +240,23 @@ func (s *Strategy) placeGridOrders(orderExecutor bbgo.OrderExecutor, session *bb
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err.Error())
|
log.Warn(err.Error())
|
||||||
}
|
}
|
||||||
|
createdSellOrders, err := orderExecutor.SubmitOrders(context.Background(), sellOrders...)
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).Errorf("can not place sell orders")
|
||||||
|
}
|
||||||
|
|
||||||
buyOrders, err := s.generateGridBuyOrders(session)
|
buyOrders, err := s.generateGridBuyOrders(session)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err.Error())
|
log.Warn(err.Error())
|
||||||
}
|
}
|
||||||
|
createdBuyOrders, err := orderExecutor.SubmitOrders(context.Background(), buyOrders...)
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).Errorf("can not place buy orders")
|
||||||
|
}
|
||||||
|
|
||||||
orders := append(sellOrders, buyOrders...)
|
createdOrders := append(createdSellOrders, createdBuyOrders...)
|
||||||
|
|
||||||
createdOrders, err := orderExecutor.SubmitOrders(context.Background(), orders...)
|
|
||||||
s.activeOrders.Add(createdOrders...)
|
s.activeOrders.Add(createdOrders...)
|
||||||
s.orders.Add(createdOrders...)
|
s.orders.Add(createdOrders...)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.WithError(err).Errorf("can not place orders")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) updateOrders(orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) {
|
func (s *Strategy) updateOrders(orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user