Documentation ¶
Index ¶
Constants ¶
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.