account

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanOrderTransition added in v1.0.0

func CanOrderTransition(from model.OrderStatus, to model.OrderStatus) bool

func NextOrderStatus added in v1.0.0

func NextOrderStatus(from model.OrderStatus, to model.OrderStatus) (model.OrderStatus, bool)

Types

type MissingOpenOrderRepairPolicy added in v1.0.0

type MissingOpenOrderRepairPolicy struct {
	MissingStatus        model.OrderStatus
	RecentActivityWindow time.Duration
	Now                  time.Time
}

type OrderTracker added in v1.0.0

type OrderTracker struct {
	// contains filtered or unexported fields
}

func (*OrderTracker) C added in v1.0.0

func (t *OrderTracker) C() <-chan model.OrderStatusReport

func (*OrderTracker) Close added in v1.0.0

func (t *OrderTracker) Close()

func (*OrderTracker) Fills added in v1.0.0

func (t *OrderTracker) Fills() <-chan model.FillReport

func (*OrderTracker) Latest added in v1.0.0

func (t *OrderTracker) Latest() (model.OrderStatusReport, bool)

type PositionRepairDiscrepancy added in v1.0.0

type PositionRepairDiscrepancy struct {
	Kind         string
	AccountID    model.AccountID
	InstrumentID model.InstrumentID
	PositionID   model.PositionID
	Attempts     int
	Reason       string
}

type PositionRepairPolicy added in v1.0.0

type PositionRepairPolicy struct {
	MaxAttempts int
	Now         time.Time
}

type PositionRepairResult added in v1.0.0

type PositionRepairResult struct {
	Generated  []model.PositionStatusReport
	Unresolved []PositionRepairDiscrepancy
}

type Reconciler added in v1.0.0

type Reconciler struct {
	// contains filtered or unexported fields
}

func NewReconciler added in v1.0.0

func NewReconciler(c *cache.Cache) *Reconciler

func (*Reconciler) Apply added in v1.0.0

func (r *Reconciler) Apply(event model.ExecutionEvent) error

func (*Reconciler) MissingPositionReports added in v1.0.0

func (r *Reconciler) MissingPositionReports(accountID model.AccountID, instrumentID model.InstrumentID, reports []model.PositionStatusReport) ([]model.PositionStatusReport, error)

func (*Reconciler) ReconcileMissingOpenOrders added in v1.0.0

func (r *Reconciler) ReconcileMissingOpenOrders(accountID model.AccountID, instrumentID model.InstrumentID, reports []model.OrderStatusReport, missingStatus model.OrderStatus) ([]model.OrderStatusReport, error)

func (*Reconciler) ReconcileMissingOpenOrdersWithPolicy added in v1.0.0

func (r *Reconciler) ReconcileMissingOpenOrdersWithPolicy(accountID model.AccountID, instrumentID model.InstrumentID, reports []model.OrderStatusReport, policy MissingOpenOrderRepairPolicy) ([]model.OrderStatusReport, error)

func (*Reconciler) RepairPositionReports added in v1.0.0

func (r *Reconciler) RepairPositionReports(accountID model.AccountID, instrumentID model.InstrumentID, reports []model.PositionStatusReport, policy PositionRepairPolicy) (PositionRepairResult, error)

type TradingAccount

type TradingAccount struct {
	// contains filtered or unexported fields
}

func NewTradingAccount

func NewTradingAccount(client venue.ExecutionClient, cfg TradingAccountConfig) (*TradingAccount, error)

func (*TradingAccount) Cache added in v1.0.0

func (a *TradingAccount) Cache() *cache.Cache

func (*TradingAccount) CancelOrder added in v1.0.0

func (*TradingAccount) Health added in v0.2.20

func (*TradingAccount) ModifyOrder added in v1.0.0

func (*TradingAccount) QueryAccount added in v1.0.0

func (a *TradingAccount) QueryAccount(ctx context.Context) (model.AccountSnapshot, error)

func (*TradingAccount) QueryOrder added in v1.0.0

func (*TradingAccount) Start

func (a *TradingAccount) Start(ctx context.Context) error

func (*TradingAccount) Stop added in v1.0.0

func (a *TradingAccount) Stop(ctx context.Context) error

func (*TradingAccount) SubmitOrder added in v1.0.0

func (a *TradingAccount) SubmitOrder(ctx context.Context, order model.SubmitOrder) (*OrderTracker, error)

type TradingAccountConfig added in v1.0.0

type TradingAccountConfig struct {
	Cache                   *cache.Cache
	Instruments             []model.InstrumentID
	BufferSize              int
	ReconcileInterval       time.Duration
	MissingOrderRepairDelay time.Duration
}

type TradingAccountHealth added in v0.2.20

type TradingAccountHealth struct {
	Ready                bool
	AccountReady         bool
	OrderStreamReady     bool
	FillsUnsupported     bool
	PositionsUnsupported bool
	Reconnects           int64
	Reconciliations      int64
	AccountEvents        int64
	OrderEvents          int64
	FillEvents           int64
	PositionEvents       int64
	SlowSubscriberDrops  int64
	LastEventTime        time.Time
	LastReconcileTime    time.Time
	LastError            error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL