plugins

package
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMarketNotFound = errors.New("could not find market")

Functions

This section is empty.

Types

type DOC added in v0.71.0

type DOC interface {
	events.Event
	MarketID() string
	Parties() []string
}

DOC DistressedOrdersClosedEvent.

type DPE added in v0.71.0

type DPE interface {
	events.Event
	MarketID() string
	DistressedParties() []string
	SafeParties() []string
}

DPE DistressedPositionsEvent.

type FP added in v0.73.0

type FP interface {
	events.Event
	MarketID() string
	IsParty(id string) bool
	FundingPayments() *eventspb.FundingPayments
}

FP FundingPaymentsEvent.

type LSE

type LSE interface {
	events.Event
	PartyID() string
	MarketID() string
	Amount() *num.Int
	Timestamp() int64
}

LSE LossSocializationEvent.

type Position

type Position struct {
	types.Position
	AverageEntryPriceFP num.Decimal
	RealisedPnlFP       num.Decimal
	UnrealisedPnlFP     num.Decimal
	// contains filtered or unexported fields
}

type Positions

type Positions struct {
	*subscribers.Base
	// contains filtered or unexported fields
}

Positions plugin taking settlement data to build positions API data.

func NewPositions

func NewPositions(ctx context.Context) *Positions

func (*Positions) GetAllPositions

func (p *Positions) GetAllPositions() ([]*types.Position, error)

GetAllPositions returns all positions, across markets.

func (*Positions) GetPositionStatesByParty added in v0.71.0

func (p *Positions) GetPositionStatesByParty(party string) ([]vega.PositionStatus, error)

func (*Positions) GetPositionsByMarket

func (p *Positions) GetPositionsByMarket(market string) ([]*types.Position, error)

GetPositionsByMarket get all party positions in a given market.

func (*Positions) GetPositionsByMarketAndParty

func (p *Positions) GetPositionsByMarketAndParty(market, party string) (*types.Position, error)

GetPositionsByMarketAndParty get the position of a single party in a given market.

func (*Positions) GetPositionsByParty

func (p *Positions) GetPositionsByParty(party string) ([]*types.Position, error)

GetPositionsByParty get all positions for a given party.

func (*Positions) GetStateByMarketAndParty added in v0.71.0

func (p *Positions) GetStateByMarketAndParty(market, party string) (vega.PositionStatus, error)

func (*Positions) Push

func (p *Positions) Push(evts ...events.Event)

func (*Positions) Types

func (p *Positions) Types() []events.Type

type SDE

type SDE interface {
	SE
	Margin() *num.Uint
	Timestamp() int64
}

SDE SettleDistressedEvent.

type SE

type SE interface {
	events.Event
	PartyID() string
	MarketID() string
	Price() *num.Uint
	Timestamp() int64
}

SE SettleEvent - common denominator between SPE & SDE.

type SME added in v0.73.0

type SME interface {
	MarketID() string
	SettledPrice() *num.Uint
	PositionFactor() num.Decimal
	TxHash() string
}

SME SettleMarketEvent.

type SPE

type SPE interface {
	SE
	PositionFactor() num.Decimal
	Trades() []events.TradeSettlement
	Timestamp() int64
}

SPE SettlePositionEvent.

type TE added in v0.74.0

type TE interface {
	MarketID() string
	IsParty(id string) bool // we don't use this one, but it's to make sure we identify the event correctly
	Trade() vega.Trade
}

TE TradeEvent.

Jump to

Keyboard shortcuts

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