mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
move OrderPriceRiskControl to riskcontrol
This commit is contained in:
parent
5f096bbe0d
commit
8ad85fc365
|
@ -1,9 +1,10 @@
|
||||||
package xfixedmaker
|
package riskcontrol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||||
indicatorv2 "github.com/c9s/bbgo/pkg/indicator/v2"
|
indicatorv2 "github.com/c9s/bbgo/pkg/indicator/v2"
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderPriceRiskControl struct {
|
type OrderPriceRiskControl struct {
|
|
@ -1,4 +1,4 @@
|
||||||
package xfixedmaker
|
package riskcontrol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/bbgo"
|
"github.com/c9s/bbgo/pkg/bbgo"
|
||||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
"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/strategy/common"
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
)
|
)
|
||||||
|
@ -42,7 +43,7 @@ type Strategy struct {
|
||||||
|
|
||||||
market types.Market
|
market types.Market
|
||||||
activeOrderBook *bbgo.ActiveOrderBook
|
activeOrderBook *bbgo.ActiveOrderBook
|
||||||
orderPriceRiskControl *OrderPriceRiskControl
|
orderPriceRiskControl *riskcontrol.OrderPriceRiskControl
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) Defaults() error {
|
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.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),
|
referenceSession.Indicators(s.Symbol).EMA(s.ReferencePriceEMA),
|
||||||
s.OrderPriceLossThreshold,
|
s.OrderPriceLossThreshold,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user