diff --git a/pkg/strategy/xfixedmaker/order_price_risk.go b/pkg/risk/riskcontrol/order_price_risk.go similarity index 94% rename from pkg/strategy/xfixedmaker/order_price_risk.go rename to pkg/risk/riskcontrol/order_price_risk.go index e7ec81b1c..253d62072 100644 --- a/pkg/strategy/xfixedmaker/order_price_risk.go +++ b/pkg/risk/riskcontrol/order_price_risk.go @@ -1,9 +1,10 @@ -package xfixedmaker +package riskcontrol import ( "github.com/c9s/bbgo/pkg/fixedpoint" indicatorv2 "github.com/c9s/bbgo/pkg/indicator/v2" "github.com/c9s/bbgo/pkg/types" + log "github.com/sirupsen/logrus" ) type OrderPriceRiskControl struct { diff --git a/pkg/strategy/xfixedmaker/order_price_risk_test.go b/pkg/risk/riskcontrol/order_price_risk_test.go similarity index 98% rename from pkg/strategy/xfixedmaker/order_price_risk_test.go rename to pkg/risk/riskcontrol/order_price_risk_test.go index da023c733..cfa9422f9 100644 --- a/pkg/strategy/xfixedmaker/order_price_risk_test.go +++ b/pkg/risk/riskcontrol/order_price_risk_test.go @@ -1,4 +1,4 @@ -package xfixedmaker +package riskcontrol import ( "testing" diff --git a/pkg/strategy/xfixedmaker/strategy.go b/pkg/strategy/xfixedmaker/strategy.go index 5a9a9db98..6d9bac2b5 100644 --- a/pkg/strategy/xfixedmaker/strategy.go +++ b/pkg/strategy/xfixedmaker/strategy.go @@ -9,6 +9,7 @@ import ( "github.com/c9s/bbgo/pkg/bbgo" "github.com/c9s/bbgo/pkg/fixedpoint" + "github.com/c9s/bbgo/pkg/risk/riskcontrol" "github.com/c9s/bbgo/pkg/strategy/common" "github.com/c9s/bbgo/pkg/types" ) @@ -42,7 +43,7 @@ type Strategy struct { market types.Market activeOrderBook *bbgo.ActiveOrderBook - orderPriceRiskControl *OrderPriceRiskControl + orderPriceRiskControl *riskcontrol.OrderPriceRiskControl } func (s *Strategy) Defaults() error { @@ -120,7 +121,7 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se s.Strategy.Initialize(ctx, s.Environment, tradingSession, s.market, ID, s.InstanceID()) - s.orderPriceRiskControl = NewOrderPriceRiskControl( + s.orderPriceRiskControl = riskcontrol.NewOrderPriceRiskControl( referenceSession.Indicators(s.Symbol).EMA(s.ReferencePriceEMA), s.OrderPriceLossThreshold, )