reporting

package
v0.0.0-...-50d9c68 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountFifo

type AccountFifo map[string]*FifoGroup

func (AccountFifo) Get

func (a AccountFifo) Get(accountName string, subCategory ...string) *fifo.Fifo

Get the accounts global fifo queue for physical holdings or for a sub category to track margin trades for example.

func (AccountFifo) SetIsShortTrade

func (a AccountFifo) SetIsShortTrade(accountName string, subCategory string, status bool)

type Conversion

type Conversion struct {
	Ts               time.Time
	RecID            string
	Type             string
	Account          string
	From             string    // = Quote asset for buy, base asset for sells.
	FromDecimals     int32     // = Number of decimals of either the quote or base asset. Depending on the direction of the trade.
	To               string    // = Base asset for bus, quote asset for sells.
	ToDecimals       int32     // = Number of decimals of either the quote or base asset. Depending on the direction of the trade.
	ToAmount         d.Decimal // = Amount
	ToAmountNet      d.Decimal // = Amount - Fee
	ToAmountEur      d.Decimal // = Amount * QuotePriceC
	ToAmountNetEur   d.Decimal // = Amount * QuotePriceC - QuoteFeeC
	FromAmount       d.Decimal // = Value
	FromAmountNet    d.Decimal // = Value - FeeC
	FromAmountEur    d.Decimal // = ValueC
	FromAmountNetEur d.Decimal // = ValueC - FeeC
	FromEntries      []fifo.Asset
	QueueBefore      []fifo.Asset
	QueueAfter       []fifo.Asset
	Price            d.Decimal // = Price
	PriceEur         d.Decimal // = PriceC (only in there for informational purposes)
	FeeCurrency      string    // = FeeCurrency
	Fee              d.Decimal // = Fee
	FeeDecimals      int32     // = Number of decimals of the fee currency.
	QuoteFeeCurrency string    // = QuoteFeeCurrency
	QuoteFee         d.Decimal // = QuoteFee
	QuoteFeeDecimals int32     // = Number of decimals of the quote fee currency.
	FeeEur           d.Decimal // = FeeC + QuoteFeeC
	Result           ConversionResult
	Warning          string
	Error            string
	IsDerivative     bool
	IsMarginTrade    bool
	IsPhysical       bool
}

type ConversionResult

type ConversionResult struct {
	CostEur  d.Decimal // Original cost in EUR of the assets to convert from.
	ValueEur d.Decimal // EUR value of the asset when it was obtained.
	// Pnl      d.Decimal
	PnlEur      d.Decimal
	FeePayedEur d.Decimal
}

type Deposit

type Deposit struct {
	Ts          time.Time
	Type        string
	Account     string
	Asset       string
	Amount      decimal.Decimal
	Fee         decimal.Decimal
	FeeEur      decimal.Decimal
	Source      string
	Entries     fifo.EntryList
	QueueBefore []fifo.Asset
	QueueAfter  []fifo.Asset
	Error       string
	Warning     string
}

type Description

type Description interface {
	String() string
}

type DescriptionMap

type DescriptionMap map[string][]Description

func (DescriptionMap) Add

func (d DescriptionMap) Add(accountName string, description Description)

type FifoGroup

type FifoGroup struct {
	G *fifo.Fifo            // The global fifo queue for physical holdings.
	I map[string]*fifo.Fifo // Holds a map of "independent" fifo queues. Used for margin trades for example.
}

type Generator

type Generator struct {
	Recs []any
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator() *Generator

func (*Generator) Start

func (r *Generator) Start(from, to time.Time) error

func (*Generator) TradeToConversion

func (r *Generator) TradeToConversion(trade *proto.Trade) *Conversion

Create a conversion from a trade. Depending on the direction of the trade, assets and prices are assigned accordingly.

type Withdrawal

type Withdrawal struct {
	RecID       string
	Ts          time.Time
	Type        string
	Account     string
	Asset       string
	Amount      decimal.Decimal
	Fee         decimal.Decimal
	FeeEur      decimal.Decimal
	Destination string
	Entries     fifo.EntryList
	QueueBefore []fifo.Asset
	QueueAfter  []fifo.Asset
	Error       string
	Warning     string
}

Jump to

Keyboard shortcuts

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