2021-12-27 08:27:05 +00:00
|
|
|
package bbgo
|
|
|
|
|
|
|
|
import "github.com/prometheus/client_golang/prometheus"
|
|
|
|
|
|
|
|
var (
|
|
|
|
metricsConnectionStatus = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Name: "bbgo_connection_status",
|
|
|
|
Help: "bbgo exchange session connection status",
|
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
2021-12-27 17:58:36 +00:00
|
|
|
"channel", // channel: user or market
|
|
|
|
"margin", // margin type: none, margin or isolated
|
2021-12-27 08:27:05 +00:00
|
|
|
"symbol", // margin symbol of the connection.
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2021-12-27 09:16:30 +00:00
|
|
|
metricsLockedBalances = prometheus.NewGaugeVec(
|
2021-12-27 08:27:05 +00:00
|
|
|
prometheus.GaugeOpts{
|
2021-12-27 09:16:30 +00:00
|
|
|
Name: "bbgo_balances_locked",
|
|
|
|
Help: "bbgo exchange locked balances",
|
2021-12-27 08:27:05 +00:00
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
2021-12-27 09:16:30 +00:00
|
|
|
"margin", // margin of connection. 1 or 0
|
|
|
|
"symbol", // margin symbol of the connection.
|
|
|
|
"currency",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
metricsAvailableBalances = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Name: "bbgo_balances_available",
|
|
|
|
Help: "bbgo exchange available balances",
|
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
2021-12-27 09:27:16 +00:00
|
|
|
"margin", // margin of connection. none, margin or isolated
|
2021-12-27 09:16:30 +00:00
|
|
|
"symbol", // margin symbol of the connection.
|
|
|
|
"currency",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
metricsTotalBalances = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Name: "bbgo_balances_total",
|
|
|
|
Help: "bbgo exchange session total balances",
|
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
2021-12-27 09:27:16 +00:00
|
|
|
"margin", // margin of connection. none, margin or isolated
|
2021-12-27 09:16:30 +00:00
|
|
|
"symbol", // margin symbol of the connection.
|
2021-12-27 08:27:05 +00:00
|
|
|
"currency",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
metricsTradesTotal = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "bbgo_trades_total",
|
|
|
|
Help: "bbgo exchange session trades",
|
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
2021-12-27 09:27:16 +00:00
|
|
|
"margin", // margin of connection. none, margin or isolated
|
2021-12-27 08:27:05 +00:00
|
|
|
"symbol", // margin symbol of the connection.
|
|
|
|
"side", // side: buy or sell
|
|
|
|
"liquidity", // maker or taker
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
metricsTradingVolume = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Name: "bbgo_trading_volume",
|
|
|
|
Help: "bbgo trading volume",
|
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
2021-12-27 09:27:16 +00:00
|
|
|
"margin", // margin of connection. none, margin or isolated
|
2021-12-27 08:27:05 +00:00
|
|
|
"symbol", // margin symbol of the connection.
|
|
|
|
"side", // side: buy or sell
|
|
|
|
"liquidity", // maker or taker
|
|
|
|
},
|
|
|
|
)
|
2021-12-27 17:39:17 +00:00
|
|
|
|
|
|
|
metricsLastUpdateTimeBalance = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Name: "bbgo_last_update_time",
|
|
|
|
Help: "bbgo last update time of different channel",
|
|
|
|
},
|
|
|
|
[]string{
|
|
|
|
"exchange", // exchange name
|
|
|
|
"margin", // margin of connection. none, margin or isolated
|
|
|
|
"channel", // channel: user, market
|
|
|
|
"data_type", // type: balance, ticker, kline, orderbook, trade, order
|
|
|
|
"symbol", // for market data, trade and order
|
|
|
|
"currency", // for balance
|
|
|
|
},
|
|
|
|
)
|
2021-12-27 08:27:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
prometheus.MustRegister(
|
|
|
|
metricsConnectionStatus,
|
2021-12-27 09:16:30 +00:00
|
|
|
metricsTotalBalances,
|
|
|
|
metricsLockedBalances,
|
|
|
|
metricsAvailableBalances,
|
2021-12-27 08:27:05 +00:00
|
|
|
metricsTradesTotal,
|
|
|
|
metricsTradingVolume,
|
2021-12-27 17:39:17 +00:00
|
|
|
metricsLastUpdateTimeBalance,
|
2021-12-27 08:27:05 +00:00
|
|
|
)
|
|
|
|
}
|