-
-
Notifications
You must be signed in to change notification settings - Fork 345
FEAT: [metrics] add prometheus metrics on maker market for xdepthmaker #1948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
208ab7f
to
8384e8a
Compare
@@ -44,6 +44,9 @@ var makerBestAskPriceMetrics = prometheus.NewGaugeVec( | |||
}, []string{"strategy_type", "strategy_id", "exchange", "symbol"}) | |||
|
|||
func UpdateMakerOpenOrderMetrics(strategyType, strategyId, exchangeName, symbol string, submitOrders []types.SubmitOrder) { | |||
if len(submitOrders) == 0 { | |||
return | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when submitOrders = 0, we should reset metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add this as an extra protection.
There is an early return at line 1212 in strategy.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we do not reset metrics before, I don't feel like we need to reset metrics here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
Working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pkg/strategy/xdepthmaker/metrics.go
Outdated
|
||
var openOrdersCountMetrics = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "bbgo_xdepthmaker_market_open_order_count", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be just "bbgo_xdepthmaker_open_order_count"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
pkg/strategy/xdepthmaker/metrics.go
Outdated
|
||
var openOrderExposureInUsdtMetrics = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "bbgo_xdepthmaker_inrange_open_order_exposure_in_usdt", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call it liquidity ?
bbgo_xdepthmaker_liquidity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rename it into bbgo_xdepthmaker_depth_in_usd
.
It feels like a proper naming to me.
pkg/strategy/xdepthmaker/strategy.go
Outdated
}) | ||
s.makerBook = types.NewStreamBook(s.Symbol, s.makerSession.ExchangeName) | ||
s.makerBook.BindStream(makerMarketStream) | ||
s.makerBook.OnUpdate(func(_ types.SliceOrderBook) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pull this closure out to a method of "Strategy"
something like: s.makerBook.OnUpdate(s.handleMakerBookUpdate)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…ate handler function
…lated metrics for clarity. Handle metric updates with 0 submit orders.
No description provided.