From 008b60612135c55ecdf4a3ad44ba500121a49d54 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 25 Jan 2021 14:21:19 +0800 Subject: [PATCH] fix streambook usage --- examples/binance-book/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/binance-book/main.go b/examples/binance-book/main.go index 4e40e1e65..570bb8aa2 100644 --- a/examples/binance-book/main.go +++ b/examples/binance-book/main.go @@ -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",