Documentation
¶
Index ¶
- func GetTestDbPath() string
- type Balance
- type BalanceQueryOptions
- type Balances
- func (b Balances) BalanceChange(id string, days int) float64
- func (b Balances) ClosestSample(duration time.Duration) Balances
- func (b Balances) ClosestSampleTuple(start time.Duration, end time.Duration) Balances
- func (b Balances) Entries() []Balance
- func (b Balances) FiatValueChange(token string, days int) float64
- func (b Balances) FilterByWallet(name string) Balances
- func (b Balances) FilterId(id string) Balances
- func (b Balances) FilterToken(token string) Balances
- func (b Balances) FilterTokens(tokens []string) Balances
- func (b Balances) GetTimeSeries(amount int, interval time.Duration) []Balances
- func (b Balances) GroupBySymbol() Balances
- func (b Balances) LastSample() Balances
- func (b Balances) PricePerTokenChange(token string, days int) float64
- func (b Balances) TokenBalance(token string) float64
- func (b Balances) Tokens() []string
- func (b Balances) TotalFiatValue() float64
- func (b Balances) TotalFiatValueChange(days int) float64
- func (b Balances) Wallets() []string
- type Db
- type TokenBalance
- type TokenPrice
- type TokenPrices
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTestDbPath ¶
func GetTestDbPath() string
Types ¶
type Balance ¶
type Balance struct {
Timestamp time.Time `db:"ts" json:"timestamp"`
Wallet string `db:"wallet" json:"wallet"`
Token string `db:"token" json:"token"`
Address string `db:"address" json:"address"`
Balance float64 `db:"balance" json:"balance"`
BalanceLocked float64 `db:"balance_locked" json:"balance_locked"`
FiatValue float64 `db:"fiat_value" json:"fiat_value"`
}
func (Balance) PricePerToken ¶
PricePerToken returns price per token in fiat value
type BalanceQueryOptions ¶
type BalanceQueryOptions struct {
Days int
}
type Balances ¶
type Balances struct {
// contains filtered or unexported fields
}
func (Balances) BalanceChange ¶
BalanceChange will return change for balance with given id in pct (-1.0 to 1.0) between now and x days ago
func (Balances) ClosestSample ¶
ClosestSample will find the sample closes to duration from now
func (Balances) ClosestSampleTuple ¶
ClosestSampleTuple return 2 samples between start and end
func (Balances) FiatValueChange ¶
FiatValueChange will return fiat value change in pct (-1.0 to 1.0) between now and x days ago for token
func (Balances) FilterByWallet ¶
func (Balances) FilterToken ¶
FilterToken will return entries filtered by token
func (Balances) FilterTokens ¶ added in v0.0.14
FilterTokens will return entries filtered by tokens
func (Balances) GetTimeSeries ¶
GetTimeSeries will return a set of balances over a given amount of intervals
func (Balances) GroupBySymbol ¶
GroupBySymbol will group values by symbol
func (Balances) LastSample ¶
LastSample will return the last sample
func (Balances) PricePerTokenChange ¶
PricePerTokenChange will return token price value change in pct (-1.0 to 1.0) between now and x days ago for token
func (Balances) TokenBalance ¶ added in v0.0.20
func (Balances) TotalFiatValue ¶
func (Balances) TotalFiatValueChange ¶
TotalFiatValueChange will return total fiat value change in pct (-1.0 to 1.0) between now and x days ago
type Db ¶
type Db struct {
// contains filtered or unexported fields
}
func (*Db) GetBalances ¶
func (d *Db) GetBalances(options BalanceQueryOptions) (Balances, error)
func (*Db) GetBalancesFromDate ¶ added in v0.0.26
func (*Db) InsertBalance ¶
type TokenBalance ¶
type TokenPrice ¶
type TokenPrices ¶
type TokenPrices struct {
Entries []TokenPrice
}
func (*TokenPrices) GetPrice ¶
func (tp *TokenPrices) GetPrice(token string) float64
GetPrice returns price for a given token or 0 if not found