storage

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfluxStorage

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

InfluxStorage represent a client to store trade data to influx DB

func NewInfluxStorage

func NewInfluxStorage(sugar *zap.SugaredLogger, dbName string, influxClient client.Client,
	coreClient core.Interface, kycChecker kycChecker) (*InfluxStorage, error)

NewInfluxStorage init an instance of InfluxStorage

func (*InfluxStorage) GetAggregatedBurnFee

func (is *InfluxStorage) GetAggregatedBurnFee(from, to time.Time, freq string, reserveAddrs []ethereum.Address) (map[ethereum.Address]map[string]float64, error)

GetAggregatedBurnFee get aggregated burn fee in a time range given the reserve address

func (*InfluxStorage) GetAggregatedWalletFee

func (is *InfluxStorage) GetAggregatedWalletFee(reserveAddr, walletAddr, freq string,
	fromTime, toTime time.Time, timezone int8) (map[uint64]float64, error)

GetAggregatedWalletFee return wallet fee follow by provided reserve address, wallet address, from time, to time frequency (hour, day) and timezone daily_wallet_fee and hourly_wallet_fee measurement is calculate by CQ

func (*InfluxStorage) GetAssetVolume

func (is *InfluxStorage) GetAssetVolume(token core.Token, fromTime, toTime time.Time,
	frequency string) (map[uint64]*common.VolumeStats, error)

GetAssetVolume returns the volume of a specific assset(token) between a period and with desired frequency

func (*InfluxStorage) GetCountryStats

func (is *InfluxStorage) GetCountryStats(countryCode string, from, to time.Time, timezone int8) (map[uint64]*common.CountryStats, error)

GetCountryStats return stats of a country from time to time by daily fred in provided timezone

func (*InfluxStorage) GetIntegrationVolume

func (is *InfluxStorage) GetIntegrationVolume(fromTime, toTime time.Time) (map[uint64]*common.IntegrationVolume, error)

GetIntegrationVolume returns the volume of non-kyberSwap and kyberSwap volume in ETH between a period

func (*InfluxStorage) GetReserveVolume

func (is *InfluxStorage) GetReserveVolume(rsvAddr ethereum.Address, token core.Token,
	fromTime, toTime time.Time, frequency string) (map[uint64]*common.VolumeStats, error)

GetReserveVolume returns the volume of a specific asset(token) from a reserve between a period and with desired frequency

func (*InfluxStorage) GetTokenHeatmap

func (is *InfluxStorage) GetTokenHeatmap(asset core.Token, from, to time.Time, timezone int8) (map[string]common.Heatmap, error)

GetTokenHeatmap return list ordered country by asset volume

func (*InfluxStorage) GetTradeSummary

func (is *InfluxStorage) GetTradeSummary(from, to time.Time, timezone int8) (map[uint64]*common.TradeSummary, error)

GetTradeSummary return an incompleted tradeSummary for the specified time periods

func (*InfluxStorage) GetUserList

func (is *InfluxStorage) GetUserList(fromTime, toTime time.Time, timezone int8) ([]common.UserInfo, error)

GetUserList return list of user info

func (*InfluxStorage) GetUserVolume

func (is *InfluxStorage) GetUserVolume(userAddress ethereum.Address, from, to time.Time, freq string) (map[uint64]common.UserVolume, error)

GetUserVolume return volume of an address from time to time by a frequency

func (*InfluxStorage) GetWalletStats

func (is *InfluxStorage) GetWalletStats(from, to time.Time, walletAddr string, timezone int8) (map[uint64]common.WalletStats, error)

GetWalletStats return stats of a wallet address from time to time by a frequency

func (InfluxStorage) LastBlock

func (is InfluxStorage) LastBlock() (int64, error)

LastBlock returns last stored trade log block number from database.

func (*InfluxStorage) LoadTradeLogs

func (is *InfluxStorage) LoadTradeLogs(from, to time.Time) ([]common.TradeLog, error)

LoadTradeLogs return trade logs from DB

func (*InfluxStorage) SaveTradeLogs

func (is *InfluxStorage) SaveTradeLogs(logs []common.TradeLog) error

SaveTradeLogs persist trade logs to DB

type Interface

type Interface interface {
	LastBlock() (int64, error)
	SaveTradeLogs(logs []common.TradeLog) error
	LoadTradeLogs(from, to time.Time) ([]common.TradeLog, error)
	GetAggregatedBurnFee(from, to time.Time, freq string, reserveAddrs []ethereum.Address) (map[ethereum.Address]map[string]float64, error)
	GetAssetVolume(token core.Token, fromTime, toTime time.Time, frequency string) (map[uint64]*common.VolumeStats, error)
	GetReserveVolume(rsvAddr ethereum.Address, token core.Token, fromTime, toTime time.Time, frequency string) (map[uint64]*common.VolumeStats, error)
	GetAggregatedWalletFee(reserveAddr, walletAddr, freq string,
		fromTime, toTime time.Time, timezone int8) (map[uint64]float64, error)
	GetTradeSummary(from, to time.Time, timezone int8) (map[uint64]*common.TradeSummary, error)
	GetUserVolume(userAddr ethereum.Address, from, to time.Time, freq string) (map[uint64]common.UserVolume, error)
	GetUserList(from, to time.Time, timezone int8) ([]common.UserInfo, error)
	GetWalletStats(fromTime, toTime time.Time, walletAddr string, timezone int8) (map[uint64]common.WalletStats, error)
	GetCountryStats(countryCode string, from, to time.Time, timezone int8) (map[uint64]*common.CountryStats, error)
	GetTokenHeatmap(asset core.Token, from, to time.Time, timezone int8) (map[string]common.Heatmap, error)
	GetIntegrationVolume(fromTime, toTime time.Time) (map[uint64]*common.IntegrationVolume, error)
}

Interface represent a storage for TradeLogs data

type UserKYCChecker

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

UserKYCChecker is an implementation of kycChecker interface that read the KYC status from users database.

func NewUserKYCChecker

func NewUserKYCChecker(sugar *zap.SugaredLogger, db *sqlx.DB) *UserKYCChecker

NewUserKYCChecker creates a new instance of UserKYCChecker.

func (*UserKYCChecker) IsKYCed

func (c *UserKYCChecker) IsKYCed(userAddr common.Address, ts time.Time) (bool, error)

IsKYCed returns true if user is already KYCed at the given timestamp.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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