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 trade events.
	DatabaseName = "trade_logs"
	// UnknownCountry is the special code for unknown country queries
	UnknownCountry = "UNKNOWN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BurnFee

type BurnFee struct {
	ReserveAddress ethereum.Address `json:"reserve_addr"`
	Amount         *big.Int         `json:"amount"`
	Index          uint             `json:"index"` // the index of event log in transaction receipt
}

BurnFee represent burnFee event on KyberNetwork

type CountryStats

type CountryStats struct {
	TotalETHVolume     float64 `json:"total_eth_volume"`
	TotalUSDVolume     float64 `json:"total_usd_volume"`
	TotalBurnFee       float64 `json:"total_burn_fee"`
	TotalTrade         uint64  `json:"total_trade"`
	UniqueAddresses    uint64  `json:"unique_addresses"`
	KYCEDAddresses     uint64  `json:"kyced_addresses"`
	NewUniqueAddresses uint64  `json:"new_unique_addresses"`
	USDPerTrade        float64 `json:"usd_per_trade"`
	ETHPerTrade        float64 `json:"eth_per_trade"`
}

CountryStats stats for a country a day

type Heatmap

type Heatmap struct {
	Country              string  `json:"country"`
	TotalETHValue        float64 `json:"total_eth_value"`
	TotalTokenValue      float64 `json:"total_token_value"`
	TotalFiatValue       float64 `json:"total_fiat_value"`
	ToTalBurnFee         float64 `json:"total_burn_fee"`
	TotalTrade           int64   `json:"total_trade"`
	TotalUniqueAddresses int64   `json:"total_unique_addr"`
	TotalKYCUser         int64   `json:"total_kyc_user"`
}

Heatmap represent a country heatmap

type IntegrationVolume

type IntegrationVolume struct {
	KyberSwapVolume    float64 `json:"kyber_swap_volume"`
	NonKyberSwapVolume float64 `json:"non_kyber_swap_volume"`
}

IntegrationVolume represent kyberSwap and non kyberswap volume

type TradeLog

type TradeLog struct {
	Timestamp       time.Time     `json:"timestamp"`
	BlockNumber     uint64        `json:"block_number"`
	TransactionHash ethereum.Hash `json:"tx_hash"`

	EtherReceivalSender ethereum.Address `json:"eth_receival_sender"`
	EtherReceivalAmount *big.Int         `json:"eth_receival_amount"`

	UserAddress ethereum.Address `json:"user_addr"`
	SrcAddress  ethereum.Address `json:"src_addr"`
	DestAddress ethereum.Address `json:"dst_addr"`
	SrcAmount   *big.Int         `json:"src_amount"`
	DestAmount  *big.Int         `json:"dst_amount"`
	FiatAmount  float64          `json:"fiat_amount"`

	BurnFees       []BurnFee   `json:"burn_fees"`
	WalletFees     []WalletFee `json:"wallet_fees"`
	IntegrationApp string      `json:"integration_app"`

	IP      string `json:"ip"`
	Country string `json:"country"`

	ETHUSDRate     float64 `json:"-"`
	ETHUSDProvider string  `json:"-"`

	UserName  string `json:"user_name"`
	ProfileID int64  `json:"profile_id"`
	Index     uint   `json:"index"` // the index of event log in transaction receipt
}

TradeLog represent trade event on KyberNetwork

func (TradeLog) IsKyberSwap

func (tl TradeLog) IsKyberSwap() bool

IsKyberSwap determine if the tradelog is through KyberSwap

func (*TradeLog) MarshalJSON

func (tl *TradeLog) MarshalJSON() ([]byte, error)

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

type TradeSummary

type TradeSummary struct {
	ETHVolume          float64 `json:"eth_volume"`
	USDAmount          float64 `json:"usd_volume"`
	TotalBurnFee       float64 `json:"burn_fee"`
	TotalTrade         uint64  `json:"total_trade"`
	UniqueAddresses    uint64  `json:"unique_addresses"`
	KYCEDAddresses     uint64  `json:"kyced_addresses"`
	NewUniqueAddresses uint64  `json:"new_unique_addresses"`
	USDPerTrade        float64 `json:"usd_per_trade"`
	ETHPerTrade        float64 `json:"eth_per_trade"`
}

TradeSummary struct holds all the fields required for trade summary

type UserInfo

type UserInfo struct {
	Addr      string  `json:"user_address"`
	ETHVolume float64 `json:"total_eth_volume"`
	USDVolume float64 `json:"total_usd_volume"`
}

UserInfo represent trade stats of an address

type UserList

type UserList []UserInfo

UserList - list of user

func (UserList) Len

func (u UserList) Len() int

Len length of user list for sorting function

func (UserList) Less

func (u UserList) Less(i, j int) bool

Less for sorting function

func (UserList) Swap

func (u UserList) Swap(i, j int)

Swap swap 2 item of user list

type UserVolume

type UserVolume struct {
	ETHAmount float64 `json:"eth_amount"`
	USDAmount float64 `json:"usd_amount"`
}

UserVolume represent volume of an user from time to time

type VolumeStats

type VolumeStats struct {
	ETHAmount float64 `json:"eth_amount"`
	USDAmount float64 `json:"usd_amount"`
	Volume    float64 `json:"volume"`
}

VolumeStats struct holds all the volume fields of volume in a specfic time

type WalletFee

type WalletFee struct {
	ReserveAddress ethereum.Address `json:"reserve_addr"`
	WalletAddress  ethereum.Address `json:"wallet_addr"`
	Amount         *big.Int         `json:"amount"`
	Index          uint             `json:"index"` // the index of event log in transaction receipt
}

WalletFee represent feeToWallet event on KyberNetwork

type WalletStats

type WalletStats struct {
	ETHVolume          float64 `json:"eth_volume"`
	USDVolume          float64 `json:"usd_volume"`
	BurnFee            float64 `json:"burn_fee"`
	TotalTrade         int64   `json:"total_trade"`
	UniqueAddresses    int64   `json:"unique_addresses"`
	KYCEDAddresses     int64   `json:"kyced_addresses"`
	NewUniqueAddresses int64   `json:"new_unique_addresses"`
	USDPerTrade        float64 `json:"usd_per_trade"`
	ETHPerTrade        float64 `json:"eth_per_trade"`
}

WalletStats represent stat for a wallet address

Jump to

Keyboard shortcuts

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