Documentation
¶
Index ¶
- Constants
- type Bot
- type VolatilityWindow
- func (h *VolatilityWindow) AddRecord(coins market.Coins)
- func (h *VolatilityWindow) GetLatestRecord() VolatilityWindowRecord
- func (h *VolatilityWindow) IdentifyVolatileCoins(percentage float64) market.VolatileCoins
- func (h *VolatilityWindow) Max(symbol string) VolatilityWindowRecord
- func (h *VolatilityWindow) Min(symbol string) VolatilityWindowRecord
- func (h *VolatilityWindow) Size() int
- type VolatilityWindowRecord
Constants ¶
const UnlimitedVolatilityWindowLength = 0
UnlimitedVolatilityWindowLength is a constant that can be used to indicate that the volatilityWindow should have an unlimited length. Warning: this should only be used for testing purposes. Growing the volatilityWindow indefinitely can lead to memory leaks.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VolatilityWindow ¶
type VolatilityWindow struct {
// contains filtered or unexported fields
}
func NewVolatilityWindow ¶
func NewVolatilityWindow(maxLength int) *VolatilityWindow
NewVolatilityWindow creates a new volatilityWindow of records. The volatilityWindow can be used to monitor the price changes of coins over time. It's a rolling window of records, so the volatilityWindow will never exceed the given max length.
func (*VolatilityWindow) AddRecord ¶
func (h *VolatilityWindow) AddRecord(coins market.Coins)
AddRecord adds a new record to the volatilityWindow.
func (*VolatilityWindow) GetLatestRecord ¶
func (h *VolatilityWindow) GetLatestRecord() VolatilityWindowRecord
GetLatestRecord returns the latest record in the volatilityWindow.
func (*VolatilityWindow) IdentifyVolatileCoins ¶
func (h *VolatilityWindow) IdentifyVolatileCoins(percentage float64) market.VolatileCoins
IdentifyVolatileCoins returns the coins that have a price change of more than the given percentage. Returns a map of coin symbols and their respective price change percentage over the current time window of the volatilityWindow.
func (*VolatilityWindow) Max ¶
func (h *VolatilityWindow) Max(symbol string) VolatilityWindowRecord
Max returns the record with the highest price for the given coin.
func (*VolatilityWindow) Min ¶
func (h *VolatilityWindow) Min(symbol string) VolatilityWindowRecord
Min returns the record with the lowest price for the given coin.
func (*VolatilityWindow) Size ¶
func (h *VolatilityWindow) Size() int
Size returns the number of records in the volatilityWindow.
type VolatilityWindowRecord ¶
type VolatilityWindowRecord struct {
// contains filtered or unexported fields
}