bbgo_origin/pkg/strategy/liquiditymaker/metrics.go

116 lines
2.7 KiB
Go
Raw Normal View History

package liquiditymaker
import "github.com/prometheus/client_golang/prometheus"
2024-10-30 06:45:50 +00:00
var generalLabels = []string{"strategy_type", "strategy_id", "exchange", "symbol"}
var spreadMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_spread",
Help: "",
}, generalLabels)
var tickerBidMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_ticker_bid",
Help: "",
}, generalLabels)
var tickerAskMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_ticker_ask",
Help: "",
}, generalLabels)
var openOrderBidExposureInUsdMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_open_order_bid_exposure_in_usd",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
var openOrderAskExposureInUsdMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_open_order_ask_exposure_in_usd",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var askLiquidityAmountMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_ask_liquidity_amount",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var bidLiquidityAmountMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_bid_liquidity_amount",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var askLiquidityPriceHighMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_ask_liquidity_price_high",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var askLiquidityPriceLowMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_ask_liquidity_price_low",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var bidLiquidityPriceHighMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_bid_liquidity_price_high",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var bidLiquidityPriceLowMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_bid_liquidity_price_low",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var midPriceMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_mid_price",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
var orderPlacementStatusMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_order_placement_status",
Help: "",
}, append(generalLabels, "side"))
2024-10-30 06:29:37 +00:00
var liquidityPriceRangeMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "liqmaker_liquidity_price_range",
Help: "",
2024-10-30 06:45:50 +00:00
}, generalLabels)
2024-10-30 06:29:37 +00:00
func init() {
prometheus.MustRegister(
openOrderBidExposureInUsdMetrics,
openOrderAskExposureInUsdMetrics,
2024-10-30 06:29:37 +00:00
midPriceMetrics,
askLiquidityAmountMetrics,
bidLiquidityAmountMetrics,
liquidityPriceRangeMetrics,
askLiquidityPriceHighMetrics,
askLiquidityPriceLowMetrics,
bidLiquidityPriceHighMetrics,
bidLiquidityPriceLowMetrics,
orderPlacementStatusMetrics,
2024-10-30 06:45:50 +00:00
tickerBidMetrics,
tickerAskMetrics,
spreadMetrics,
)
}