Documentation ¶
Index ¶
Constants ¶
View Source
const (
ObjectType = "stock"
)
Variables ¶
View Source
var Stocks = make(map[string]*Stock)
View Source
var ValuablesLock = lock.NewLock("valuables")
Functions ¶
func DeleteStock ¶
func DeleteStock(s *Stock)
func StartStockStimulation ¶
func StartStockStimulation()
Types ¶
type PriceChange ¶
type PriceChange interface { GetTargetPrice() int64 // contains filtered or unexported methods }
Some thing that can take in a stock and change the current price
type RandomPrice ¶
type RandomPrice struct { RunPercent float64 `json:"run_percent"` TargetPrice int64 `json:"target_price"` PercentToChangeTarget float64 `json:"change_percent"` Volatility float64 `json:"volatility"` RandomNoise float64 }
Random Price implements priceChange
func (*RandomPrice) GetTargetPrice ¶
func (randPrice *RandomPrice) GetTargetPrice() int64
type Stock ¶
type Stock struct { objects.Stock PriceChanger PriceChange `json:"-"` UpdateChannel *duplicator.ChannelDuplicator `json:"-"` // contains filtered or unexported fields }
Stock type for storing the stock information
func GetAllStocks ¶
func GetAllStocks() []*Stock
func (*Stock) ChangeDetected ¶
func (*Stock) GetUpdateChannel ¶
func (stock *Stock) GetUpdateChannel() *duplicator.ChannelDuplicator
type Valuable ¶
type Valuable interface { GetId() string GetName() string GetValue() float64 GetLock() *lock.Lock GetUpdateChannel() *duplicator.ChannelDuplicator Update() }
* Valuable was an old thing that i used to abstract stocks one more level but just became cumbersome
Click to show internal directories.
Click to hide internal directories.