diff --git a/pkg/bbgo/metrics.go b/pkg/bbgo/metrics.go index 505218e0e..f543e6eb1 100644 --- a/pkg/bbgo/metrics.go +++ b/pkg/bbgo/metrics.go @@ -36,7 +36,7 @@ var ( }, []string{ "exchange", // exchange name - "margin", // margin of connection. 1 or 0 + "margin", // margin of connection. none, margin or isolated "symbol", // margin symbol of the connection. "currency", }, @@ -49,7 +49,7 @@ var ( }, []string{ "exchange", // exchange name - "margin", // margin of connection. 1 or 0 + "margin", // margin of connection. none, margin or isolated "symbol", // margin symbol of the connection. "currency", }, @@ -62,8 +62,7 @@ var ( }, []string{ "exchange", // exchange name - "margin", // margin of connection. 1 or 0 - "isolated", // isolated or not + "margin", // margin of connection. none, margin or isolated "symbol", // margin symbol of the connection. "side", // side: buy or sell "liquidity", // maker or taker @@ -77,8 +76,7 @@ var ( }, []string{ "exchange", // exchange name - "margin", // margin of connection. 1 or 0 - "isolated", // isolated or not + "margin", // margin of connection. none, margin or isolated "symbol", // margin symbol of the connection. "side", // side: buy or sell "liquidity", // maker or taker diff --git a/pkg/bbgo/session.go b/pkg/bbgo/session.go index 8b9ba166b..5546dd7ac 100644 --- a/pkg/bbgo/session.go +++ b/pkg/bbgo/session.go @@ -323,6 +323,7 @@ func (session *ExchangeSession) Init(ctx context.Context, environ *Environment) session.UserDataStream.OnOrderUpdate(session.OrderExecutor.EmitOrderUpdate) session.Account.BindStream(session.UserDataStream) + session.metricsBalancesUpdater(balances) session.bindUserDataStreamMetrics(session.UserDataStream) } @@ -815,5 +816,6 @@ func (session *ExchangeSession) metricsTradeUpdater(trade types.Trade) { func (session *ExchangeSession) bindUserDataStreamMetrics(stream types.Stream) { stream.OnBalanceUpdate(session.metricsBalancesUpdater) + stream.OnBalanceSnapshot(session.metricsBalancesUpdater) stream.OnTradeUpdate(session.metricsTradeUpdater) }