Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book struct { Order []*Order Transactions []*Transaction OrdersChan chan *Order // input OrdersChanOut chan *Order Wg *sync.WaitGroup }
func (*Book) AddTransaction ¶
func (b *Book) AddTransaction(transaction *Transaction, wg *sync.WaitGroup)
type Investor ¶
type Investor struct { ID string Name string AssetPosition []*InvestorAssetPosition }
func NewInvestor ¶
func (*Investor) AddAssetPosition ¶
func (i *Investor) AddAssetPosition(assetPosition *InvestorAssetPosition)
func (*Investor) GetAssetPosition ¶
func (i *Investor) GetAssetPosition(assetID string) *InvestorAssetPosition
func (*Investor) UpdateAssetPosition ¶
type InvestorAssetPosition ¶
type InvestorAssetPosition struct { AssetID string }
func NewInvestorAssetPosition ¶
func NewInvestorAssetPosition(assetID string, shares int) *InvestorAssetPosition
type Order ¶
type OrderQueue ¶
type OrderQueue struct {
Orders []*Order
}
func NewOrderQueue ¶
func NewOrderQueue() *OrderQueue
func (*OrderQueue) Len ¶
func (oq *OrderQueue) Len() int
func (*OrderQueue) Less ¶
func (oq *OrderQueue) Less(i, j int) bool
func (*OrderQueue) Pop ¶
func (oq *OrderQueue) Pop() interface{}
func (*OrderQueue) Push ¶
func (oq *OrderQueue) Push(x interface{})
func (*OrderQueue) Swap ¶
func (oq *OrderQueue) Swap(i, j int)
type Transaction ¶
type Transaction struct { ID string SellingOrder *Order BuyingOrder *Order Price float64 Total float64 DateTime time.Time }
func NewTransaction ¶
func NewTransaction(sellingOrder *Order, buyingOrder *Order, shares int, price float64) *Transaction
func (*Transaction) AddBuyOrderPendingShares ¶
func (t *Transaction) AddBuyOrderPendingShares(shares int)
func (*Transaction) AddSellOrderPendingShares ¶
func (t *Transaction) AddSellOrderPendingShares(shares int)
func (*Transaction) CalculateTotal ¶
func (t *Transaction) CalculateTotal(shares int, price float64)
func (*Transaction) CloseBuyOrder ¶
func (t *Transaction) CloseBuyOrder()
func (*Transaction) CloseSellOrder ¶
func (t *Transaction) CloseSellOrder()
Click to show internal directories.
Click to hide internal directories.