Documentation ¶
Index ¶
- type AuctionState
- func (a *AuctionState) AuctionExtended(ctx context.Context, now time.Time) *events.Auction
- func (a AuctionState) AuctionStart() bool
- func (a *AuctionState) AuctionStarted(ctx context.Context, now time.Time) *events.Auction
- func (a AuctionState) CanLeave() bool
- func (a AuctionState) Changed() bool
- func (a AuctionState) Duration() types.AuctionDuration
- func (a AuctionState) ExpiresAt() *time.Time
- func (a *AuctionState) ExtendAuction(delta types.AuctionDuration)
- func (a *AuctionState) ExtendAuctionLiquidity(delta types.AuctionDuration)
- func (a *AuctionState) ExtendAuctionPrice(delta types.AuctionDuration)
- func (a AuctionState) ExtensionTrigger() types.AuctionTrigger
- func (a *AuctionState) GetState() *types.AuctionState
- func (a AuctionState) InAuction() bool
- func (a AuctionState) IsFBA() bool
- func (a AuctionState) IsLiquidityAuction() bool
- func (a AuctionState) IsLiquidityExtension() bool
- func (a AuctionState) IsMonitorAuction() bool
- func (a AuctionState) IsOpeningAuction() bool
- func (a AuctionState) IsPriceAuction() bool
- func (a AuctionState) IsPriceExtension() bool
- func (a *AuctionState) Left(ctx context.Context, now time.Time) *events.Auction
- func (a AuctionState) Mode() types.MarketTradingMode
- func (a *AuctionState) SetReadyToLeave()
- func (a AuctionState) Start() time.Time
- func (a *AuctionState) StartLiquidityAuction(t time.Time, d *types.AuctionDuration)
- func (a *AuctionState) StartOpeningAuction(t time.Time, d *types.AuctionDuration)
- func (a *AuctionState) StartPriceAuction(t time.Time, d *types.AuctionDuration)
- func (a AuctionState) Trigger() types.AuctionTrigger
- func (a *AuctionState) UpdateMinDuration(ctx context.Context, d time.Duration) *events.Auction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuctionState ¶
type AuctionState struct {
// contains filtered or unexported fields
}
func NewAuctionState ¶
func NewAuctionState(mkt *types.Market, now time.Time) *AuctionState
func NewAuctionStateFromSnapshot ¶
func NewAuctionStateFromSnapshot(mkt *types.Market, as *types.AuctionState) *AuctionState
func (*AuctionState) AuctionExtended ¶
AuctionExtended - called to confirm we will not leave auction, returns the event to be sent or nil if the auction wasn't extended.
func (AuctionState) AuctionStart ¶
func (a AuctionState) AuctionStart() bool
AuctionStart bool indicates something has already triggered an auction to start, we can skip other monitoring potentially and we know to create an auction event.
func (*AuctionState) AuctionStarted ¶
AuctionStarted is called by the execution package to set flags indicating the market has started the auction.
func (AuctionState) CanLeave ¶
func (a AuctionState) CanLeave() bool
CanLeave bool indicating whether auction should be closed or not, if true, we can still extend the auction but when the market takes over (after monitoring engines), the auction will be closed.
func (AuctionState) Changed ¶
func (a AuctionState) Changed() bool
func (AuctionState) Duration ¶
func (a AuctionState) Duration() types.AuctionDuration
Duration returns a copy of the current auction duration object.
func (AuctionState) ExpiresAt ¶
func (a AuctionState) ExpiresAt() *time.Time
ExpiresAt returns end as time -> if nil, the auction duration either isn't determined by time or we're simply not in an auction.
func (*AuctionState) ExtendAuction ¶
func (a *AuctionState) ExtendAuction(delta types.AuctionDuration)
ExtendAuction extends the current auction.
func (*AuctionState) ExtendAuctionLiquidity ¶
func (a *AuctionState) ExtendAuctionLiquidity(delta types.AuctionDuration)
ExtendAuctionLiquidity - call from liquidity monitoring to extend the auction sets the extension trigger field accordingly.
func (*AuctionState) ExtendAuctionPrice ¶
func (a *AuctionState) ExtendAuctionPrice(delta types.AuctionDuration)
ExtendAuctionPrice - call from price monitoring to extend the auction sets the extension trigger field accordingly.
func (AuctionState) ExtensionTrigger ¶
func (a AuctionState) ExtensionTrigger() types.AuctionTrigger
ExtensionTrigger returns what extended an auction.
func (*AuctionState) GetState ¶
func (a *AuctionState) GetState() *types.AuctionState
func (AuctionState) InAuction ¶
func (a AuctionState) InAuction() bool
InAuction returns bool if the market is in auction for any reason Returns false if auction is triggered, but not yet started by market (execution).
func (AuctionState) IsFBA ¶
func (a AuctionState) IsFBA() bool
func (AuctionState) IsLiquidityAuction ¶
func (a AuctionState) IsLiquidityAuction() bool
func (AuctionState) IsLiquidityExtension ¶
func (a AuctionState) IsLiquidityExtension() bool
func (AuctionState) IsMonitorAuction ¶
func (a AuctionState) IsMonitorAuction() bool
IsMonitorAuction - quick way to determine whether or not we're in an auction triggered by a monitoring engine.
func (AuctionState) IsOpeningAuction ¶
func (a AuctionState) IsOpeningAuction() bool
func (AuctionState) IsPriceAuction ¶
func (a AuctionState) IsPriceAuction() bool
func (AuctionState) IsPriceExtension ¶
func (a AuctionState) IsPriceExtension() bool
func (*AuctionState) Left ¶
Left is called by execution to update internal state indicating this auction was closed.
func (AuctionState) Mode ¶
func (a AuctionState) Mode() types.MarketTradingMode
Mode returns current trading mode.
func (*AuctionState) SetReadyToLeave ¶
func (a *AuctionState) SetReadyToLeave()
SetReadyToLeave is called by monitoring engines to mark if an auction period has expired.
func (AuctionState) Start ¶
func (a AuctionState) Start() time.Time
Start - returns time pointer of the start of the auction (nil if not in auction).
func (*AuctionState) StartLiquidityAuction ¶
func (a *AuctionState) StartLiquidityAuction(t time.Time, d *types.AuctionDuration)
StartLiquidityAuction - set the state to start a liquidity triggered auction @TODO these functions will be removed once the types are in proto.
func (*AuctionState) StartOpeningAuction ¶
func (a *AuctionState) StartOpeningAuction(t time.Time, d *types.AuctionDuration)
StartOpeningAuction - set the state to start an opening auction (used for testing) @TODO these functions will be removed once the types are in proto.
func (*AuctionState) StartPriceAuction ¶
func (a *AuctionState) StartPriceAuction(t time.Time, d *types.AuctionDuration)
StartPriceAuction - set the state to start a price triggered auction @TODO these functions will be removed once the types are in proto.
func (AuctionState) Trigger ¶
func (a AuctionState) Trigger() types.AuctionTrigger
Trigger returns what triggered an auction.
func (*AuctionState) UpdateMinDuration ¶
UpdateMinDuration - see if we need to update the end value for current auction duration (if any) if the auction duration increases, an auction event will be returned.