Documentation ¶
Overview ¶
Package stock :: buying.go
Package stock :: byExchange.go
Package stock :: byStock.go
Package stock :: exchange.go
Package stock :: market.go
Package stock :: stock.go
Index ¶
Constants ¶
const ( // MAXSTACK is the maximum stacks allowed for a stack MAXSTACK = 10 // STACKSIZE is the number of stocks in one stack STACKSIZE = 100 // STOCKAMOUNT is the default number of stocks STOCKAMOUNT = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuyingStock ¶
type BuyingStock struct { StockID int ExchangeID int Amount int UnitPrice float64 StackDiff float64 Pay float64 }
BuyingStock struct
func (*BuyingStock) StringHeader ¶
func (bs *BuyingStock) StringHeader() string
StringHeader func for BuyingStock
type ByStock ¶
ByStock is type of func as Less of sort.Interface
func ByStockID ¶
func ByStockID() ByStock
ByStockID returns a ByStock / Less function of sort.Interface
func ByStockPrice ¶
func ByStockPrice() ByStock
ByStockPrice returns a ByStock / Less function of sort.Interface
type Exchange ¶
Exchange struct
func (*Exchange) StockHeader ¶
StockHeader func for stocks list header
type Market ¶
Market struct
func (*Market) GetBuyingStocks ¶
func (m *Market) GetBuyingStocks(id, amount int) []BuyingStock
GetBuyingStocks returns a set of stock to buy at the lowest price
func (*Market) GetExchanges ¶
GetExchanges returns sorted exchanges list
func (*Market) GetPriceByAmount ¶
GetPriceByAmount returns the total per exchange, stock, and number of stocks
func (*Market) GetUnitPriceByStack ¶
GetUnitPriceByStack returns the price for spcified exchange, stock, and stack
type Stock ¶
type Stock struct {
// contains filtered or unexported fields
}
Stock struct represents exchangeable stock - assuming same price for buying and selling - assuming stack is always the same (for simplicity) - note: for varied stack, see GetUnitPriceByBoughtAmount
func (*Stock) GetPriceByAmount ¶
GetPriceByAmount returns the total price by number of stocks
func (*Stock) GetUnitPriceByBoughtAmount ¶
GetUnitPriceByBoughtAmount returns the unit price per bought amount
func (*Stock) GetUnitPriceByStack ¶
GetUnitPriceByStack returns the unit price for specified stack
func (*Stock) StringHeader ¶
StringHeader func for stocks list header