Documentation ¶
Index ¶
- Constants
- func ContainsExchangePair(pairs []ExchangePair, pair ExchangePair) bool
- func GetAllSymbolsFromPairs(pairs []ExchangePair) ([]string, error)
- func GetPairSymbols(pair ExchangePair) ([]string, error)
- func GetSymbolsList(url string) ([]string, error)
- type AggregatedVolume
- type Asset
- type AssetVolume
- type BlockChain
- type BlockData
- type ChainConfig
- type Client
- type ConfigApi
- type ConfigConnector
- type EthereumBlockData
- type Exchange
- type ExchangePair
- type ExchangeVolume
- type ExchangeVolumesList
- type FilterPoint
- type FilterPointMetadata
- type FiltersBlock
- type FiltersBlockData
- type IndexBlock
- type IndexBlockData
- type IndexElement
- type NFT
- type NFTAttributes
- type NFTBid
- type NFTClass
- type NFTOffer
- type NFTTrade
- type Pair
- type PairVolume
- type PairVolumesList
- type Pairs
- type Pool
- type SuppliesBlock
- type SuppliesBlockData
- type Supply
- type Symbols
- type SynthAssetSupply
- type TopAsset
- type Trade
- type TradesBlock
- type TradesBlockData
- type TradesDistribution
- type VerificationMechanism
- type VolatilityRatio
Constants ¶
const ( ArthswapExchange = "Arthswap" DiffusionExchange = "Diffusion" OmniDexExchange = "OmniDex" NetswapExchange = "Netswap" TethysExchange = "Tethys" HermesExchange = "Hermes" AnyswapExchange = "Anyswap" BalancerExchange = "Balancer" BalancerV2Exchange = "BalancerV2" BalancerV2ExchangePolygon = "BalancerV2-Polygon" BeetsExchange = "Beets" KrakenExchange = "Kraken" BitfinexExchange = "Bitfinex" BitforexExchange = "Bitforex" BinanceExchange = "Binance" BinanceExchangeUS = "BinanceUS" CryptoDotComExchange = "Crypto.com" FTXExchange = "FTX" Opyn = "OPYN" Premia = "Premia" BitBayExchange = "BitBay" BittrexExchange = "Bittrex" CoinBaseExchange = "CoinBase" HitBTCExchange = "HitBTC" HuckleberryExchange = "Huckleberry" TraderJoeExchange = "TraderJoe" PangolinExchange = "Pangolin" SimexExchange = "Simex" OKExExchange = "OKEx" HuobiExchange = "Huobi" LBankExchange = "LBank" GateIOExchange = "GateIO" ZBExchange = "ZB" QuoineExchange = "Quoine" UnknownExchange = "Unknown" BlockSizeSeconds = 120 FilterKing = "MAIR120" BancorExchange = "Bancor" UniswapExchange = "Uniswap" UniswapExchangeV3 = "UniswapV3" UniswapExchangeV3Polygon = "UniswapV3-polygon" LoopringExchange = "Loopring" CurveFIExchange = "Curvefi" CurveFIExchangeFantom = "Curvefi-Fantom" CurveFIExchangeMoonbeam = "Curvefi-Moonbeam" CurveFIExchangePolygon = "Curvefi-Polygon" MakerExchange = "Maker" KuCoinExchange = "KuCoin" SushiSwapExchange = "SushiSwap" SushiSwapExchangeArbitrum = "SushiSwap-arbitrum" SushiSwapExchangePolygon = "SushiSwap-polygon" SushiSwapExchangeFantom = "SushiSwap-fantom" PanCakeSwap = "PanCakeSwap" ApeswapExchange = "Apeswap" BiswapExchange = "Biswap" DforceExchange = "Dforce" ZeroxExchange = "0x" KyberExchange = "Kyber" BitMartExchange = "BitMart" BitMaxExchange = "Bitmax" MEXCExchange = "MEXC" CREX24Exchange = "CREX24" STEXExchange = "STEX" Deribit = "Deribit" DfynNetwork = "DFYN" UbeswapExchange = "Ubeswap" SpookyswapExchange = "Spookyswap" SpiritswapExchange = "Spiritswap" QuickswapExchange = "Quickswap" SerumExchange = "Serum" SolarbeamExchange = "Solarbeam" TrisolarisExchange = "Trisolaris" ByBitExchange = "ByBit" BitMexExchange = "BitMex" MultiChain = "MultiChain" StellaswapExchange = "Stellaswap" )
const ( CryptoPunks = "CryptoPunks" CryptoKitties = "CryptoKitties" Topshot = "Topshot" X2Y2 = "X2Y2" Opensea = "Opensea" OpenseaBAYC = "OpenseaBAYC" OpenseaSeaport = "OpenseaSeaport" LooksRare = "LooksRare" TofuNFTAstar = "TofuNFT-Astar" TofuNFTBinanceSmartChain = "TofuNFT-BinanceSmartChain" )
const ( Diadata = "diadata.org" PROOF_OF_STAKE VerificationMechanism = "pos" PROOF_OF_WORK VerificationMechanism = "pow" BITCOIN = "Bitcoin" ETHEREUM = "Ethereum" BINANCESMARTCHAIN = "BinanceSmartChain" POLYGON = "Polygon" CELO = "Celo" FANTOM = "Fantom" NEAR = "NEAR" AURORA = "Aurora" SOLANA = "Solana" FLOW = "Flow" MOONRIVER = "Moonriver" MOONBEAM = "Moonbeam" AVALANCHE = "Avalanche" ARBITRUM = "Arbitrum" ASTAR = "Astar" SHIDEN = "Shiden" METIS = "Metis" KILT = "Kilt" FETCH = "Fetch" FUSE = "Fuse" TELOS = "Telos" EVMOS = "Evmos" KUSAMA = "Kusama" ACALA = "Acala" POLKADOT = "Polkadot" FIAT = "Fiat" )
const BaseUrl string = "https://api.diadata.org/"
Variables ¶
This section is empty.
Functions ¶
func ContainsExchangePair ¶ added in v1.2.0
func ContainsExchangePair(pairs []ExchangePair, pair ExchangePair) bool
ContainsExchangePair returns true iff @pair is contained in pairs. Here, equality refers to the unique identifier (exchange,foreignName).
func GetAllSymbolsFromPairs ¶ added in v1.2.0
func GetAllSymbolsFromPairs(pairs []ExchangePair) ([]string, error)
GetAllSymbolsFromPairs returns a unique list of symbols which constitute @pairs.
func GetPairSymbols ¶ added in v1.2.0
func GetPairSymbols(pair ExchangePair) ([]string, error)
GetPairSymbols returns the two symbol tickers of @pair.
Types ¶
type AggregatedVolume ¶ added in v1.4.2
type Asset ¶ added in v1.2.0
Asset is the data type for all assets, ranging from fiat to crypto.
func GetAllAssetsFromPairs ¶ added in v1.2.0
func GetAllAssetsFromPairs(pairs []ExchangePair) (assets []Asset)
GetAllAssetsFromPairs returns the unique slice of assets underlying the exchange pairs @pairs.
func (*Asset) MarshalBinary ¶ added in v1.2.0
MarshalBinary is a custom marshaller for Asset type
func (*Asset) UnmarshalBinary ¶ added in v1.2.0
UnmarshalBinary is a custom unmarshaller for Asset type
type AssetVolume ¶ added in v1.4.2
type BlockChain ¶
type BlockChain struct { Name string `json:"Name"` // Genesis date is a Unix timestamp GenesisDate int64 `json:"GenesisDate"` NativeToken Asset `json:"NativeToken"` // Verificationmechanism is in short notation, such as pos for proof-of-stake VerificationMechanism VerificationMechanism `json:"VerificationMechanism"` // ChainID refers to EVM based chains and is thereby optional. ChainID string `json:"ChainID"` }
BlockChain is the type for blockchains. Uniquely defined by its @Name.
func (*BlockChain) MarshalBinary ¶ added in v1.2.0
func (bc *BlockChain) MarshalBinary() ([]byte, error)
MarshalBinary is a custom marshaller for BlockChain type
func (*BlockChain) UnmarshalBinary ¶ added in v1.2.0
func (bc *BlockChain) UnmarshalBinary(data []byte) error
UnmarshalBinary is a custom unmarshaller for BlockChain type
type BlockData ¶ added in v1.2.0
type BlockData struct { // Name of the blockchain, as found for instance in dia.ETHEREUM BlockchainName string // In order to keep it general, BlockNumber is a string BlockNumber int64 Data map[string]interface{} }
BlockData stores information on a specific block in a given blockchain.
type ChainConfig ¶ added in v1.4.2
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithUrl ¶
func (*Client) SendSupply ¶
type ConfigApi ¶
func GetConfigApi ¶
func GetConfigApi() *ConfigApi
func GetConfigFromEnv ¶ added in v1.2.0
type ConfigConnector ¶
type ConfigConnector struct {
Coins []ExchangePair
}
type EthereumBlockData ¶ added in v1.2.0
type EthereumBlockData struct { GasLimit uint64 `json:"gas_limit"` GasUsed uint64 `json:"gas_used"` Difficulty *big.Int `json:"difficulty"` Time uint64 `json:"time"` Size common.StorageSize `json:"size"` Number uint64 `json:"number"` MixDigest common.Hash `json:"mix_digest"` Nonce uint64 `json:"nonce"` Coinbase common.Address `json:"coinbase"` Root common.Hash `json:"root"` ParentHash common.Hash `json:"parent_hash"` TxHash common.Hash `json:"tx_hash"` ReceiptHash common.Hash `json:"receipt_hash"` UncleHash common.Hash `json:"uncle_hash"` Extra []byte `json:"extra"` }
type Exchange ¶
type Exchange struct { Name string `json:"Name"` Centralized bool `json:"Centralized"` Bridge bool `json:"Bridge"` Contract string `json:"Contract"` BlockChain BlockChain `json:"BlockChain"` RestAPI string `json:"RestAPI"` WsAPI string `json:"WsAPI"` PairsAPI string `json:"PairsAPI"` WatchdogDelay int `json:"WatchdogDelay"` }
type ExchangePair ¶ added in v1.2.0
type ExchangePair struct { Symbol string ForeignName string Exchange string Verified bool UnderlyingPair Pair }
ExchangePair is the container for a pair as used by exchanges. Across exchanges, these pairs cannot be uniquely mapped on asset pairs.
func MergeExchangePairs ¶ added in v1.2.0
func MergeExchangePairs(pairs1, pairs2 []ExchangePair) []ExchangePair
MergeExchangePairs appends @pairs2 to @pairs1 without repetition.
func (*ExchangePair) MarshalBinary ¶ added in v1.2.0
func (ep *ExchangePair) MarshalBinary() ([]byte, error)
MarshalBinary is a custom marshaller for ExchangePair type
func (*ExchangePair) UnmarshalBinary ¶ added in v1.2.0
func (ep *ExchangePair) UnmarshalBinary(data []byte) error
UnmarshalBinary is a custom unmarshaller for ExchangePair type
type ExchangeVolume ¶ added in v1.4.2
type ExchangeVolumesList ¶ added in v1.4.2
type ExchangeVolumesList struct { Volumes []ExchangeVolume `json:"Volumes"` Timestamp time.Time `json:"Timestamp"` }
type FilterPoint ¶
type FilterPoint struct { Asset Asset Value float64 Name string Time time.Time Max float64 Min float64 FirstTrade Trade LastTrade Trade }
FilterPoint contains the resulting value of a filter applied to an asset.
type FilterPointMetadata ¶ added in v1.4.2
func NewFilterPointMetadata ¶ added in v1.4.2
func NewFilterPointMetadata() *FilterPointMetadata
func (*FilterPointMetadata) AddPoint ¶ added in v1.4.2
func (fp *FilterPointMetadata) AddPoint(value float64)
type FiltersBlock ¶
type FiltersBlock struct { BlockHash string FiltersBlockData FiltersBlockData }
func (*FiltersBlock) MarshalBinary ¶
func (e *FiltersBlock) MarshalBinary() ([]byte, error)
MarshalBinary -
func (*FiltersBlock) UnmarshalBinary ¶
func (e *FiltersBlock) UnmarshalBinary(data []byte) error
UnmarshalBinary -
type FiltersBlockData ¶
type IndexBlock ¶
type IndexBlock struct { BlockHash string IndexBlockData IndexBlockData }
func (IndexBlock) Hash ¶
func (ib IndexBlock) Hash() string
func (*IndexBlock) MarshalBinary ¶
func (e *IndexBlock) MarshalBinary() ([]byte, error)
MarshalBinary -
func (*IndexBlock) UnmarshalBinary ¶
func (e *IndexBlock) UnmarshalBinary(data []byte) error
UnmarshalBinary -
type IndexBlockData ¶
type IndexElement ¶
type IndexElement struct { Name string Symbol string Percentage float64 FilteredPoint FilterPoint Supply Supply VolatilityRatio VolatilityRatio }
type NFT ¶
type NFT struct { NFTClass NFTClass TokenID string CreationTime time.Time CreatorAddress string URI string // @Attributes is a collection of attributes from on- and off-chain // TO DO: Should we split up into two fields? Attributes NFTAttributes }
NFT is the container for a specific NFT defined by the pair (address,tokenID).
func (*NFT) UnmarshalBinary ¶
UnmarshalBinary for NFT
type NFTAttributes ¶
type NFTAttributes map[string]interface{}
NFTAttributes can be stored as jasonb in postgres: https://www.alexedwards.net/blog/using-postgresql-jsonb
func (*NFTAttributes) Scan ¶
func (a *NFTAttributes) Scan(value interface{}) error
type NFTBid ¶ added in v1.2.0
type NFTBid struct { NFT NFT Value *big.Int FromAddress string CurrencySymbol string CurrencyAddress string CurrencyDecimals int32 BlockNumber uint64 BlockPosition uint64 Timestamp time.Time TxHash string Exchange string }
func (*NFTBid) MarshalBinary ¶ added in v1.2.0
MarshalBinary for NFTBid
func (*NFTBid) UnmarshalBinary ¶ added in v1.2.0
UnmarshalBinary for NFTBid
type NFTClass ¶
type NFTClass struct { Address string Symbol string Name string Blockchain string ContractType string Category string }
NFTClass is the container for an nft class defined by a contract (address) on a blockchain.
func (*NFTClass) MarshalBinary ¶
MarshalBinary for NFTClass
func (*NFTClass) UnmarshalBinary ¶
UnmarshalBinary for NFTClass
type NFTOffer ¶ added in v1.2.0
type NFTOffer struct { NFT NFT // Start and EndValue are for auction types. Otherwise, use StartValue // and leave EndValue blank. StartValue *big.Int EndValue *big.Int // Duration of the offer/auction measured in seconds Duration time.Duration FromAddress string // Type of offer can be auction, simple offer,... AuctionType string CurrencySymbol string CurrencyAddress string CurrencyDecimals int32 BlockNumber uint64 BlockPosition uint64 Timestamp time.Time TxHash string Exchange string }
func (*NFTOffer) MarshalBinary ¶ added in v1.2.0
MarshalBinary for NFTOffer
func (*NFTOffer) UnmarshalBinary ¶ added in v1.2.0
UnmarshalBinary for NFTOffer
type NFTTrade ¶
type NFTTrade struct { NFT NFT Price *big.Int PriceUSD float64 FromAddress string ToAddress string Currency Asset BundleSale bool BlockNumber uint64 Timestamp time.Time TxHash string Exchange string }
func (*NFTTrade) MarshalBinary ¶
MarshalBinary for NFTTrade
func (*NFTTrade) UnmarshalBinary ¶
UnmarshalBinary for NFTTrade
type Pair ¶
Pair substitues the old dia.Pair. It includes the new asset type.
func (*Pair) ForeignName ¶
ForeignName returns the foreign name of the pair @p, i.e. the string Quotetoken-Basetoken
type PairVolume ¶ added in v1.4.2
type PairVolumesList ¶ added in v1.4.2
type PairVolumesList struct { Volumes []PairVolume `json:"Volumes"` Timestamp time.Time `json:"Timestamp"` }
type Pool ¶ added in v1.4.2
type Pool struct { Exchange Exchange Blockchain BlockChain Address string // Assetvolumes map[Asset]float64 Assetvolumes []AssetVolume Time time.Time }
Pool is the container for liquidity pools on DEXes.
type SuppliesBlock ¶
type SuppliesBlock struct { BlockHash string BlockData SuppliesBlockData }
func (*SuppliesBlock) MarshalBinary ¶
func (e *SuppliesBlock) MarshalBinary() ([]byte, error)
MarshalBinary -
func (*SuppliesBlock) UnmarshalBinary ¶
func (e *SuppliesBlock) UnmarshalBinary(data []byte) error
UnmarshalBinary -
type SuppliesBlockData ¶
type Supply ¶
type Supply struct { Asset Asset Supply float64 CirculatingSupply float64 Source string Time time.Time }
func (*Supply) UnmarshalBinary ¶
UnmarshalBinary -
type SynthAssetSupply ¶ added in v1.4.2
type SynthAssetSupply struct { Asset Asset // Synthetic asset under consideration. AssetUnderlying Asset // Asset underlying the synth asset. Supply float64 // Supply of the synthetic asset. LockedUnderlying float64 // Amount of underlying asset locked in the contract. NumMint int64 // Total number of synth asset mint events (optional). NumRedeem int64 // Total number of underlying asset redeem events (optional). BlockNumber uint64 Time time.Time ColleteralRatio float64 Protocol string }
SynthAssetSupply is a container for data on synthetic assets such as aUSDC. https://etherscan.io/address/0xbcca60bb61934080951369a648fb03df4f96263c
type Trade ¶
type Trade struct { // TO DO: Deprecated fields. Delete as soon as token-to-type branch is deployed. Symbol string Pair string // Final fields for trade QuoteToken Asset BaseToken Asset Price float64 Volume float64 // Quantity of bought/sold units of Quote token. Negative if result of Market order Sell Time time.Time ForeignTradeID string EstimatedUSDPrice float64 // will be filled by the TradesBlockService Source string VerifiedPair bool // will be filled by the pairDiscoveryService }
Trade remark: In a pair A-B, we call A the Quote token and B the Base token
func (*Trade) GetBaseToken ¶ added in v1.2.0
GetBaseToken returns the base token of a trading pair TO DO (20/11/2020): This method is no longer needed once we switch to new Token/Trade structs
func (*Trade) UnmarshalBinary ¶
UnmarshalBinary -
type TradesBlock ¶
type TradesBlock struct { BlockHash string TradesBlockData TradesBlockData }
func (*TradesBlock) MarshalBinary ¶
func (e *TradesBlock) MarshalBinary() ([]byte, error)
MarshalBinary -
func (*TradesBlock) UnmarshalBinary ¶
func (e *TradesBlock) UnmarshalBinary(data []byte) error
UnmarshalBinary -
type TradesBlockData ¶
type TradesDistribution ¶ added in v1.4.2
type TradesDistribution struct { Asset Asset `json:"Asset"` NumTradesTotal int `json:"NumTradesTotal"` NumLowBins int `json:"NumberLowBins"` Threshold int `json:"Threshold"` SizeBinSeconds int64 `json:"SizeBin"` AvgNumPerBin float64 `json:"AverageNumberPerBin"` StdDeviation float64 `json:"StandardDeviation"` TimeRangeSeconds int64 `json:"TimeRangeSeconds"` Timestamp time.Time `json:"Timestamp"` }
type VerificationMechanism ¶
type VerificationMechanism string