Documentation
¶
Index ¶
- Variables
- func OrderDeniedEvent(order model.SubmitOrder, cause error) (model.ExecutionEvent, bool)
- type Config
- type Decision
- type Engine
- func (e *Engine) Check(order model.SubmitOrder) error
- func (e *Engine) CheckExistingOrder(order model.SubmitOrder) error
- func (e *Engine) EngageKillSwitch(reason string) error
- func (e *Engine) Execute(ctx context.Context, order model.SubmitOrder) (<-chan Decision, error)
- func (e *Engine) Health() Health
- func (e *Engine) Process(ctx context.Context, event model.ExecutionEvent) error
- func (e *Engine) ResumeTrading() error
- func (e *Engine) SetReducingOnly(reason string) error
- func (e *Engine) SetTradingState(state TradingState, reason string) error
- func (e *Engine) Start(ctx context.Context) error
- func (e *Engine) Stop(ctx context.Context) error
- type Health
- type Limits
- type TradingState
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRiskQueueFull = errors.New("risk queue full")
View Source
var ErrRiskRejected = errors.New("risk rejected")
Functions ¶
func OrderDeniedEvent ¶
func OrderDeniedEvent(order model.SubmitOrder, cause error) (model.ExecutionEvent, bool)
Types ¶
type Config ¶
type Config struct {
MaxOrderNotional decimal.Decimal
MaxPositionNotional decimal.Decimal
MaxAccountExposure decimal.Decimal
ExposureCurrency model.Currency
TradingState TradingState
QueueSize int
Clock kernel.Clock
MaxCommandsPerWindow int
CommandRateWindow time.Duration
MaxOpenOrders int
AccountLimits map[model.AccountID]Limits
StrategyLimits map[model.StrategyID]Limits
InstrumentLimits map[model.InstrumentID]Limits
}
type Decision ¶
type Decision struct {
Order model.SubmitOrder
Error error
Event *model.ExecutionEvent
}
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) CheckExistingOrder ¶
func (e *Engine) CheckExistingOrder(order model.SubmitOrder) error
func (*Engine) EngageKillSwitch ¶
func (*Engine) ResumeTrading ¶
func (*Engine) SetReducingOnly ¶
func (*Engine) SetTradingState ¶
func (e *Engine) SetTradingState(state TradingState, reason string) error
type Health ¶
type Health struct {
kernel.Health
CommandQueueDepth int
EventQueueDepth int
CommandQueueCapacity int
EventQueueCapacity int
TradingState TradingState
TradingStateReason string
ProcessedCommands int64
RejectedCommands int64
ProcessedEvents int64
DroppedCommands int64
DroppedEvents int64
ThrottledCommands int64
}
type TradingState ¶
type TradingState string
const ( TradingStateActive TradingState = "active" TradingStateHalted TradingState = "halted" TradingStateReducing TradingState = "reducing" )
Click to show internal directories.
Click to hide internal directories.