stats

package
v0.0.0-...-5ed304f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockChart

type BlockChart struct {
	Timestamp        []int64   `json:"timestamp"`
	Value            []float64 `json:"value,omitempty"`
	Difficulty       []float64 `json:"difficulty,omitempty"`
	BlockTime        []float64 `json:"blockTime,omitempty"`
	Hashrate         []float64 `json:"hashrate,omitempty"`
	UncleRate        []float64 `json:"uncleRate,omitempty"`
	Profitability    []float64 `json:"profitability,omitempty"`
	AvgProfitability []float64 `json:"avgProfitability,omitempty"`
	BlockCount       []uint64  `json:"blockCount,omitempty"`
	UncleCount       []uint64  `json:"uncleCount,omitempty"`
	TxCount          []uint64  `json:"txCount,omitempty"`
}

func (*BlockChart) AddPoint

func (chart *BlockChart) AddPoint(block *tsdb.Block)

func (*BlockChart) Len

func (chart *BlockChart) Len() int

func (*BlockChart) Less

func (chart *BlockChart) Less(i, j int) bool

func (*BlockChart) Swap

func (chart *BlockChart) Swap(i, j int)

type ChartSingle

type ChartSingle struct {
	Timestamps []int64              `json:"timestamps"`
	Values     map[string][]float64 `json:"values"`
}

type Client

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

func New

func New(
	pooldbClient, tsdbClient *dbcl.Client,
	redisClient *redis.Client,
	chains []string,
	cacheEnabled bool,
) *Client

func (*Client) GetAllMinerPayouts

func (c *Client) GetAllMinerPayouts(minerIDs uint64) ([]*Payout, error)

func (*Client) GetBlockChart

func (c *Client) GetBlockChart(chain string, period types.PeriodType) (*BlockChart, error)

func (*Client) GetBlockSingleMetricChart

func (c *Client) GetBlockSingleMetricChart(
	metric types.NetworkMetric,
	period types.PeriodType,
	average bool,
) (*ChartSingle, error)

func (*Client) GetGlobalEarningChart

func (c *Client) GetGlobalEarningChart(period types.PeriodType) (*ChartSingle, error)

func (*Client) GetGlobalPayouts

func (c *Client) GetGlobalPayouts(page, size uint64) ([]*Payout, uint64, error)

func (*Client) GetGlobalRounds

func (c *Client) GetGlobalRounds(page, size uint64) ([]*Round, uint64, error)

func (*Client) GetGlobalRoundsByChain

func (c *Client) GetGlobalRoundsByChain(
	chain string,
	page, size uint64,
) ([]*Round, uint64, error)

func (*Client) GetGlobalShareChart

func (c *Client) GetGlobalShareChart(
	chain string,
	period types.PeriodType,
) (*ShareChart, error)

func (*Client) GetGlobalShareSingleMetricChart

func (c *Client) GetGlobalShareSingleMetricChart(
	metric types.ShareMetric,
	period types.PeriodType,
) (*ChartSingle, error)

func (*Client) GetMinerDashboard

func (c *Client) GetMinerDashboard(minerIdx map[uint64]string) (*Dashboard, error)

func (*Client) GetMinerEarningChart

func (c *Client) GetMinerEarningChart(
	minerIDs []uint64,
	metric types.EarningMetric,
	period types.PeriodType,
) (*ChartSingle, error)

func (*Client) GetMinerPayouts

func (c *Client) GetMinerPayouts(
	minerIDs []uint64,
	page, size uint64,
) ([]*Payout, uint64, error)

func (*Client) GetMinerRounds

func (c *Client) GetMinerRounds(
	minerIDs []uint64,
	page, size uint64,
) ([]*Round, uint64, error)

func (*Client) GetMinerShareChart

func (c *Client) GetMinerShareChart(
	minerIDs []uint64,
	chain string,
	period types.PeriodType,
) (*ShareChart, error)

func (*Client) GetMinerShareSingleMetricChart

func (c *Client) GetMinerShareSingleMetricChart(
	minerIDs []uint64,
	metric types.ShareMetric,
	period types.PeriodType,
) (*ChartSingle, error)

func (*Client) GetMiners

func (c *Client) GetMiners(chain string, page, size uint64) ([]*Miner, uint64, error)

func (*Client) GetPoolSummary

func (c *Client) GetPoolSummary(nodes []types.MiningNode) ([]*PoolSummary, error)

func (*Client) GetWorkerDashboard

func (c *Client) GetWorkerDashboard(workerID uint64) (*Dashboard, error)

func (*Client) GetWorkerShareChart

func (c *Client) GetWorkerShareChart(
	workerID uint64,
	chain string,
	period types.PeriodType,
) (*ShareChart, error)

func (*Client) GetWorkerShareSingleMetricChart

func (c *Client) GetWorkerShareSingleMetricChart(
	workerID uint64,
	metric types.ShareMetric,
	period types.PeriodType,
) (*ChartSingle, error)

func (*Client) GetWorkers

func (c *Client) GetWorkers(minerID uint64) (*WorkerList, error)

type Dashboard

type Dashboard struct {
	Miners                  *Number                  `json:"miners,omitempty"`
	ActiveWorkers           *Number                  `json:"activeWorkers,omitempty"`
	InactiveWorkers         *Number                  `json:"inactiveWorkers,omitempty"`
	HashrateInfo            map[string]*HashrateInfo `json:"hashrateInfo"`
	ShareInfo               map[string]*ShareInfo    `json:"shareInfo"`
	ImmatureBalance         map[string]Number        `json:"immatureBalance"`
	PendingBalance          map[string]Number        `json:"pendingBalance"`
	UnpaidBalance           map[string]Number        `json:"unpaidBalance"`
	ProjectedEarningsNative map[string]float64       `json:"projectedEarningsNative"`
	ProjectedEarningsUSD    map[string]float64       `json:"projectedEarningsUsd"`
	ProjectedEarningsBTC    map[string]float64       `json:"projectedEarningsBtc"`
	ProjectedEarningsETH    map[string]float64       `json:"projectedEarningsEth"`
}

type HashrateInfo

type HashrateInfo struct {
	Hashrate    Number `json:"hashrate"`
	AvgHashrate Number `json:"avgHashrate"`
}

type Miner

type Miner struct {
	ID           uint64                   `json:"-"`
	Chain        string                   `json:"chain"`
	Address      string                   `json:"address"`
	Active       bool                     `json:"active"`
	Solo         bool                     `json:"solo"`
	HashrateInfo map[string]*HashrateInfo `json:"hashrateInfo"`
	ShareInfo    map[string]*ShareInfo    `json:"shareInfo"`
	FirstSeen    int64                    `json:"firstSeen"`
	LastSeen     int64                    `json:"lastSeen"`
}

type Number

type Number struct {
	Value     float64 `json:"value"`
	Formatted string  `json:"formatted"`
}

type Payout

type Payout struct {
	Chain        string            `json:"chain"`
	Address      string            `json:"address"`
	TxID         string            `json:"txid"`
	ExplorerURL  string            `json:"explorerUrl"`
	Confirmed    bool              `json:"confirmed"`
	Inputs       map[string]Number `json:"inputs"`
	Value        Number            `json:"value"`
	PoolFees     Number            `json:"poolFees"`
	ExchangeFees Number            `json:"exchangeFees"`
	TxFees       Number            `json:"txFees"`
	TotalFees    Number            `json:"totalFees"`
	Timestamp    int64             `json:"timestamp"`
}

type PoolSummary

type PoolSummary struct {
	Name               string `json:"name"`
	Symbol             string `json:"symbol"`
	Fee                Number `json:"fee"`
	Miners             uint64 `json:"miners"`
	MinersSolo         uint64 `json:"minersSolo"`
	Workers            uint64 `json:"workers"`
	WorkersSolo        uint64 `json:"workersSolo"`
	Hashrate           Number `json:"hashrate"`
	HashrateSolo       Number `json:"hashrateSolo"`
	Luck               Number `json:"luck"`
	LuckSolo           Number `json:"luckSolo"`
	TTF                Number `json:"ttf"`
	TTFSolo            Number `json:"ttfSolo"`
	ProfitUSD          Number `json:"profitUsd"`
	ProfitBTC          Number `json:"profitBtc"`
	NetworkDifficulty  Number `json:"networkDifficulty"`
	NetworkHashrate    Number `json:"networkHashrate"`
	NetworkBlockReward Number `json:"networkBlockReward"`
}

type Round

type Round struct {
	Chain           string  `json:"chain"`
	Type            string  `json:"type"`
	Pool            string  `json:"pool"`
	Pending         bool    `json:"pending"`
	Mature          bool    `json:"mature"`
	Hash            string  `json:"hash"`
	Height          uint64  `json:"height"`
	ExplorerURL     string  `json:"explorerUrl"`
	Miner           *string `json:"miner"`
	Difficulty      Number  `json:"difficulty"`
	Hashrate        Number  `json:"hashrate"`
	Luck            Number  `json:"luck"`
	Value           Number  `json:"value"`
	MinerValue      *Number `json:"minerValue,omitempty"`
	MinerPercentage *Number `json:"minerPercentage,omitempty"`
	Timestamp       int64   `json:"timestamp"`
}

type ShareChart

type ShareChart struct {
	Timestamp      []int64   `json:"timestamp"`
	Miners         []uint64  `json:"miners"`
	Workers        []uint64  `json:"workers"`
	AcceptedShares []uint64  `json:"acceptedShares"`
	RejectedShares []uint64  `json:"rejectedShares"`
	InvalidShares  []uint64  `json:"invalidShares"`
	Hashrate       []float64 `json:"hashrate"`
	AvgHashrate    []float64 `json:"avgHashrate"`
}

func (*ShareChart) AddPoint

func (chart *ShareChart) AddPoint(share *tsdb.Share)

func (*ShareChart) Len

func (chart *ShareChart) Len() int

func (*ShareChart) Less

func (chart *ShareChart) Less(i, j int) bool

func (*ShareChart) Swap

func (chart *ShareChart) Swap(i, j int)

type ShareInfo

type ShareInfo struct {
	AcceptedShares    Number `json:"acceptedShares"`
	AcceptedShareRate Number `json:"acceptedShareRate"`
	RejectedShares    Number `json:"rejectedShares"`
	RejectedShareRate Number `json:"rejectedShareRate"`
	InvalidShares     Number `json:"invalidShares"`
	InvalidShareRate  Number `json:"invalidShareRate"`
}

type Worker

type Worker struct {
	Name           string                   `json:"name"`
	Active         bool                     `json:"active"`
	HashrateInfo   map[string]*HashrateInfo `json:"hashrateInfo"`
	ShareInfo      map[string]*ShareInfo    `json:"shareInfo"`
	LastDifficulty *float64                 `json:"lastDifficulty"`
	FirstSeen      int64                    `json:"firstSeen"`
	LastSeen       int64                    `json:"lastSeen"`
}

type WorkerList

type WorkerList struct {
	Active   []*Worker `json:"active"`
	Inactive []*Worker `json:"inactive"`
}

Jump to

Keyboard shortcuts

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