plugins

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 7 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 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) 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) 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 SPE

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

SPE SettlePositionEvent.

Jump to

Keyboard shortcuts

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