price

package
v0.0.0-...-816240f Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(data GeckoterminalResponse) string

func GetJson

func GetJson(dataURL string, target interface{}) error

func Replacer

func Replacer(template string, data GeckoterminalResponse) string

Types

type GeckoterminalResponse

type GeckoterminalResponse struct {
	Data struct {
		ID         string `json:"id"`
		Type       string `json:"type"`
		Attributes struct {
			BaseTokenPriceUsd             string      `json:"base_token_price_usd"`
			BaseTokenPriceNativeCurrency  string      `json:"base_token_price_native_currency"`
			QuoteTokenPriceUsd            string      `json:"quote_token_price_usd"`
			QuoteTokenPriceNativeCurrency string      `json:"quote_token_price_native_currency"`
			BaseTokenPriceQuoteToken      string      `json:"base_token_price_quote_token"`
			QuoteTokenPriceBaseToken      string      `json:"quote_token_price_base_token"`
			Address                       string      `json:"address"`
			Name                          string      `json:"name"`
			PoolCreatedAt                 time.Time   `json:"pool_created_at"`
			FdvUsd                        string      `json:"fdv_usd"`
			MarketCapUsd                  interface{} `json:"market_cap_usd"`
			PriceChangePercentage         struct {
				M5  string `json:"m5"`
				H1  string `json:"h1"`
				H6  string `json:"h6"`
				H24 string `json:"h24"`
			} `json:"price_change_percentage"`
			Transactions struct {
				M5 struct {
					Buys    int `json:"buys"`
					Sells   int `json:"sells"`
					Buyers  int `json:"buyers"`
					Sellers int `json:"sellers"`
				} `json:"m5"`
				M15 struct {
					Buys    int `json:"buys"`
					Sells   int `json:"sells"`
					Buyers  int `json:"buyers"`
					Sellers int `json:"sellers"`
				} `json:"m15"`
				M30 struct {
					Buys    int `json:"buys"`
					Sells   int `json:"sells"`
					Buyers  int `json:"buyers"`
					Sellers int `json:"sellers"`
				} `json:"m30"`
				H1 struct {
					Buys    int `json:"buys"`
					Sells   int `json:"sells"`
					Buyers  int `json:"buyers"`
					Sellers int `json:"sellers"`
				} `json:"h1"`
				H24 struct {
					Buys    int `json:"buys"`
					Sells   int `json:"sells"`
					Buyers  int `json:"buyers"`
					Sellers int `json:"sellers"`
				} `json:"h24"`
			} `json:"transactions"`
			VolumeUsd struct {
				M5  string `json:"m5"`
				H1  string `json:"h1"`
				H6  string `json:"h6"`
				H24 string `json:"h24"`
			} `json:"volume_usd"`
			ReserveInUsd string `json:"reserve_in_usd"`
		} `json:"attributes"`
		Relationships struct {
			BaseToken struct {
				Data struct {
					ID   string `json:"id"`
					Type string `json:"type"`
				} `json:"data"`
			} `json:"base_token"`
			QuoteToken struct {
				Data struct {
					ID   string `json:"id"`
					Type string `json:"type"`
				} `json:"data"`
			} `json:"quote_token"`
			Dex struct {
				Data struct {
					ID   string `json:"id"`
					Type string `json:"type"`
				} `json:"data"`
			} `json:"dex"`
		} `json:"relationships"`
	} `json:"data"`
}

func GetData

func GetData(dataURL string) (GeckoterminalResponse, error)

type Price

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

func InitPrice

func InitPrice(logger *slog.Logger, config *config.Config) (*Price, error)

func (*Price) Get

func (su *Price) Get() (GeckoterminalResponse, error)

func (*Price) Run

func (su *Price) Run(b *bot.Bot) error

Jump to

Keyboard shortcuts

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