mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
bbgo: add logging filledOrder option
This commit is contained in:
parent
9fffa4a47f
commit
7a5a027a62
|
@ -92,9 +92,10 @@ type NotificationConfig struct {
|
|||
}
|
||||
|
||||
type LoggingConfig struct {
|
||||
Trade bool `json:"trade,omitempty"`
|
||||
Order bool `json:"order,omitempty"`
|
||||
Fields map[string]interface{} `json:"fields,omitempty"`
|
||||
Trade bool `json:"trade,omitempty"`
|
||||
Order bool `json:"order,omitempty"`
|
||||
FilledOrderOnly bool `json:"filledOrder,omitempty"`
|
||||
Fields map[string]interface{} `json:"fields,omitempty"`
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
|
|
|
@ -282,7 +282,13 @@ func (session *ExchangeSession) Init(ctx context.Context, environ *Environment)
|
|||
})
|
||||
}
|
||||
|
||||
if environ.loggingConfig.Order {
|
||||
if environ.loggingConfig.FilledOrderOnly {
|
||||
session.UserDataStream.OnOrderUpdate(func(order types.Order) {
|
||||
if order.Status == types.OrderStatusFilled {
|
||||
logger.Info(order.String())
|
||||
}
|
||||
})
|
||||
} else if environ.loggingConfig.Order {
|
||||
session.UserDataStream.OnOrderUpdate(func(order types.Order) {
|
||||
logger.Info(order.String())
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user