mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
common: pull out RiskController
This commit is contained in:
parent
3b6cff8dc7
commit
3293866a6c
|
@ -11,6 +11,16 @@ import (
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type RiskController struct {
|
||||||
|
PositionHardLimit fixedpoint.Value `json:"positionHardLimit"`
|
||||||
|
MaxPositionQuantity fixedpoint.Value `json:"maxPositionQuantity"`
|
||||||
|
CircuitBreakLossThreshold fixedpoint.Value `json:"circuitBreakLossThreshold"`
|
||||||
|
CircuitBreakEMA types.IntervalWindow `json:"circuitBreakEMA"`
|
||||||
|
|
||||||
|
positionRiskControl *riskcontrol.PositionRiskControl
|
||||||
|
circuitBreakRiskControl *riskcontrol.CircuitBreakRiskControl
|
||||||
|
}
|
||||||
|
|
||||||
// Strategy provides the core functionality that is required by a long/short strategy.
|
// Strategy provides the core functionality that is required by a long/short strategy.
|
||||||
type Strategy struct {
|
type Strategy struct {
|
||||||
Position *types.Position `json:"position,omitempty" persistence:"position"`
|
Position *types.Position `json:"position,omitempty" persistence:"position"`
|
||||||
|
@ -23,13 +33,7 @@ type Strategy struct {
|
||||||
Session *bbgo.ExchangeSession
|
Session *bbgo.ExchangeSession
|
||||||
OrderExecutor *bbgo.GeneralOrderExecutor
|
OrderExecutor *bbgo.GeneralOrderExecutor
|
||||||
|
|
||||||
PositionHardLimit fixedpoint.Value `json:"positionHardLimit"`
|
RiskController
|
||||||
MaxPositionQuantity fixedpoint.Value `json:"maxPositionQuantity"`
|
|
||||||
CircuitBreakLossThreshold fixedpoint.Value `json:"circuitBreakLossThreshold"`
|
|
||||||
CircuitBreakEMA types.IntervalWindow `json:"circuitBreakEMA"`
|
|
||||||
|
|
||||||
positionRiskControl *riskcontrol.PositionRiskControl
|
|
||||||
circuitBreakRiskControl *riskcontrol.CircuitBreakRiskControl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) Initialize(ctx context.Context, environ *bbgo.Environment, session *bbgo.ExchangeSession, market types.Market, strategyID, instanceID string) {
|
func (s *Strategy) Initialize(ctx context.Context, environ *bbgo.Environment, session *bbgo.ExchangeSession, market types.Market, strategyID, instanceID string) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user