wallet

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskForHelp added in v1.2.0

func AskForHelp(id string, tx interface{}, alreadyAsked []string) []string

func CoinAPISetKey

func CoinAPISetKey(key string) error

func CoinLayerSetKey

func CoinLayerSetKey(key string) error

Types

type CoinAPI

type CoinAPI struct {
}

func (CoinAPI) GetExchangeRates

func (api CoinAPI) GetExchangeRates(date time.Time, native string) (rates ExchangeRates, err error)

type CoinGeckoAPI

type CoinGeckoAPI struct {
	// contains filtered or unexported fields
}

func NewCoinGeckoAPI

func NewCoinGeckoAPI() (*CoinGeckoAPI, error)

func (*CoinGeckoAPI) GetExchangeRates

func (api *CoinGeckoAPI) GetExchangeRates(date time.Time, coin string) (rates ExchangeRates, err error)

type CoinLayer

type CoinLayer struct {
}

func (CoinLayer) GetExchangeRates

func (api CoinLayer) GetExchangeRates(date time.Time, native string) (rates HistoricalData, err error)

type CoinList

type CoinList []CoinsListItem

type CoinsListItem

type CoinsListItem struct {
	ID     string `json:"id"`
	Symbol string `json:"symbol"`
	Name   string `json:"name"`
}

type Currencies

type Currencies []Currency

type Currency

type Currency struct {
	Code   string
	Amount decimal.Decimal
}

func (Currency) GetExchangeRate

func (c Currency) GetExchangeRate(date time.Time, to string) (rate decimal.Decimal, err error)

func (*Currency) IsFiat

func (c *Currency) IsFiat() bool

func (*Currency) Println

func (c *Currency) Println(filter string)

type ExchangeRates

type ExchangeRates struct {
	Base  string `json:"asset_id_base"`
	Rates []Rate `json:"rates"`
}

type HistoricalData

type HistoricalData struct {
	Success    bool               `json:"success"`
	Terms      string             `json:"terms"`
	Privacy    string             `json:"privacy"`
	Timestamp  int                `json:"timestamp"`
	Target     string             `json:"target"`
	Historical bool               `json:"historical"`
	Date       string             `json:"date"`
	Rates      map[string]float64 `json:"rates"`
}

type Nft added in v1.2.0

type Nft struct {
	ID     string
	Name   string
	Symbol string
}

type Nfts added in v1.2.0

type Nfts []Nft

type Rate

type Rate struct {
	Time  time.Time       `json:"time"`
	Quote string          `json:"asset_id_quote"`
	Rate  decimal.Decimal `json:"rate"`
}

type TX

type TX struct {
	Timestamp time.Time
	ID        string
	Source    string
	Category  string
	Items     map[string]Currencies
	Nfts      map[string]Nfts
	Note      string
	// contains filtered or unexported fields
}

func (TX) GetBalances added in v1.1.0

func (tx TX) GetBalances(includeFiat, includeFee bool) (cs WalletCurrencies)

func (TX) Println

func (tx TX) Println(filter string) (printed bool)

func (TX) SameBalances added in v1.2.0

func (tx TX) SameBalances(t TX) bool

func (*TX) SimilarDate

func (tx *TX) SimilarDate(delta time.Duration, t time.Time) bool

type TXs

type TXs []TX

func (TXs) AddFromNativeValue added in v1.2.0

func (txs TXs) AddFromNativeValue(native string) TXs

func (TXs) AddToNativeValue added in v1.4.0

func (txs TXs) AddToNativeValue(native string) TXs

func (TXs) After added in v1.2.0

func (txs TXs) After(date time.Time) TXs

func (TXs) ApplyFromReversal added in v1.2.0

func (txs TXs) ApplyFromReversal() TXs

func (TXs) Before added in v1.2.0

func (txs TXs) Before(date time.Time) TXs

func (TXs) GetBalances added in v1.2.0

func (txs TXs) GetBalances(includeFiat, includeFee bool) (cs WalletCurrencies)

func (TXs) Println

func (txs TXs) Println(name string, filter string)

func (TXs) SortByDate

func (txs TXs) SortByDate(chrono bool)

type TXsByCategory

type TXsByCategory map[string]TXs

func (TXsByCategory) Add

func (txs TXsByCategory) Add(a TXsByCategory)

func (TXsByCategory) AddUniq added in v1.2.0

func (txs TXsByCategory) AddUniq(a TXsByCategory)

func (TXsByCategory) CheckConsistency

func (txs TXsByCategory) CheckConsistency(loc *time.Location)

func (TXsByCategory) FindCashInOut

func (txs TXsByCategory) FindCashInOut(native string)

func (TXsByCategory) FindTransfers

func (txs TXsByCategory) FindTransfers(cat category.Category) TXsByCategory

func (TXsByCategory) GetCoinsList added in v1.2.0

func (txs TXsByCategory) GetCoinsList(includeFiat bool) (coins []string)

func (TXsByCategory) GetWallets

func (txs TXsByCategory) GetWallets(date time.Time, includeFiat bool, rounding bool) (w Wallets)

func (TXsByCategory) PrintStats

func (txs TXsByCategory) PrintStats(native string)

func (TXsByCategory) Println

func (txs TXsByCategory) Println(filter string)

func (TXsByCategory) RemoveDelistedCoins added in v1.2.0

func (txs TXsByCategory) RemoveDelistedCoins(coin string)

func (TXsByCategory) SortByDate added in v1.3.0

func (txs TXsByCategory) SortByDate(chrono bool)

func (TXsByCategory) StockToXlsx added in v1.2.0

func (txs TXsByCategory) StockToXlsx(filename string)

type WalletCurrencies

type WalletCurrencies map[string]decimal.Decimal

func (WalletCurrencies) Add

type Wallets

type Wallets struct {
	Date       time.Time
	Currencies WalletCurrencies
	Nfts       Nfts
}

func (Wallets) CalculateTotalValue

func (w Wallets) CalculateTotalValue(native string) (totalValue Currency, err error)

func (Wallets) Println

func (w Wallets) Println(name string, filter string)

func (Wallets) Round

func (w Wallets) Round(rounding bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL