ethplorer

package
v0.0.184 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FREE_KEY = "freekey"
	API_BASE = "http://api.ethplorer.io"
)

Variables

View Source
var (
	BeforeRequest func(apiKey, path string) error = nil
	AfterRequest  func()                          = nil
)
View Source
var CriteriaString = map[Criteria]string{
	ByTradeVolume:    "trade",
	ByCapitalization: "cap",
	ByOperations:     "count",
}

Functions

func RequestsPerSecond

func RequestsPerSecond(apiKey string) float64

Types

type Client

type Client struct {
	Key string
}

func New

func New(apiKey string) *Client

func (*Client) GetTop

func (client *Client) GetTop(sort Criteria) ([]Top, error)

type Criteria

type Criteria int
const (
	ByTradeVolume Criteria = iota
	ByCapitalization
	ByOperations
)

func NewCriteria

func NewCriteria(data string) Criteria

func (*Criteria) String

func (c *Criteria) String() string

type Price

type Price struct {
	Rate interface{} `json:"rate"`
	Diff float64     `json:"diff"`
}

func (*Price) ParseRate

func (price *Price) ParseRate() float64

type Token

type Token struct {
	Address string `json:"address"`
	Name    string `json:"name"`
	Symbol  string `json:"symbol"`
	Price   Price  `json:"price"`
}

type Top

type Top struct {
	*Token
	VolumeCurrent  interface{} `json:"volume-1d-current"`
	VolumePrevious interface{} `json:"volume-1d-previous"`
}

func (*Top) Buy

func (top *Top) Buy(volumeDiff float64) bool

func (*Top) ParseVolumeCurrent

func (top *Top) ParseVolumeCurrent() float64

func (*Top) ParseVolumePrevious

func (top *Top) ParseVolumePrevious() float64

func (*Top) VolumeDiff

func (top *Top) VolumeDiff() float64

Jump to

Keyboard shortcuts

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