common

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DatabaseName is the InfluxDB database name to store rates entry.
	DatabaseName = "reserve_rates"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ReserveRateEntry

type ReserveRateEntry struct {
	BuyReserveRate  float64 `json:"buy_reserve_rate"`
	BuySanityRate   float64 `json:"buy_sanity_rate"`
	SellReserveRate float64 `json:"sell_reserve_rate"`
	SellSanityRate  float64 `json:"sell_sanity_rate"`
}

ReserveRateEntry hold 4 float number represent necessary data for a rate entry

func NewReserveRateEntry

func NewReserveRateEntry(reserveRates, sanityRates []*big.Int, index int) ReserveRateEntry

NewReserveRateEntry returns new ReserveRateEntry from results of GetReserveRate method. The reserve rates are stored in following structure: - reserveRate: [sellReserveRate(index: 0)]-[buyReserveRate)(index: 0)]-[sellReserveRate(index: 1)]-[buyReserveRate)(index: 1)]... - sanityRate: [sellSanityRate(index: 0)]-[buySanityRate)(index: 0)]-[sellSanityRate(index: 1)]-[buySanityRate)(index: 1)]...

type ReserveRates

type ReserveRates struct {
	Timestamp time.Time        `json:"timestamp"`
	FromBlock uint64           `json:"from_block"`
	ToBlock   uint64           `json:"to_block"`
	Rates     ReserveRateEntry `json:"rates"`
}

ReserveRates hold all the pairs's rate for a particular reserve and metadata

func (ReserveRates) MarshalJSON

func (rr ReserveRates) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaler for ReserveRates to format timestamp in unix millis instead of RFC3339.

func (*ReserveRates) UnmarshalJSON

func (rr *ReserveRates) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaler for ReserveRates to format timestamp in unix millis instead of RFC3339.

Jump to

Keyboard shortcuts

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