Documentation ¶
Index ¶
- Variables
- func IsValidAsset(asset string) bool
- type Asset
- type Database
- func (d *Database) AutoMigrate() error
- func (d *Database) Close() error
- func (d *Database) GetAllPrices(asset string) ([]*Price, error)
- func (d *Database) LastPrice(asset string) (float64, error)
- func (d *Database) LastTotalSupply(asset string) (float64, error)
- func (d *Database) LastValueLocked(pool string) (float64, error)
- func (d *Database) PriceAvgInRange(asset string, windowInDays int) (float64, error)
- func (d *Database) PriceChangeInRange(asset string, windowInDays int) (float64, error)
- func (d *Database) PricesInRange(asset string, windowInDays int) ([]*Price, error)
- func (d *Database) RecordPrice(asset string, price float64) error
- func (d *Database) RecordTotalSupply(asset string, supply float64) error
- func (d *Database) RecordValueLocked(pool string, locked float64) error
- type Model
- type Opts
- type Price
- type TotalSupply
- type TotalValueLocked
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsValidAsset ¶
IsValidAsset determines whether or not the given asset is one we are tracking
Types ¶
type Asset ¶
type Asset string
Asset is a given crypto asset tracked by it's Ticker symbol
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) AutoMigrate ¶
AutoMigrate is used to automatically migrate datbase tables
func (*Database) GetAllPrices ¶
GetAllPrices returns all price entries for a given asset
func (*Database) LastTotalSupply ¶ added in v0.0.17
LastTotalSupply returns the last recorded total supply for an asset
func (*Database) LastValueLocked ¶ added in v0.0.15
LastValueLocked returns the latest record total value locked entry
func (*Database) PriceAvgInRange ¶
PriceAvgInRange returns the average price of the given asset during the last N days
func (*Database) PriceChangeInRange ¶
PriceChangeInRange returns the price change percentage in the last N days
func (*Database) PricesInRange ¶ added in v0.0.14
PricesInRange returns all prices items in the given range
func (*Database) RecordPrice ¶
RecordPrice records the given asset price in the database
func (*Database) RecordTotalSupply ¶ added in v0.0.17
RecordTotalSupply is used to record the supply for an asset
type Model ¶ added in v0.0.17
type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time // `gorm:"index"` // this is changed to include the index UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
Model is a copy of the gorm model type but using slightly different configurations
type Opts ¶
type Opts struct { Type string Host string Port string User string Password string DBName string DBPath string SSLModeDisable bool }
Opts is used to configure database connections
type TotalSupply ¶ added in v0.0.17
TotalSupply is used to track the total supply of a given asset
type TotalValueLocked ¶ added in v0.0.15
TotalValueLocked records the USD value of funds locked within index pool