bbgo: bind and update balance metrics updater

This commit is contained in:
c9s 2021-12-27 17:27:16 +08:00
parent 7b629c9d30
commit bb7b33e532
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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)
}