portfolio

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: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	RecordTrade(TradeRecord)
}

type AnalyzerFunc

type AnalyzerFunc func(TradeRecord)

func (AnalyzerFunc) RecordTrade

func (f AnalyzerFunc) RecordTrade(record TradeRecord)

type Portfolio

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

func New

func New(c *cache.Cache) *Portfolio

func (*Portfolio) ApplyFill

func (p *Portfolio) ApplyFill(fill model.FillReport) error

func (*Portfolio) ApplyFillWithPosition

func (p *Portfolio) ApplyFillWithPosition(fill model.FillReport, previous *model.PositionStatusReport, position model.PositionStatusReport) error

func (*Portfolio) ApplyMarketEvent

func (p *Portfolio) ApplyMarketEvent(event model.MarketEvent) error

func (*Portfolio) AvailableEquity

func (p *Portfolio) AvailableEquity(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) BalancesLocked

func (p *Portfolio) BalancesLocked(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) Commission

func (p *Portfolio) Commission(accountID model.AccountID, currency model.Currency) decimal.Decimal

func (*Portfolio) Equity

func (p *Portfolio) Equity(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) Exposure

func (p *Portfolio) Exposure(accountID model.AccountID, quote model.Currency) decimal.Decimal

func (*Portfolio) HandleExecutionEvent

func (p *Portfolio) HandleExecutionEvent(event model.ExecutionEvent) error

func (*Portfolio) MarginsInit

func (p *Portfolio) MarginsInit(accountID model.AccountID) map[model.InstrumentID]decimal.Decimal

func (*Portfolio) MarginsMaint

func (p *Portfolio) MarginsMaint(accountID model.AccountID) map[model.InstrumentID]decimal.Decimal

func (*Portfolio) MarkValue

func (p *Portfolio) MarkValue(accountID model.AccountID, instrumentID model.InstrumentID) decimal.Decimal

func (*Portfolio) MarkValues

func (p *Portfolio) MarkValues(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) NetExposuresByAccount

func (p *Portfolio) NetExposuresByAccount(target model.Currency) map[model.AccountID]decimal.Decimal

func (*Portfolio) NetExposuresByInstrument

func (p *Portfolio) NetExposuresByInstrument(accountID model.AccountID, target model.Currency) map[model.InstrumentID]decimal.Decimal

func (*Portfolio) NetExposuresByVenue

func (p *Portfolio) NetExposuresByVenue(target model.Currency) map[model.Venue]decimal.Decimal

func (*Portfolio) NetPosition

func (p *Portfolio) NetPosition(accountID model.AccountID, instrumentID model.InstrumentID) decimal.Decimal

func (*Portfolio) NetPositionsByInstrument

func (p *Portfolio) NetPositionsByInstrument(accountID model.AccountID) map[model.InstrumentID]decimal.Decimal

func (*Portfolio) RealizedPnL

func (p *Portfolio) RealizedPnL(accountID model.AccountID, instrumentID model.InstrumentID) decimal.Decimal

func (*Portfolio) RealizedPnLs

func (p *Portfolio) RealizedPnLs(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) SetAnalyzer

func (p *Portfolio) SetAnalyzer(analyzer Analyzer)

func (*Portfolio) SetConversionRate

func (p *Portfolio) SetConversionRate(from model.Currency, to model.Currency, rate decimal.Decimal) error

func (*Portfolio) SetMark

func (p *Portfolio) SetMark(accountID model.AccountID, instrumentID model.InstrumentID, price decimal.Decimal)

func (*Portfolio) TotalPnLs

func (p *Portfolio) TotalPnLs(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) UnrealizedPnL

func (p *Portfolio) UnrealizedPnL(accountID model.AccountID, instrumentID model.InstrumentID) decimal.Decimal

func (*Portfolio) UnrealizedPnLs

func (p *Portfolio) UnrealizedPnLs(accountID model.AccountID) map[model.Currency]decimal.Decimal

func (*Portfolio) UpdateAccount

func (p *Portfolio) UpdateAccount(account model.AccountSnapshot) error

type TradeRecord

type TradeRecord struct {
	AccountID          model.AccountID
	InstrumentID       model.InstrumentID
	PositionID         model.PositionID
	Currency           model.Currency
	RealizedPnL        decimal.Decimal
	AccountCurrency    model.Currency
	AccountCurrencyPnL decimal.Decimal
}

Jump to

Keyboard shortcuts

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