mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
xmaker: add config bid/ask margin metrics
This commit is contained in:
parent
7e65aca62e
commit
b3c8739983
|
@ -38,6 +38,18 @@ var configMaxExposureMetrics = prometheus.NewGaugeVec(
|
|||
Help: "",
|
||||
}, []string{"strategy_type", "strategy_id", "symbol"})
|
||||
|
||||
var configBidMarginMetrics = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "xmaker_config_bid_margin",
|
||||
Help: "",
|
||||
}, []string{"strategy_type", "strategy_id", "symbol"})
|
||||
|
||||
var configAskMarginMetrics = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "xmaker_config_ask_margin",
|
||||
Help: "",
|
||||
}, []string{"strategy_type", "strategy_id", "symbol"})
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(
|
||||
openOrderBidExposureInUsdMetrics,
|
||||
|
@ -46,5 +58,7 @@ func init() {
|
|||
makerBestAskPriceMetrics,
|
||||
configNumOfLayersMetrics,
|
||||
configMaxExposureMetrics,
|
||||
configBidMarginMetrics,
|
||||
configAskMarginMetrics,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -894,6 +894,8 @@ func (s *Strategy) CrossRun(
|
|||
configLabels := prometheus.Labels{"strategy_id": s.InstanceID(), "strategy_type": ID, "symbol": s.Symbol}
|
||||
configNumOfLayersMetrics.With(configLabels).Set(float64(s.NumLayers))
|
||||
configMaxExposureMetrics.With(configLabels).Set(s.MaxExposurePosition.Float64())
|
||||
configBidMarginMetrics.With(configLabels).Set(s.BidMargin.Float64())
|
||||
configAskMarginMetrics.With(configLabels).Set(s.AskMargin.Float64())
|
||||
|
||||
if s.Position == nil {
|
||||
s.Position = types.NewPositionFromMarket(s.makerMarket)
|
||||
|
|
Loading…
Reference in New Issue
Block a user