ethgas

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: LGPL-3.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MIN_GAS_PRICE = uint64(1e9)

Variables

This section is empty.

Functions

This section is empty.

Types

type EMA

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

EMA is a moving average with exponential decay. It doesn't have any concept of weight so it will only work on homogenous (evenly spaced) time series. ema := NewEMA(0.1818) avg1 = ema.Tick(price1) avg2 = ema.Tick(price2) spike := checkPriceMovingAvg(price, avg, 20%)

func NewEMA

func NewEMA(decay float64) *EMA

NewEMA(decay) returns a new exponential moving average. It weighs new values more than existing values according to the decay. For example: NewEMA(0.05) would give 5% weight to the present and 95% weight to the past. Common to use 2/(selected time period+1).

func (*EMA) Tick

func (ema *EMA) Tick(price *big.Int) *big.Int

func (*EMA) Value

func (ema *EMA) Value() *big.Int

type GasGauge

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

func NewGasGauge

func NewGasGauge(log util.Logger, monitor *ethmonitor.Monitor) (*GasGauge, error)

func (*GasGauge) IsRunning added in v1.6.1

func (g *GasGauge) IsRunning() bool

func (*GasGauge) Run added in v1.6.1

func (g *GasGauge) Run(ctx context.Context) error

func (*GasGauge) Stop

func (g *GasGauge) Stop()

func (*GasGauge) Subscribe

func (g *GasGauge) Subscribe() ethmonitor.Subscription

func (*GasGauge) SuggestedGasPrice

func (g *GasGauge) SuggestedGasPrice() SuggestedGasPrice

func (*GasGauge) WaitSuggestedGasPrice

func (g *GasGauge) WaitSuggestedGasPrice() SuggestedGasPrice

type SuggestedGasPrice

type SuggestedGasPrice struct {
	Instant  uint64 `json:"instant"` // in gwei
	Fast     uint64 `json:"fast"`
	Standard uint64 `json:"standard"`
	Slow     uint64 `json:"slow"`

	BlockNum  *big.Int `json:"blockNum"`
	BlockTime uint64   `json:"blockTime"`
}

Jump to

Keyboard shortcuts

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