mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
bbgo: bind and update balance metrics updater
This commit is contained in:
parent
7b629c9d30
commit
bb7b33e532
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user