mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
bbgo: bind and update balance metrics updater
This commit is contained in:
parent
7b629c9d30
commit
bb7b33e532
|
@ -36,7 +36,7 @@ var (
|
||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
"exchange", // exchange name
|
"exchange", // exchange name
|
||||||
"margin", // margin of connection. 1 or 0
|
"margin", // margin of connection. none, margin or isolated
|
||||||
"symbol", // margin symbol of the connection.
|
"symbol", // margin symbol of the connection.
|
||||||
"currency",
|
"currency",
|
||||||
},
|
},
|
||||||
|
@ -49,7 +49,7 @@ var (
|
||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
"exchange", // exchange name
|
"exchange", // exchange name
|
||||||
"margin", // margin of connection. 1 or 0
|
"margin", // margin of connection. none, margin or isolated
|
||||||
"symbol", // margin symbol of the connection.
|
"symbol", // margin symbol of the connection.
|
||||||
"currency",
|
"currency",
|
||||||
},
|
},
|
||||||
|
@ -62,8 +62,7 @@ var (
|
||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
"exchange", // exchange name
|
"exchange", // exchange name
|
||||||
"margin", // margin of connection. 1 or 0
|
"margin", // margin of connection. none, margin or isolated
|
||||||
"isolated", // isolated or not
|
|
||||||
"symbol", // margin symbol of the connection.
|
"symbol", // margin symbol of the connection.
|
||||||
"side", // side: buy or sell
|
"side", // side: buy or sell
|
||||||
"liquidity", // maker or taker
|
"liquidity", // maker or taker
|
||||||
|
@ -77,8 +76,7 @@ var (
|
||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
"exchange", // exchange name
|
"exchange", // exchange name
|
||||||
"margin", // margin of connection. 1 or 0
|
"margin", // margin of connection. none, margin or isolated
|
||||||
"isolated", // isolated or not
|
|
||||||
"symbol", // margin symbol of the connection.
|
"symbol", // margin symbol of the connection.
|
||||||
"side", // side: buy or sell
|
"side", // side: buy or sell
|
||||||
"liquidity", // maker or taker
|
"liquidity", // maker or taker
|
||||||
|
|
|
@ -323,6 +323,7 @@ func (session *ExchangeSession) Init(ctx context.Context, environ *Environment)
|
||||||
session.UserDataStream.OnOrderUpdate(session.OrderExecutor.EmitOrderUpdate)
|
session.UserDataStream.OnOrderUpdate(session.OrderExecutor.EmitOrderUpdate)
|
||||||
session.Account.BindStream(session.UserDataStream)
|
session.Account.BindStream(session.UserDataStream)
|
||||||
|
|
||||||
|
session.metricsBalancesUpdater(balances)
|
||||||
session.bindUserDataStreamMetrics(session.UserDataStream)
|
session.bindUserDataStreamMetrics(session.UserDataStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,5 +816,6 @@ func (session *ExchangeSession) metricsTradeUpdater(trade types.Trade) {
|
||||||
|
|
||||||
func (session *ExchangeSession) bindUserDataStreamMetrics(stream types.Stream) {
|
func (session *ExchangeSession) bindUserDataStreamMetrics(stream types.Stream) {
|
||||||
stream.OnBalanceUpdate(session.metricsBalancesUpdater)
|
stream.OnBalanceUpdate(session.metricsBalancesUpdater)
|
||||||
|
stream.OnBalanceSnapshot(session.metricsBalancesUpdater)
|
||||||
stream.OnTradeUpdate(session.metricsTradeUpdater)
|
stream.OnTradeUpdate(session.metricsTradeUpdater)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user