mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
show bid/ask volume in the message
This commit is contained in:
parent
7f86c75360
commit
2fddc9166f
|
@ -141,9 +141,6 @@ func Execute() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.SetFormatter(&prefixed.TextFormatter{})
|
log.SetFormatter(&prefixed.TextFormatter{})
|
||||||
|
|
||||||
logger := log.StandardLogger()
|
logger := log.StandardLogger()
|
||||||
|
|
|
@ -121,7 +121,7 @@ func (f *DepthFrame) PushEvent(e DepthEvent) {
|
||||||
} else {
|
} else {
|
||||||
// if we have the snapshot, we could use that final update ID filter the events
|
// if we have the snapshot, we could use that final update ID filter the events
|
||||||
|
|
||||||
// drop any update ID < the final update ID
|
// too old: drop any update ID < the final update ID
|
||||||
if e.FinalUpdateID < f.SnapshotDepth.FinalUpdateID {
|
if e.FinalUpdateID < f.SnapshotDepth.FinalUpdateID {
|
||||||
if debugBinanceDepth {
|
if debugBinanceDepth {
|
||||||
log.Warnf("event final update id %d < depth final update id %d, skip", e.FinalUpdateID, f.SnapshotDepth.FinalUpdateID)
|
log.Warnf("event final update id %d < depth final update id %d, skip", e.FinalUpdateID, f.SnapshotDepth.FinalUpdateID)
|
||||||
|
@ -131,7 +131,7 @@ func (f *DepthFrame) PushEvent(e DepthEvent) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the first update ID > final update ID + 1, it means something is missing, we need to reload.
|
// too new: if the first update ID > final update ID + 1, it means something is missing, we need to reload.
|
||||||
if e.FirstUpdateID > f.SnapshotDepth.FinalUpdateID+1 {
|
if e.FirstUpdateID > f.SnapshotDepth.FinalUpdateID+1 {
|
||||||
if debugBinanceDepth {
|
if debugBinanceDepth {
|
||||||
log.Warnf("event first update id %d > final update id + 1 (%d), resetting snapshot", e.FirstUpdateID, f.SnapshotDepth.FirstUpdateID+1)
|
log.Warnf("event first update id %d > final update id + 1 (%d), resetting snapshot", e.FirstUpdateID, f.SnapshotDepth.FirstUpdateID+1)
|
||||||
|
|
|
@ -11,9 +11,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/adshao/go-binance/v2"
|
"github.com/adshao/go-binance/v2"
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
)
|
)
|
||||||
|
@ -24,16 +23,9 @@ func init() {
|
||||||
// randomize pulling
|
// randomize pulling
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
|
||||||
if s := os.Getenv("BINANCE_DEBUG_DEPTH"); len(s) > 0 {
|
debugBinanceDepth, _ = strconv.ParseBool(os.Getenv("DEBUG_BINANCE_DEPTH"))
|
||||||
v, err := strconv.ParseBool(s)
|
if debugBinanceDepth {
|
||||||
if err != nil {
|
log.Info("binance depth debugging is enabled")
|
||||||
log.Error(err)
|
|
||||||
} else {
|
|
||||||
debugBinanceDepth = v
|
|
||||||
if debugBinanceDepth {
|
|
||||||
log.Info("binance depth debugging is enabled")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +169,7 @@ func NewStream(client *binance.Client) *Stream {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Order with FILLED event
|
// Update Order with FILLED event
|
||||||
if (order.Status == types.OrderStatusFilled) {
|
if order.Status == types.OrderStatusFilled {
|
||||||
stream.EmitOrderUpdate(*order)
|
stream.EmitOrderUpdate(*order)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user