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
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)
return
}
bestBid, hasBid := streambook.BestBid()
bestAsk, hasAsk := streambook.BestAsk()
bestBid, hasBid := book.BestBid()
bestAsk, hasAsk := book.BestAsk()
if hasBid && hasAsk {
log.Infof("================================")
log.Infof("best ask %f % -12f",