wallet

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapitalRate

type CapitalRate struct {
	EURUSD float64
	EURCAD float64
}

type Finder

type Finder interface {
	FindByName(name string) (*Wallet, error)
	FindByBankAccount(ba *bank.Account) (*Wallet, error)
	LoadBankAccounts(w *Wallet) error
	FindWithItemByStock(stk *stock.Stock) ([]*Wallet, error)
	LoadActiveItems(w *Wallet) error
	LoadInactiveItems(w *Wallet) error
	LoadAllItems(w *Wallet) error
	LoadItemByStock(w *Wallet, stk *stock.Stock) error
	LoadItemOperations(i *Item) error
	LoadActiveTrades(w *Wallet) error
	LoadTradeItemOperations(i *Item) error
}

type Item

type Item struct {
	ID                uuid.UUID
	Stock             *stock.Stock
	Amount            int
	Invested          mm.Value
	Dividend          mm.Value
	Buys              mm.Value
	Sells             mm.Value
	CapitalRate       float64
	Operations        []*operation.Operation
	Trades            map[int]*trade.Trade
	DividendRetention mm.Value
}

func NewItem

func NewItem(stock *stock.Stock) *Item

func (*Item) Capital

func (i *Item) Capital() mm.Value

func (*Item) Change

func (i *Item) Change() mm.Value

func (*Item) NetBenefits

func (i *Item) NetBenefits() mm.Value

func (*Item) PercentageBenefits

func (i *Item) PercentageBenefits() float64

func (*Item) PercentageInvestedRepresented

func (i *Item) PercentageInvestedRepresented(invested float64) float64

func (*Item) WeightedAveragePrice

func (i *Item) WeightedAveragePrice() mm.Value

type Persister

type Persister interface {
	PersistAll(ws []*Wallet) error
	PersistOperations(w *Wallet) error
	UpdateAllAccounting(ws []*Wallet) error
	UpdateAllItemsCapital(ws []*Wallet) error
	UpdateRetentions(w *Wallet) error
}

type Wallet

type Wallet struct {
	ID           uuid.UUID
	Name         string
	URL          string
	BankAccounts map[uuid.UUID]*bank.Account
	// stocks in trade
	Items map[uuid.UUID]*Item
	// inital capital
	Invested mm.Value
	// capital (sum of all wallet item capital)
	Capital    mm.Value
	Funds      mm.Value
	Operations []*operation.Operation
	Dividend   mm.Value
	Commission mm.Value
	Connection mm.Value
	Interest   mm.Value

	Trades map[int]*trade.Trade
	// contains filtered or unexported fields
}

func NewWallet

func NewWallet(name, url string) *Wallet

func (*Wallet) AddBankAccount

func (w *Wallet) AddBankAccount(ba *bank.Account) error

func (*Wallet) AddOperation

func (w *Wallet) AddOperation(o *operation.Operation) error

func (*Wallet) AddTrade

func (w *Wallet) AddTrade(n int, o *operation.Operation) error

func (*Wallet) CurrentCapitalRate

func (w *Wallet) CurrentCapitalRate() CapitalRate

func (*Wallet) DecreaseInvestment

func (w *Wallet) DecreaseInvestment(v mm.Value)

func (*Wallet) DividendGrossProjectedNextMonth

func (w *Wallet) DividendGrossProjectedNextMonth() mm.Value

func (*Wallet) DividendGrossProjectedNextYear

func (w *Wallet) DividendGrossProjectedNextYear() mm.Value

func (*Wallet) DividendNetProjectedNextMonth

func (w *Wallet) DividendNetProjectedNextMonth(retention float64) mm.Value

func (*Wallet) DividendNetProjectedNextYear

func (w *Wallet) DividendNetProjectedNextYear(retention float64) mm.Value

func (*Wallet) FreeMargin

func (w *Wallet) FreeMargin() mm.Value

func (*Wallet) IncreaseInvestment

func (w *Wallet) IncreaseInvestment(v mm.Value)

func (*Wallet) Margin

func (w *Wallet) Margin() mm.Value

func (*Wallet) NetBenefits

func (w *Wallet) NetBenefits() mm.Value

func (*Wallet) NetCapital

func (w *Wallet) NetCapital() mm.Value

func (*Wallet) PercentageBenefits

func (w *Wallet) PercentageBenefits() float64

func (*Wallet) SetCapitalRate

func (w *Wallet) SetCapitalRate(capitalRate CapitalRate)

func (*Wallet) UpdateCapital

func (w *Wallet) UpdateCapital(v mm.Value)

Jump to

Keyboard shortcuts

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