show bid/ask volume in the message

This commit is contained in:
c9s 2021-05-19 00:41:34 +08:00
parent 7f86c75360
commit 2fddc9166f
3 changed files with 7 additions and 18 deletions

View File

@ -141,9 +141,6 @@ func Execute() {
return
}
log.SetFormatter(&prefixed.TextFormatter{})
logger := log.StandardLogger()

View File

@ -121,7 +121,7 @@ func (f *DepthFrame) PushEvent(e DepthEvent) {
} else {
// 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 debugBinanceDepth {
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
}
// 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 debugBinanceDepth {
log.Warnf("event first update id %d > final update id + 1 (%d), resetting snapshot", e.FirstUpdateID, f.SnapshotDepth.FirstUpdateID+1)

View File

@ -11,9 +11,8 @@ import (
"time"
"github.com/adshao/go-binance/v2"
"github.com/gorilla/websocket"
"github.com/c9s/bbgo/pkg/fixedpoint"
"github.com/gorilla/websocket"
"github.com/c9s/bbgo/pkg/types"
)
@ -24,16 +23,9 @@ func init() {
// randomize pulling
rand.Seed(time.Now().UnixNano())
if s := os.Getenv("BINANCE_DEBUG_DEPTH"); len(s) > 0 {
v, err := strconv.ParseBool(s)
if err != nil {
log.Error(err)
} else {
debugBinanceDepth = v
if debugBinanceDepth {
log.Info("binance depth debugging is enabled")
}
}
debugBinanceDepth, _ = strconv.ParseBool(os.Getenv("DEBUG_BINANCE_DEPTH"))
if debugBinanceDepth {
log.Info("binance depth debugging is enabled")
}
}
@ -177,7 +169,7 @@ func NewStream(client *binance.Client) *Stream {
}
// Update Order with FILLED event
if (order.Status == types.OrderStatusFilled) {
if order.Status == types.OrderStatusFilled {
stream.EmitOrderUpdate(*order)
}
}