ledger

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Entries = make(map[string]*Entry)

map of uuid -> entry

View Source
var EntriesLock = lock.NewLock("ledger-entries-lock")

map of stock_uuid -> open shares

View Source
var EntriesPortfolioStock = make(map[string]map[string]*Entry)
View Source
var EntriesStockPortfolio = make(map[string]map[string]*Entry)
View Source
var NewEntriesLock = lock.NewLock("new-entries-lock")

Functions

func DeleteLedger

func DeleteLedger(l *Entry, lockAcquired bool)

Types

type Entry

type Entry struct {
	objects.Ledger
	Lock          *lock.Lock                    `json:"-"`
	UpdateChannel *duplicator.ChannelDuplicator `json:"-"`
}

* Ledgers store who owns what stock They are all done though uuid strings since that's all that's required They are stored in two maps 1) given a stock uuid, get all portfolios that own it 2) given a portfolio uuid, get all stocks it owns

func GetAllLedgers

func GetAllLedgers() []*Entry

/** get All ledgers so they can be sent on connection

func MakeLedgerEntry

func MakeLedgerEntry(ledger objects.Ledger, lockAcquired bool) (*Entry, error)

* Make a Ledger

func NewLedgerEntry

func NewLedgerEntry(portfolioId, stockId string) (*Entry, error)

* build a new ledger entry and generate a new uuid for it takes in the lock acquired since trade already owns the lock for the entries

Jump to

Keyboard shortcuts

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