Documentation ¶
Index ¶
- Constants
- func GetCryptoIDAddress(address string, coinType string) (float64, error)
- func StartPortfolioWatcher()
- type Address
- type Base
- func (p *Base) AddAddress(address, coinType, description string, balance float64)
- func (p *Base) AddExchangeAddress(exchangeName, coinType string, balance float64)
- func (p *Base) AddressExists(address string) bool
- func (p *Base) ExchangeAddressExists(exchangeName, coinType string) bool
- func (p *Base) ExchangeExists(exchangeName string) bool
- func (p *Base) GetAddressBalance(address, coinType, description string) (float64, bool)
- func (p *Base) GetExchangePortfolio() map[string]float64
- func (p *Base) GetPersonalPortfolio() map[string]float64
- func (p *Base) GetPortfolioByExchange(exchangeName string) map[string]float64
- func (p *Base) GetPortfolioGroupedCoin() map[string][]string
- func (p *Base) GetPortfolioSummary() Summary
- func (p *Base) RemoveAddress(address, coinType, description string)
- func (p *Base) RemoveExchangeAddress(exchangeName, coinType string)
- func (p *Base) SeedPortfolio(port Base)
- func (p *Base) UpdateAddressBalance(address string, amount float64)
- func (p *Base) UpdateExchangeAddressBalance(exchangeName, coinType string, balance float64)
- func (p *Base) UpdatePortfolio(addresses []string, coinType string) bool
- type Coin
- type EtherchainBalanceResponse
- type EthplorerResponse
- type ExchangeAccountCurrencyInfo
- type ExchangeAccountInfo
- type OfflineCoinSummary
- type OnlineCoinSummary
- type Summary
Constants ¶
const ( // PortfolioAddressExchange is a label for an exchange address PortfolioAddressExchange = "Exchange" // PortfolioAddressPersonal is a label for a personal/offline address PortfolioAddressPersonal = "Personal" )
Variables ¶
This section is empty.
Functions ¶
func GetCryptoIDAddress ¶
GetCryptoIDAddress queries CryptoID for an address balance for a specified cryptocurrency
func StartPortfolioWatcher ¶
func StartPortfolioWatcher()
StartPortfolioWatcher observes the portfolio object
Types ¶
type Base ¶
type Base struct {
Addresses []Address
}
Base holds the portfolio base addresses
var Portfolio Base
Portfolio is variable store holding an array of portfolioAddress
func (*Base) AddAddress ¶
AddAddress adds an address to the portfolio base
func (*Base) AddExchangeAddress ¶
AddExchangeAddress adds an exchange address to the portfolio base
func (*Base) AddressExists ¶
AddressExists checks to see if there is an address associated with the portfolio base
func (*Base) ExchangeAddressExists ¶
ExchangeAddressExists checks to see if there is an exchange address associated with the portfolio base
func (*Base) ExchangeExists ¶
ExchangeExists checks to see if an exchange exists in the portfolio base
func (*Base) GetAddressBalance ¶
GetAddressBalance acceses the portfolio base and returns the balance by passed in address, coin type and description
func (*Base) GetExchangePortfolio ¶
GetExchangePortfolio returns current portfolio base information
func (*Base) GetPersonalPortfolio ¶
GetPersonalPortfolio returns current portfolio base information
func (*Base) GetPortfolioByExchange ¶
GetPortfolioByExchange returns currency portfolio amount by exchange
func (*Base) GetPortfolioGroupedCoin ¶
GetPortfolioGroupedCoin returns portfolio base information grouped by coin
func (*Base) GetPortfolioSummary ¶
GetPortfolioSummary returns the complete portfolio summary, showing coin totals, offline and online summaries with their relative percentages.
func (*Base) RemoveAddress ¶
RemoveAddress removes an address when checked against the correct address and coinType
func (*Base) RemoveExchangeAddress ¶
RemoveExchangeAddress removes an exchange address from the portfolio.
func (*Base) SeedPortfolio ¶
SeedPortfolio appends a portfolio base object with another base portfolio addresses
func (*Base) UpdateAddressBalance ¶
UpdateAddressBalance updates the portfolio base balance
func (*Base) UpdateExchangeAddressBalance ¶
UpdateExchangeAddressBalance updates the portfolio balance when checked against correct exchangeName and coinType.
type Coin ¶
type Coin struct { Coin string `json:"coin"` Balance float64 `json:"balance"` Address string `json:"address,omitempty"` Percentage float64 `json:"percentage,omitempty"` }
Coin stores a coin type, balance, address and percentage relative to the total amount.
type EtherchainBalanceResponse ¶
type EtherchainBalanceResponse struct { Status int `json:"status"` Data []struct { Address string `json:"address"` Balance float64 `json:"balance"` Nonce interface{} `json:"nonce"` Code string `json:"code"` Name interface{} `json:"name"` Storage interface{} `json:"storage"` FirstSeen interface{} `json:"firstSeen"` } `json:"data"` }
EtherchainBalanceResponse holds JSON incoming and outgoing data for Etherchain
type EthplorerResponse ¶
type EthplorerResponse struct { Address string `json:"address"` ETH struct { Balance float64 `json:"balance"` TotalIn float64 `json:"totalIn"` TotalOut float64 `json:"totalOut"` } `json:"ETH"` CountTxs int `json:"countTxs"` ContractInfo struct { CreatorAddress string `json:"creatorAddress"` TransactionHash string `json:"transactionHash"` Timestamp int `json:"timestamp"` } `json:"contractInfo"` TokenInfo struct { Address string `json:"address"` Name string `json:"name"` Decimals int `json:"decimals"` Symbol string `json:"symbol"` TotalSupply string `json:"totalSupply"` Owner string `json:"owner"` LastUpdated int `json:"lastUpdated"` TotalIn int64 `json:"totalIn"` TotalOut int64 `json:"totalOut"` IssuancesCount int `json:"issuancesCount"` HoldersCount int `json:"holdersCount"` Image string `json:"image"` Description string `json:"description"` Price struct { Rate int `json:"rate"` Diff int `json:"diff"` Ts int `json:"ts"` Currency string `json:"currency"` } `json:"price"` } `json:"tokenInfo"` Error struct { Code int `json:"code"` Message string `json:"message"` } `json:"error"` }
EthplorerResponse holds JSON address data for Ethplorer
func GetEthereumBalance ¶
func GetEthereumBalance(address string) (EthplorerResponse, error)
GetEthereumBalance single or multiple address information as EtherchainBalanceResponse
type ExchangeAccountCurrencyInfo ¶
ExchangeAccountCurrencyInfo : Sub type to store currency name and value
type ExchangeAccountInfo ¶
type ExchangeAccountInfo struct { ExchangeName string Currencies []ExchangeAccountCurrencyInfo }
ExchangeAccountInfo : Generic type to hold each exchange's holdings in all enabled currencies
type OfflineCoinSummary ¶
type OfflineCoinSummary struct { Address string `json:"address"` Balance float64 `json:"balance"` Percentage float64 `json:"percentage,omitempty"` }
OfflineCoinSummary stores a coin types address, balance and percentage relative to the total amount.
type OnlineCoinSummary ¶
type OnlineCoinSummary struct { Balance float64 `json:"balance"` Percentage float64 `json:"percentage,omitempty"` }
OnlineCoinSummary stores a coin types balance and percentage relative to the total amount.
type Summary ¶
type Summary struct { Totals []Coin `json:"coin_totals"` Offline []Coin `json:"coins_offline"` OfflineSummary map[string][]OfflineCoinSummary `json:"offline_summary"` Online []Coin `json:"coins_online"` OnlineSummary map[string]map[string]OnlineCoinSummary `json:"online_summary"` }
Summary Stores the entire portfolio summary