Documentation ¶
Index ¶
- type CircuitBreakRiskControl
- type PositionRiskControl
- func (p *PositionRiskControl) EmitReleasePosition(quantity fixedpoint.Value, side types.SideType)
- func (p *PositionRiskControl) ModifiedQuantity(position fixedpoint.Value) (buyQuantity, sellQuantity fixedpoint.Value)
- func (p *PositionRiskControl) OnReleasePosition(cb func(quantity fixedpoint.Value, side types.SideType))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CircuitBreakRiskControl ¶
type CircuitBreakRiskControl struct {
// contains filtered or unexported fields
}
func NewCircuitBreakRiskControl ¶
func NewCircuitBreakRiskControl( position *types.Position, price *indicator.EWMAStream, lossThreshold fixedpoint.Value, profitStats *types.ProfitStats) *CircuitBreakRiskControl
func (*CircuitBreakRiskControl) IsHalted ¶
func (c *CircuitBreakRiskControl) IsHalted() bool
IsHalted returns whether we reached the circuit break condition set for this day?
type PositionRiskControl ¶
type PositionRiskControl struct {
// contains filtered or unexported fields
}
func NewPositionRiskControl ¶
func NewPositionRiskControl(hardLimit, quantity fixedpoint.Value, tradeCollector *bbgo.TradeCollector) *PositionRiskControl
func (*PositionRiskControl) EmitReleasePosition ¶
func (p *PositionRiskControl) EmitReleasePosition(quantity fixedpoint.Value, side types.SideType)
func (*PositionRiskControl) ModifiedQuantity ¶
func (p *PositionRiskControl) ModifiedQuantity(position fixedpoint.Value) (buyQuantity, sellQuantity fixedpoint.Value)
ModifiedQuantity returns quantity controlled by position risks For buy orders, mod quantity = min(hardLimit - position, quantity), limiting by positive position For sell orders, mod quantity = min(hardLimit - (-position), quantity), limiting by negative position
func (*PositionRiskControl) OnReleasePosition ¶
func (p *PositionRiskControl) OnReleasePosition(cb func(quantity fixedpoint.Value, side types.SideType))
Click to show internal directories.
Click to hide internal directories.