fix streambook usage

This commit is contained in:
c9s 2021-01-25 14:21:19 +08:00
parent ca71c81284
commit 008b606121

View File

@ -67,13 +67,15 @@ var rootCmd = &cobra.Command{
return return
case <-streambook.C: case <-streambook.C:
if valid, err := streambook.IsValid(); !valid { book := streambook.Get()
if valid, err := book.IsValid(); !valid {
log.Errorf("order book is invalid, error: %v", err) log.Errorf("order book is invalid, error: %v", err)
return return
} }
bestBid, hasBid := streambook.BestBid() bestBid, hasBid := book.BestBid()
bestAsk, hasAsk := streambook.BestAsk() bestAsk, hasAsk := book.BestAsk()
if hasBid && hasAsk { if hasBid && hasAsk {
log.Infof("================================") log.Infof("================================")
log.Infof("best ask %f % -12f", log.Infof("best ask %f % -12f",