models

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiTrade added in v1.6.2

type ApiTrade struct {
	Tx               string    `ch:"tx" json:"tx"`
	Date             time.Time `ch:"date" json:"date"`
	Timestamp        uint32    `ch:"timestamp" json:"timestamp"`
	Chain            string    `ch:"chain" json:"chain"`
	Blocknumber      uint64    `ch:"blocknumber" json:"blocknumber"`
	Pair             string    `ch:"pair" json:"pair"`
	Amount0          string    `ch:"amount0" json:"amount0"`
	Amount1          string    `ch:"amount1" json:"amount1"`
	Buy              uint8     `ch:"buy" json:"buy"`
	PriceA           float32   `ch:"pricea" json:"price_a"`
	PriceAUSD        float32   `ch:"pricea_usd" json:"price_a_usd"`
	PriceB           float32   `ch:"priceb" json:"price_b"`
	PriceBUSD        float32   `ch:"priceb_usd" json:"price_b_usd"`
	Bot              uint8     `ch:"bot" json:"bot"`
	Wallet           string    `ch:"wallet" json:"wallet"`
	Order            uint16    `ch:"order" json:"order"`
	ValueUsd         float32   `ch:"value_usd" json:"value_usd"`
	Ticker           any       `json:"ticker,omitempty"`
	WalletTags       []string  `json:"wallet_tags"`
	IsProxyTrade     bool      `ch:"-" json:"is_proxy_trade"`
	TotalTradesCount uint32    `ch:"-" json:"total_trades_count"`
	PairTradesCount  uint32    `ch:"-" json:"pair_trades_count"`
	Klass            string    `ch:"" json:"klass"`
	Reserve0         string    `ch:"-" json:"reverse0"`
	Reserve1         string    `ch:"-" json:"reverse1"`
	ReserveUSD       string    `ch:"-" json:"reverse_usd"`
	ValidTill        int64     `ch:"-" json:"valid_till"`
}

*

  • Actually this should be a PairSwap

Trade example

func (*ApiTrade) Marshal added in v1.6.2

func (t *ApiTrade) Marshal() ([]byte, error)

func (*ApiTrade) Pack added in v1.6.2

func (t *ApiTrade) Pack() *storage.ApiTrade

func (*ApiTrade) UnMarshal added in v1.6.2

func (t *ApiTrade) UnMarshal(buf []byte) error

func (*ApiTrade) Unpack added in v1.6.2

func (t *ApiTrade) Unpack(data *storage.ApiTrade) *ApiTrade

type ApiTradesBlock added in v1.6.2

type ApiTradesBlock struct {
	Trades []*ApiTrade `json:"trades"`
}

func (*ApiTradesBlock) Marshal added in v1.6.2

func (tb *ApiTradesBlock) Marshal() ([]byte, error)

func (*ApiTradesBlock) UnMarshal added in v1.6.2

func (tb *ApiTradesBlock) UnMarshal(buf []byte) error

type Block

type Block struct {
	Type         string         `json:"type"`
	Network      string         `json:"network"`
	Number       *big.Int       `json:"number"`
	Node         string         `json:"node"`
	Notify       bool           `json:"notify"`
	Timestamp    uint64         `json:"timestamp"`
	Empty        bool           `json:"empty"`
	Transactions []*Transaction `json:"transactions,omitempty"`
	Logs         []types.Log    `json:"logs,omitempty"`
	Part         uint8          `json:"-"`

	// block trace
	DiscoveredAt       int64 `json:"discovered_at"`
	ReceivedInParserAt int64 `json:"received_in_parser_at"`
	ParsedAt           int64 `json:"parsed_at"`
	ConsumedAt         int64 `json:"consumed_at"`
	LiveSendAt         int64 `json:"live_send_at"`
}

func (*Block) Marshal added in v1.5.0

func (b *Block) Marshal() ([]byte, error)

func (*Block) UnMarshal added in v1.5.0

func (b *Block) UnMarshal(buf []byte) error

type BlockState

type BlockState struct {
	DirectSwaps []*DirectSwap     `json:"direct_swaps"`
	PairSwaps   []*PairSwap       `json:"pair_swaps"`
	Liquidities []*LiquidityEvent `json:"liquidity_events"`
	Transfers   []*TransferEvent  `json:"transfer_events"`
	Pairs       []*NewPair        `json:"new_pairs"`
	Holders     []*Holder         `json:"holders"`
	DexeEvents  []*CustomEvent    `json:"dexe_events"`
	Block       *Block            `json:"block"`
}

func (*BlockState) Marshal added in v1.5.0

func (b *BlockState) Marshal() ([]byte, error)

func (*BlockState) UnMarshal added in v1.5.0

func (b *BlockState) UnMarshal(buf []byte) error

type CexPriceUpdate added in v1.5.8

type CexPriceUpdate struct {
	ID          uint    `json:"-"`
	Price       string  `json:"price"`
	BaseVolume  float64 `json:"base_volume"`
	QuoteVolume float64 `json:"quote_volume"`
}

func (*CexPriceUpdate) Marshal added in v1.5.8

func (c *CexPriceUpdate) Marshal() ([]byte, error)

func (*CexPriceUpdate) Pack added in v1.5.8

func (*CexPriceUpdate) UnMarshal added in v1.5.8

func (c *CexPriceUpdate) UnMarshal(buf []byte) error

func (*CexPriceUpdate) Unpack added in v1.5.8

type CustomEvent

type CustomEvent struct {
	Tx       string `json:"tx,omitempty"`
	Contract string `json:"contract,omitempty"`
	Wallet   string `json:"wallet,omitempty"`
	Entity   string `json:"entity,omitempty"`
	Klass    string `json:"klass,omitempty"`
	Name     string `json:"name,omitempty"`
	Data     string `json:"data,omitempty"`
}

func (*CustomEvent) Marshal added in v1.5.0

func (c *CustomEvent) Marshal() ([]byte, error)

func (*CustomEvent) UnMarshal added in v1.5.0

func (c *CustomEvent) UnMarshal(buf []byte) error

type DexeEvents added in v1.4.0

type DexeEvents struct {
	Number       *big.Int       `json:"number,omitempty"`
	Timestamp    int64          `json:"timestamp,omitempty"`
	Network      string         `json:"network,omitempty"`
	CustomEvents []*CustomEvent `json:"customEvents,omitempty"`
}

func (*DexeEvents) Marshal added in v1.5.0

func (d *DexeEvents) Marshal() ([]byte, error)

func (*DexeEvents) UnMarshal added in v1.5.0

func (d *DexeEvents) UnMarshal(buf []byte) error

type DirectSwap

type DirectSwap struct {
	Tx          string          `ch:"tx" json:"tx"`
	Date        time.Time       `ch:"date" json:"date"`
	Chain       string          `ch:"chain" json:"chain"`
	BlockNumber uint64          `ch:"blocknumber" json:"blocknumber"`
	Protocol    string          `ch:"protocol" json:"protocol"`
	SrcToken    string          `ch:"src_token" json:"src_token"`
	DstToken    string          `ch:"dst_token" json:"dst_token"`
	Amount0     *big.Int        `ch:"amount0" json:"amount0"`
	Amount1     *big.Int        `ch:"amount1" json:"amount1"`
	PriceA      decimal.Decimal `ch:"pricea" json:"pricea"`
	PriceAUSD   decimal.Decimal `ch:"pricea_usd" json:"pricea_usd"`
	PriceB      decimal.Decimal `ch:"priceb" json:"priceb"`
	PriceBUSD   decimal.Decimal `ch:"priceb_usd" json:"priceb_usd"`
	Wallet      string          `ch:"wallet" json:"wallet"`
	Order       uint16          `ch:"order" json:"order"`
	ValueUSD    decimal.Decimal `ch:"value_usd" json:"value_usd"`
}

func (*DirectSwap) Marshal added in v1.5.0

func (ds *DirectSwap) Marshal() ([]byte, error)

func (*DirectSwap) Pack added in v1.5.0

func (ds *DirectSwap) Pack() *storage.DirectSwap

func (*DirectSwap) UnMarshal added in v1.5.0

func (ds *DirectSwap) UnMarshal(buf []byte) error

func (*DirectSwap) Unpack added in v1.5.0

func (ds *DirectSwap) Unpack(data *storage.DirectSwap) *DirectSwap

type DirectSwapOS added in v1.7.4

type DirectSwapOS struct {
	Tx          string    `ch:"tx" json:"tx"`
	Date        time.Time `ch:"date" json:"date"`
	Chain       string    `ch:"chain" json:"chain"`
	BlockNumber uint64    `ch:"blocknumber" json:"blocknumber"`
	Protocol    string    `ch:"protocol" json:"protocol"`
	SrcToken    string    `ch:"src_token" json:"src_token"`
	DstToken    string    `ch:"dst_token" json:"dst_token"`
	Amount0     string    `ch:"amount0" json:"amount0"`
	Amount1     string    `ch:"amount1" json:"amount1"`
	PriceA      float32   `ch:"pricea" json:"pricea"`
	PriceAUSD   float32   `ch:"pricea_usd" json:"pricea_usd"`
	PriceB      float32   `ch:"priceb" json:"priceb"`
	PriceBUSD   float32   `ch:"priceb_usd" json:"priceb_usd"`
	Wallet      string    `ch:"wallet" json:"wallet"`
	Order       uint16    `ch:"order" json:"order"`
	ValueUSD    float32   `ch:"value_usd" json:"value_usd"`
}

func (DirectSwapOS) Convert added in v1.7.4

func (ds DirectSwapOS) Convert() *DirectSwap

type Filter added in v1.8.1

type Filter struct {
	PriceMin      float32
	PriceMax      float32
	PriceUSDMin   float32
	PriceUSDMax   float32
	PriceBMin     float32
	PriceBMax     float32
	PriceBUSDMin  float32
	PriceBUSDMax  float32
	VolumeMin     float32
	VolumeMax     float32
	VolumeSellMin float32
	VolumeSellMfx float32
	BaseMin       string
	BaseMax       string
	QuoteMin      string
	QuoteMax      string
	Wallet        []string
	Buy           bool
	Sell          bool
	Add           bool
	Del           bool
	Size          storage.TradeSize
	Flipped       bool
}

func (*Filter) Marshal added in v1.8.1

func (t *Filter) Marshal() ([]byte, error)

func (*Filter) Pack added in v1.8.1

func (t *Filter) Pack() *storage.TradeFilter

func (*Filter) UnMarshal added in v1.8.1

func (t *Filter) UnMarshal(buf []byte) error

func (*Filter) Unpack added in v1.8.1

func (t *Filter) Unpack(data *storage.TradeFilter) *Filter

type Holder added in v1.2.8

type Holder struct {
	Token  string `json:"token"`
	From   string `json:"from"`
	To     string `json:"to"`
	Tx     string `json:"tx"`
	Amount int64  `json:"amount,omitempty"`
}

func (*Holder) Marshal added in v1.5.0

func (h *Holder) Marshal() ([]byte, error)

func (*Holder) UnMarshal added in v1.5.0

func (h *Holder) UnMarshal(buf []byte) error

type HoldersBlock added in v1.3.2

type HoldersBlock struct {
	Block     uint64    `json:"block,omitempty"`
	Timestamp int64     `json:"timestamp,omitempty"`
	Chain     string    `json:"chain,omitempty"`
	Notify    bool      `json:"notify,omitempty"`
	Holders   []*Holder `json:"holders,omitempty"`
}

func (*HoldersBlock) MarshalBin added in v1.5.0

func (h *HoldersBlock) MarshalBin() ([]byte, error)

func (*HoldersBlock) UnMarshal added in v1.5.0

func (h *HoldersBlock) UnMarshal(buf []byte) error

type LimitOrder added in v1.1.0

type LimitOrder struct {
	ID                  uint    `gorm:"primaryKey" json:"id"`
	Status              string  `gorm:"column:status;type:VARCHAR;" json:"status"`
	Uuid                string  `gorm:"column:uuid;type:uuid;" json:"uuid"`
	Wallet              string  `gorm:"column:wallet;type:VARCHAR;" json:"wallet"`
	Chain               string  `gorm:"column:chain;type:VARCHAR;" json:"chain"`
	Pair                string  `gorm:"column:pair;type:VARCHAR;" json:"pair"`
	Flipped             bool    `gorm:"column:flipped;type:BOOL;" json:"flipped"`
	Price               float64 `gorm:"column:price;type:float8;" json:"price"`
	PriceUSD            float64 `gorm:"column:price_usd;type:float8;" json:"price_usd"`
	StartPrice          float64 `gorm:"column:start_price;type:float8;" json:"start_price"`
	StartPriceUSD       float64 `gorm:"column:start_price_usd;type:float8;" json:"start_price_usd"`
	EndPrice            float64 `gorm:"column:end_price;type:float8;" json:"end_price"`
	EndPriceUSD         float64 `gorm:"column:end_price_usd;type:float8;" json:"end_price_usd"`
	ExecutionType       string  `gorm:"column:execution_type;type:VARCHAR;" json:"execution_type"`
	Gt                  bool    `gorm:"column:gt;type:BOOL;" json:"gt"`
	Name                string  `gorm:"column:name;type:VARCHAR;" json:"name"`
	Exchange            string  `gorm:"column:exchange;type:VARCHAR;" json:"exchange"`
	Proxy               string  `gorm:"column:proxy;type:VARCHAR;" json:"proxy"`
	AmountIn            string  `gorm:"column:amount_in;type:VARCHAR;" json:"amount_in"`
	AmountOut           string  `gorm:"column:amount_out;type:VARCHAR;" json:"amount_out"`
	SrcAddress          string  `gorm:"column:src_address;type:VARCHAR;" json:"src_address"`
	SrcDecimals         int32   `gorm:"column:src_decimals;type:INT4;default:2;" json:"src_decimals"`
	DestAddress         string  `gorm:"column:dest_address;type:VARCHAR;" json:"dest_address"`
	DestDecimals        int32   `gorm:"column:dest_decimals;type:INT4;default:2;" json:"dest_decimals"`
	GasSent             int64   `gorm:"column:gas_sent;type:int64;" json:"gas_sent"`
	TotalGas            int64   `gorm:"column:total_gas;type:int64;" json:"total_gas"`
	ExpiresAt           int64   `gorm:"column:expires_at;type:int64;" json:"expires_at"`
	TriggerType         string  `gorm:"column:trigger_type;type:VARCHAR;" json:"trigger_type"`
	Slippage            uint    `gorm:"column:slippage;type:int64;" json:"slippage"`
	ExecutedTradesCount int64   `gorm:"column:executed_trades_count;type:int64;" json:"executed_trades_count"`
	TradesCount         int64   `gorm:"column:trades_count;type:int64;" json:"trades_count"`
	CreatedAt           int64   `gorm:"column:created_at;type:int64;" json:"created_at"`
	TradesTimeDistance  int64   `gorm:"column:trades_time_distance;type:int64;" json:"trades_time_distance"`

	LimitTrades []LimitTrade `gorm:"foreignKey:OrderId" json:"limit_trades"`
}

func (*LimitOrder) Marshal added in v1.5.0

func (l *LimitOrder) Marshal() ([]byte, error)

func (*LimitOrder) TableName added in v1.1.0

func (l *LimitOrder) TableName() string

TableName overrides the table name used by User to `profiles`

func (*LimitOrder) UnMarshal added in v1.5.0

func (l *LimitOrder) UnMarshal(buf []byte) error

type LimitTrade added in v1.2.0

type LimitTrade struct {
	ID              uint    `gorm:"primaryKey" json:"id"`
	OrderId         uint    `gorm:"column:order_id;type:int64" json:"order_id"`
	Status          string  `gorm:"column:status;type:VARCHAR;" json:"status"`
	AmountIn        string  `gorm:"column:amount_in;type:VARCHAR;" json:"amount_in"`
	AmountOut       string  `gorm:"column:amount_out;type:VARCHAR;" json:"amount_out"`
	GasPrice        int64   `gorm:"column:gas_price;type:int64;" json:"gas_price"`
	GasValue        int64   `gorm:"column:gas_value;type:int64;" json:"gas_value"`
	TriggerTx       string  `gorm:"column:trigger_tx;type:VARCHAR;" json:"trigger_tx"`
	ExecutionTx     string  `gorm:"column:execution_tx;type:VARCHAR;" json:"execution_tx"`
	FailureReason   string  `gorm:"column:failure_reason;type:VARCHAR;" json:"failure_reason"`
	Price           float64 `gorm:"column:price;type:float8;" json:"price"`
	PriceUSD        float64 `gorm:"column:price_usd;type:float8;" json:"price_usd"`
	UpdatedAt       int64   `gorm:"column:updated_at;type:int64;" json:"updated_at"`
	PlannedExecTime int64   `gorm:"column:planned_exec_time;type:int64;" json:"planned_exec_time"`
}

func (*LimitTrade) Marshal added in v1.5.0

func (l *LimitTrade) Marshal() ([]byte, error)

func (*LimitTrade) TableName added in v1.2.0

func (l *LimitTrade) TableName() string

TableName overrides the table name used by User to `profiles`

func (*LimitTrade) UnMarshal added in v1.5.0

func (l *LimitTrade) UnMarshal(buf []byte) error

type LiquidityEvent

type LiquidityEvent struct {
	// generic info
	BlockNumber uint64    `json:"blocknumber"`
	Date        time.Time `json:"date"`
	Tx          string    `json:"tx"`
	Pair        string    `json:"pair"`
	Chain       string    `json:"chain"`
	Klass       string    `json:"klass"` // mint, burn, sync
	Wallet      string    `json:"wallet"`
	Order       uint      `json:"order"`
	// Mint, Burn
	Amount0 string `json:"amount0"`
	Amount1 string `json:"amount1"`
	// Sync
	Reserve0 string `json:"reserve0"`
	Reserve1 string `json:"reserve1"`
	// Statistics part
	PriceA    decimal.Decimal `json:"pricea"`
	PriceAUSD decimal.Decimal `json:"pricea_usd"`
	PriceB    decimal.Decimal `json:"priceb"`
	PriceBUSD decimal.Decimal `json:"priceb_usd"`
	// USD value of operation
	ValueUSD decimal.Decimal `json:"value_usd"`
	// Reserves value in USD
	ReserveUSD decimal.Decimal `json:"reserve_usd"`
	ValidTill  time.Time       `json:"valid_till"`

	Source int32 `json:"source"`
}

func (*LiquidityEvent) Marshal added in v1.5.0

func (l *LiquidityEvent) Marshal() ([]byte, error)

func (*LiquidityEvent) UnMarshal added in v1.5.0

func (l *LiquidityEvent) UnMarshal(buf []byte) error

type NewPair

type NewPair struct {
	Factory     string `json:"factory"`
	Pair        string `json:"pair"`
	Klass       string `json:"klass"`
	Network     string `json:"network"`
	Node        string `json:"node"`
	PoolCreated int64  `json:"pool_created"`
}

func (*NewPair) Marshal added in v1.5.0

func (p *NewPair) Marshal() ([]byte, error)

func (*NewPair) UnMarshal added in v1.5.0

func (p *NewPair) UnMarshal(buf []byte) error

type NftEvent added in v1.6.3

type NftEvent struct {
	Provider    string          `json:"provider,omitempty"`
	EventType   string          `json:"event_type,omitempty"`
	Price       decimal.Decimal `json:"price,omitempty"`
	PriceUsd    decimal.Decimal `json:"price_usd,omitempty"`
	Token       string          `json:"token,omitempty"`
	TokenID     *big.Int        `json:"token_id,omitempty"`
	Wallet      string          `json:"wallet,omitempty"`
	Date        int64           `json:"date,omitempty"`
	Chain       string          `json:"chain,omitempty"`
	BlockNumber uint64          `json:"blocknumber,omitempty"`
	Tx          string          `json:"tx,omitempty"`
}

type Pair added in v1.1.0

type Pair struct {
	ID            uint   `gorm:"primaryKey" json:"id"`
	Name          string `gorm:"column:name;type:VARCHAR;" json:"name"`
	FullName      string `gorm:"column:full_name;type:VARCHAR;" json:"full_name"`
	Chain         string `gorm:"column:chain;type:VARCHAR;" json:"chain"`
	Exchange      string `gorm:"column:exchange;type:VARCHAR;" json:"exchange"`
	Address       string `gorm:"column:address;type:VARCHAR;" json:"address"`
	BaseAddress   string `gorm:"column:base_address;type:VARCHAR;" json:"base_address"`
	BaseDecimals  int32  `gorm:"column:base_decimals;type:INT4;default:2;" json:"base_decimals"`
	QuoteAddress  string `gorm:"column:quote_address;type:VARCHAR;" json:"quote_address"`
	QuoteDecimals int32  `gorm:"column:quote_decimals;type:INT4;default:2;" json:"quote_decimals"`
	Hidden        bool   `gorm:"column:hidden;type:BOOL;" json:"hidden"`
	Hot           bool   `gorm:"column:hot;type:BOOL;" json:"hot"`
	Flipped       bool   `gorm:"column:flipped;type:BOOL;" json:"flipped"`
	Rank          byte   `gorm:"column:rank;type:int32;" json:"rank"`
	Kind          byte   `gorm:"column:kind;type:int32;" json:"kind"`
	PoolCreated   int64  `gorm:"column:pool_created;type:INT4;default:0;" json:"pool_created"`
	BaseId        uint   `gorm:"column:base_id;type:INT4;" json:"base_id"`
	QuoteId       uint   `gorm:"column:quote_id;type:INT4;" json:"quote_id"`
	// there are no columns in DB (OpenSearch only)
	PriceA       float64 `gorm:"-" json:"price_a"`
	PriceAUSD    float64 `gorm:"-" json:"price_a_usd"`
	PriceB       float64 `gorm:"-" json:"price_b"`
	PriceBUSD    float64 `gorm:"-" json:"price_b_usd"`
	Liquidity    float64 `gorm:"-" json:"liquidity"`
	Volume       float64 `gorm:"-" json:"volume"`
	BaseReserve  int64   `gorm:"-" json:"base_reserve"`
	QuoteReserve int64   `gorm:"-" json:"quote_reserve"`
	UpdatedAt    int64   `gorm:"-" json:"updated_at"`
	APY          float64 `gorm:"-" json:"annual_percentage_yield"`
	BaseSlug     string  `gorm:"-" json:"base_slug"`
	QuoteSlug    string  `gorm:"-" json:"quote_slug"`
	Order        int32   `gorm:"-" json:"order"`
	ChangeA      float64 `gorm:"-" json:"change_a"`
	ChangeAUSD   float64 `gorm:"-" json:"change_a_usd"`
	ChangeB      float64 `gorm:"-" json:"change_b"`
	ChangeBUSD   float64 `gorm:"-" json:"change_b_usd"`
}

func (*Pair) GetBaseAsset added in v1.1.0

func (p *Pair) GetBaseAsset() string

GetBaseAsset WBTC/WETH will return WBTC

func (*Pair) GetBaseQuoteAsset added in v1.1.0

func (p *Pair) GetBaseQuoteAsset() (string, string)

func (*Pair) GetExchange added in v1.1.0

func (p *Pair) GetExchange() string

func (*Pair) GetKey added in v1.1.0

func (p *Pair) GetKey() string

func (*Pair) GetQuoteAsset added in v1.1.0

func (p *Pair) GetQuoteAsset() string

GetQuoteAsset WBTC/WETH will return WETH

func (*Pair) Marshal added in v1.5.0

func (p *Pair) Marshal() ([]byte, error)

func (*Pair) TableName added in v1.1.0

func (p *Pair) TableName() string

TableName overrides the table name used by User to `profiles`

func (*Pair) TradesToUSD added in v1.1.0

func (p *Pair) TradesToUSD() bool

func (*Pair) UnMarshal added in v1.5.0

func (p *Pair) UnMarshal(buf []byte) error

type PairSwap

type PairSwap struct {
	Tx               string          `json:"tx"`
	Date             time.Time       `json:"date"`
	Chain            string          `json:"chain"`
	BlockNumber      uint64          `json:"blocknumber"`
	Pair             string          `json:"pair"`
	Amount0          *big.Int        `json:"amount0"`
	Amount1          *big.Int        `json:"amount1"`
	Buy              bool            `json:"buy"`
	PriceA           decimal.Decimal `json:"pricea"`
	PriceAUSD        decimal.Decimal `json:"pricea_usd"`
	PriceB           decimal.Decimal `json:"priceb"`
	PriceBUSD        decimal.Decimal `json:"priceb_usd"`
	Bot              bool            `json:"bot"`
	Wallet           string          `json:"wallet"`
	Order            uint16          `json:"order"`
	ValueUSD         decimal.Decimal `json:"value_usd"`
	TotalTradesCount uint32          `json:"total_trades_count"`
	PairTradesCount  uint32          `json:"pair_trades_count"`
	Klass            string          `json:"klass"`
	Reserve0         string          `json:"reverse0"`
	Reserve1         string          `json:"reverse1"`
	ReserveUSD       string          `json:"reverse_usd"`
	ValidTill        int64           `json:"valid_till"`
}

func (*PairSwap) Marshal added in v1.5.0

func (p *PairSwap) Marshal() ([]byte, error)

func (*PairSwap) Pack added in v1.5.0

func (p *PairSwap) Pack() *storage.PairSwap

func (*PairSwap) UnMarshal added in v1.5.0

func (p *PairSwap) UnMarshal(buf []byte) error

func (*PairSwap) Unpack added in v1.5.0

func (p *PairSwap) Unpack(data *storage.PairSwap) *PairSwap

type PriceAlert added in v1.1.0

type PriceAlert struct {
	ID   uint   `gorm:"primaryKey" json:"id"`
	Uuid string `gorm:"column:uuid;type:uuid;" json:"uuid"`

	Status     string  `gorm:"column:status;type:VARCHAR;" json:"status"`
	Exchange   string  `gorm:"column:exchange;type:VARCHAR;" json:"exchange"`
	Name       string  `gorm:"column:name;type:VARCHAR;" json:"name"`
	Wallet     string  `gorm:"column:wallet;type:VARCHAR;default:null;" json:"wallet"`
	Token      string  `gorm:"column:token;type:VARCHAR;" json:"token"`
	Chain      string  `gorm:"column:chain;type:VARCHAR;" json:"chain"`
	Pair       string  `gorm:"column:pair;type:VARCHAR;" json:"pair"`
	Flipped    bool    `gorm:"column:flipped;type:BOOL;" json:"flipped"`
	Price      float64 `gorm:"column:price;type:float8;" json:"price"`
	PriceUSD   float64 `gorm:"column:price_usd;type:float8;" json:"price_usd"`
	Gt         bool    `gorm:"column:gt;type:BOOL;" json:"gt"`
	CreatedAt  int64   `gorm:"column:created_at;type:int64;" json:"created_at"`
	ExecutedAt int64   `gorm:"column:executed_at;type:int64;" json:"executed_at"`
	Hidden     bool    `gorm:"column:hidden;type:BOOL;" json:"hidden"`
	UserID     int64   `gorm:"column:user_id;type:int8;default:null;" json:"user_id"`
}

func (*PriceAlert) Marshal added in v1.5.0

func (p *PriceAlert) Marshal() ([]byte, error)

func (*PriceAlert) TableName added in v1.1.0

func (p *PriceAlert) TableName() string

TableName overrides the table name used by User to `profiles`

func (*PriceAlert) UnMarshal added in v1.5.0

func (p *PriceAlert) UnMarshal(buf []byte) error

type PriceHolder added in v1.5.2

type PriceHolder struct {
	Pair      string          `json:"pair"`
	Chain     string          `json:"chain"`
	PriceA    decimal.Decimal `json:"priceA"`
	PriceAUSD decimal.Decimal `json:"PriceAUSD"`
	PriceB    decimal.Decimal `json:"priceB"`
	PriceBUSD decimal.Decimal `json:"priceBUSD"`
}

func (*PriceHolder) Pack added in v1.5.2

func (h *PriceHolder) Pack() *storage.PriceHolder

func (*PriceHolder) Unpack added in v1.5.2

func (h *PriceHolder) Unpack(data *storage.PriceHolder) *PriceHolder

type PriceUpdates added in v1.5.2

type PriceUpdates struct {
	Items []*PriceHolder `json:"price_updates"`
}

func (*PriceUpdates) Marshal added in v1.5.2

func (u *PriceUpdates) Marshal() ([]byte, error)

func (*PriceUpdates) UnMarshal added in v1.5.2

func (u *PriceUpdates) UnMarshal(buf []byte) error

type SmartSwap added in v1.7.1

type SmartSwap struct {
	Tx          string          `ch:"tx" json:"tx"`
	Date        time.Time       `ch:"date" json:"date"`
	Chain       string          `ch:"chain" json:"chain"`
	BlockNumber uint64          `ch:"blocknumber" json:"blocknumber"`
	Protocol    string          `ch:"protocol" json:"protocol"`
	Pair        string          `ch:"pair" json:"pair"`
	SrcToken    string          `ch:"src_token" json:"src_token"`
	DstToken    string          `ch:"dst_token" json:"dst_token"`
	Amount0     *big.Int        `ch:"amount0" json:"amount0"`
	Amount1     *big.Int        `ch:"amount1" json:"amount1"`
	Buy         bool            `ch:"buy" json:"buy"`
	PriceA      decimal.Decimal `ch:"pricea" json:"pricea"`
	PriceAUSD   decimal.Decimal `ch:"pricea_usd" json:"pricea_usd"`
	PriceB      decimal.Decimal `ch:"priceb" json:"priceb"`
	PriceBUSD   decimal.Decimal `ch:"priceb_usd" json:"priceb_usd"`
	Wallet      string          `ch:"wallet" json:"wallet"`
	SwapType    int             `ch:"swap_type" json:"swap_type"`
	Order       uint16          `ch:"order" json:"order"`
	ValueUSD    decimal.Decimal `ch:"value_usd" json:"value_usd"`
}

func (*SmartSwap) ConvertFromDirect added in v1.7.2

func (ds *SmartSwap) ConvertFromDirect(data *DirectSwap, isProxy bool) *SmartSwap

func (*SmartSwap) ConvertFromPair added in v1.7.2

func (ds *SmartSwap) ConvertFromPair(data *PairSwap, isProxy bool) *SmartSwap

func (*SmartSwap) Marshal added in v1.7.1

func (ds *SmartSwap) Marshal() ([]byte, error)

func (*SmartSwap) Pack added in v1.7.1

func (ds *SmartSwap) Pack() *storage.SmartSwap

func (*SmartSwap) UnMarshal added in v1.7.1

func (ds *SmartSwap) UnMarshal(buf []byte) error

func (*SmartSwap) Unpack added in v1.7.1

func (ds *SmartSwap) Unpack(data *storage.SmartSwap) *SmartSwap

type Trade added in v1.5.2

type Trade struct {
	Pair      string   `json:"pair"`
	PriceA    float64  `json:"price_a"`
	PriceB    float64  `json:"price_b"`
	PriceAUSD float64  `json:"price_a_usd"`
	PriceBUSD float64  `json:"price_b_usd"`
	VolumeA   *big.Int `json:"volume_a"`
	VolumeB   *big.Int `json:"volume_b"`
	VolumeUSD float64  `json:"volume_usd"`
	IsBuy     bool     `json:"is_buy"`
}

func (*Trade) Marshal added in v1.5.2

func (t *Trade) Marshal() ([]byte, error)

func (*Trade) Pack added in v1.5.2

func (t *Trade) Pack() *storage.Trade

func (*Trade) UnMarshal added in v1.5.2

func (t *Trade) UnMarshal(buf []byte) error

func (*Trade) Unpack added in v1.5.2

func (t *Trade) Unpack(data *storage.Trade) *Trade

type TraderWalletCard added in v1.8.2

type TraderWalletCard struct {
	FirstTradeAt time.Time         `json:"first_trade_at"`
	LastTradeAt  time.Time         `json:"last_trade_at"`
	CreatedAt    time.Time         `json:"created_at"`
	UpdatedAt    time.Time         `json:"updated_at"`
	TotalTrades  uint64            `json:"total_trades"`
	Pairs        map[string]uint64 `json:"pairs"`
	PairInfo     *TraderWalletPair `json:"pair_info"`
}

type TraderWalletPair added in v1.8.6

type TraderWalletPair struct {
	BuyTradesCount  uint64  `json:"buy_trades_count"`
	SellTradesCount uint64  `json:"sell_trades_count"`
	BuyValueUsd     float64 `json:"buy_value_usd"`
	SellValueUsd    float64 `json:"sell_value_usd"`
	Amount0Buy      string  `json:"amount_0_buy"`
	Amount0Sell     string  `json:"amount_0_sell"`
	Amount1Buy      string  `json:"amount_1_buy"`
	Amount1Sell     string  `json:"amount_1_sell"`
}

type TradesBlock added in v1.5.2

type TradesBlock struct {
	Network     string        `json:"network"`
	Date        uint64        `json:"date"`
	Trades      []*Trade      `json:"trades"`
	PairSwaps   []*PairSwap   `json:"pair_swaps"`
	DirectSwaps []*DirectSwap `json:"direct_swaps"`
}

func (*TradesBlock) Marshal added in v1.5.2

func (t *TradesBlock) Marshal() ([]byte, error)

func (*TradesBlock) UnMarshal added in v1.5.2

func (t *TradesBlock) UnMarshal(buf []byte) error

type Transaction added in v1.6.7

type Transaction struct {
	From  common.Address `json:"from"`
	Hash  common.Hash    `json:"hash"`
	Input []byte         `json:"input"`
	To    common.Address `json:"to"`
	Value *big.Int       `json:"value"`
}

func (*Transaction) Marshal added in v1.6.7

func (b *Transaction) Marshal() ([]byte, error)

func (*Transaction) UnMarshal added in v1.6.7

func (b *Transaction) UnMarshal(buf []byte) error

type TransferEvent

type TransferEvent struct {
	Chain       string          `json:"chain"`
	Contract    string          `json:"contract"`
	BlockNumber uint64          `json:"blocknumber"`
	Date        time.Time       `json:"date"`
	Order       uint            `json:"order"` // log order
	Tx          string          `json:"tx"`
	From        string          `json:"from"`   // usually contract
	To          string          `json:"to"`     // usually wallet
	Amount      string          `json:"amount"` // bigint amount
	ValueUSD    decimal.Decimal `json:"value_usd"`
}

func (*TransferEvent) Marshal added in v1.5.0

func (t *TransferEvent) Marshal() ([]byte, error)

func (*TransferEvent) UnMarshal added in v1.5.0

func (t *TransferEvent) UnMarshal(buf []byte) error

Jump to

Keyboard shortcuts

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