Documentation
¶
Index ¶
- Constants
- Variables
- func CMC_Update(w *cmn.Wallet) (int, error)
- func DS_Update(w *cmn.Wallet) (int, error)
- func GetUrl(feeder string, chain_id int, tokenAddr string) string
- func Init()
- func Update(w *cmn.Wallet) error
- type BaseToken
- type CMCMapResponse
- type CMCQuotesResponse
- type Crypto
- type DSPair
- type DSResponse
- type Liquidity
- type PriceChange
- type PriceInfo
- func CMC_GetLatest(slags []string) ([]PriceInfo, error)
- func CMC_GetPriceInfoList(chain_id int, tokenAddr string) ([]PriceInfo, error)
- func DSGetPairs(chain_id int, pairList string) ([]PriceInfo, error)
- func DS_GetPriceInfoList(chain_id int, tokenAddr string) ([]PriceInfo, error)
- func GetPriceInfoList(chain_id int, tokenAddr string) ([]PriceInfo, error)
- type QuoteToken
- type Status
- type TransactionDetails
- type Transactions
- type Volume
Constants ¶
View Source
const CMC_API = "https://pro-api.coinmarketcap.com/v1"
Variables ¶
View Source
var INIT_DELAY = 10 * time.Second
View Source
var PRICE_UPDATE_PERIOD time.Duration
Functions ¶
Types ¶
type CMCMapResponse ¶
CMCMapResponse holds the response from the cryptocurrency/map endpoint
type CMCQuotesResponse ¶
type CMCQuotesResponse struct {
Status struct {
Timestamp string `json:"timestamp"`
ErrorCode int `json:"error_code"`
ErrorMessage string `json:"error_message,omitempty"`
Elapsed int `json:"elapsed"`
CreditCount int `json:"credit_count"`
} `json:"status"`
Data map[string]struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
CirculatingSupply float64 `json:"circulating_supply"`
TotalSupply float64 `json:"total_supply"`
MaxSupply float64 `json:"max_supply"`
LastUpdated string `json:"last_updated"`
DateAdded string `json:"date_added"`
NumMarketPairs int `json:"num_market_pairs"`
Tags []string `json:"tags"`
Platform struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
TokenAddress string `json:"token_address"`
} `json:"platform,omitempty"`
Quote map[string]struct {
Price float64 `json:"price"`
Volume24h float64 `json:"volume_24h"`
VolumeChange24h float64 `json:"volume_change_24h"`
PercentChange1h float64 `json:"percent_change_1h"`
PercentChange24h float64 `json:"percent_change_24h"`
PercentChange7d float64 `json:"percent_change_7d"`
PercentChange30d float64 `json:"percent_change_30d"`
PercentChange60d float64 `json:"percent_change_60d"`
PercentChange90d float64 `json:"percent_change_90d"`
MarketCap float64 `json:"market_cap"`
LastUpdated string `json:"last_updated"`
} `json:"quote"`
} `json:"data"`
}
CMCQuotesResponse holds the response from the cryptocurrency/quotes/latest endpoint
type Crypto ¶
type Crypto struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
Rank int `json:"rank"`
IsActive int `json:"is_active"`
FirstHistoricalData string `json:"first_historical_data"`
LastHistoricalData string `json:"last_historical_data"`
}
Crypto holds information about each cryptocurrency
type DSPair ¶
type DSPair struct {
URL string `json:"url"`
PairAddress string `json:"pairAddress"`
BaseToken BaseToken `json:"baseToken"`
QuoteToken QuoteToken `json:"quoteToken"`
PriceNative string `json:"priceNative"`
PriceUsd string `json:"priceUsd"`
Txns Transactions `json:"txns"`
Volume Volume `json:"volume"`
PriceChange PriceChange `json:"priceChange"`
Liquidity Liquidity `json:"liquidity"`
FDV float64 `json:"fdv"`
PairCreatedAt int64 `json:"pairCreatedAt,omitempty"`
}
type DSResponse ¶
type PriceChange ¶
type PriceInfo ¶
type PriceInfo struct {
PriceFeeder string
PairID string
BaseToken string
QuoteToken string
PriceUsd float64
PriceChange24 float64
Liquidity float64
URL string
}
func CMC_GetLatest ¶
func CMC_GetPriceInfoList ¶
func DS_GetPriceInfoList ¶
type QuoteToken ¶
type QuoteToken struct {
Symbol string `json:"symbol"`
}
type Status ¶
type Status struct {
Timestamp string `json:"timestamp"`
ErrorCode int `json:"error_code"`
ErrorMessage string `json:"error_message"`
Elapsed int `json:"elapsed"`
CreditCount int `json:"credit_count"`
}
Status holds metadata about the response
type TransactionDetails ¶
type Transactions ¶
type Transactions struct {
H24 TransactionDetails `json:"h24"`
H6 TransactionDetails `json:"h6"`
H1 TransactionDetails `json:"h1"`
M5 TransactionDetails `json:"m5"`
}
Click to show internal directories.
Click to hide internal directories.