trade

package
v0.0.0-...-6c4cad4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status string
const (
	Open    Status = "open"
	Close   Status = "close"
	Initial Status = "initial"
)

type Trade

type Trade struct {
	ID     uuid.UUID
	Number int

	OpenedAt  time.Time
	Buys      mm.Value
	BuyAmount float64

	ClosedAt   time.Time
	Sells      mm.Value
	SellAmount float64

	Amount   float64
	Dividend mm.Value

	Status Status

	CloseCapital mm.Value
	CloseNet     mm.Value

	Stock      *stock.Stock
	Operations []*operation.Operation

	// Rate currency conversion
	CapitalRate float64
}

func NewTrade

func NewTrade(number int) *Trade

func (*Trade) BenefitPercentage

func (t *Trade) BenefitPercentage() float64

func (*Trade) Bought

func (t *Trade) Bought(op *operation.Operation)

func (*Trade) Capital

func (t *Trade) Capital() mm.Value

func (*Trade) Close

func (t *Trade) Close(op *operation.Operation)

func (*Trade) Net

func (t *Trade) Net() mm.Value

func (*Trade) Open

func (t *Trade) Open(op *operation.Operation)

func (*Trade) PayedDividend

func (t *Trade) PayedDividend(d mm.Value)

func (*Trade) Sold

func (t *Trade) Sold(op *operation.Operation)

func (*Trade) WeightedAverageBuyPrice

func (t *Trade) WeightedAverageBuyPrice() mm.Value

func (*Trade) WeightedAverageSellPrice

func (t *Trade) WeightedAverageSellPrice() mm.Value

Jump to

Keyboard shortcuts

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