mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix notification arguments
This commit is contained in:
parent
236df245a2
commit
638cc40516
|
@ -31,27 +31,27 @@ func (n *Notifier) Notify(obj interface{}, args ...interface{}) {
|
|||
}
|
||||
|
||||
func filterPlaintextMessages(args []interface{}) (texts []string, pureArgs []interface{}) {
|
||||
var textArgsOffset = -1
|
||||
var firstObjectOffset = -1
|
||||
for idx, arg := range args {
|
||||
switch a := arg.(type) {
|
||||
|
||||
case types.PlainText:
|
||||
texts = append(texts, a.PlainText())
|
||||
if textArgsOffset == -1 {
|
||||
textArgsOffset = idx
|
||||
if firstObjectOffset == -1 {
|
||||
firstObjectOffset = idx
|
||||
}
|
||||
|
||||
case types.Stringer:
|
||||
texts = append(texts, a.String())
|
||||
if textArgsOffset == -1 {
|
||||
textArgsOffset = idx
|
||||
if firstObjectOffset == -1 {
|
||||
firstObjectOffset = idx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pureArgs = args
|
||||
if textArgsOffset > -1 {
|
||||
pureArgs = args[:textArgsOffset]
|
||||
if firstObjectOffset > -1 {
|
||||
pureArgs = args[:firstObjectOffset]
|
||||
}
|
||||
|
||||
return texts, pureArgs
|
||||
|
|
|
@ -432,7 +432,7 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
|
|||
|
||||
}
|
||||
|
||||
s.Notifiability.Notify("Submitting hedge order: %s %s %f", s.Symbol, side, quantity.Float64())
|
||||
s.Notifiability.Notify("Submitting hedge order: %s %s %f", s.Symbol, side.String(), quantity.Float64())
|
||||
orderExecutor := &bbgo.ExchangeOrderExecutor{Session: s.sourceSession}
|
||||
returnOrders, err := orderExecutor.SubmitOrders(ctx, types.SubmitOrder{
|
||||
Symbol: s.Symbol,
|
||||
|
|
Loading…
Reference in New Issue
Block a user