mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +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: "",
|
Help: "",
|
||||||
}, []string{"strategy_type", "strategy_id", "symbol"})
|
}, []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() {
|
func init() {
|
||||||
prometheus.MustRegister(
|
prometheus.MustRegister(
|
||||||
openOrderBidExposureInUsdMetrics,
|
openOrderBidExposureInUsdMetrics,
|
||||||
|
@ -46,5 +58,7 @@ func init() {
|
||||||
makerBestAskPriceMetrics,
|
makerBestAskPriceMetrics,
|
||||||
configNumOfLayersMetrics,
|
configNumOfLayersMetrics,
|
||||||
configMaxExposureMetrics,
|
configMaxExposureMetrics,
|
||||||
|
configBidMarginMetrics,
|
||||||
|
configAskMarginMetrics,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -894,6 +894,8 @@ func (s *Strategy) CrossRun(
|
||||||
configLabels := prometheus.Labels{"strategy_id": s.InstanceID(), "strategy_type": ID, "symbol": s.Symbol}
|
configLabels := prometheus.Labels{"strategy_id": s.InstanceID(), "strategy_type": ID, "symbol": s.Symbol}
|
||||||
configNumOfLayersMetrics.With(configLabels).Set(float64(s.NumLayers))
|
configNumOfLayersMetrics.With(configLabels).Set(float64(s.NumLayers))
|
||||||
configMaxExposureMetrics.With(configLabels).Set(s.MaxExposurePosition.Float64())
|
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 {
|
if s.Position == nil {
|
||||||
s.Position = types.NewPositionFromMarket(s.makerMarket)
|
s.Position = types.NewPositionFromMarket(s.makerMarket)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user