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 Asset
- type AssetLiquidity
- 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 NFTExchange
- type NFTExchangeStats
- type NFTOffer
- type NFTTrade
- type OracleConfig
- type Pair
- type PairVolume
- type PairVolumesList
- type Pairs
- type Pool
- type SuppliesBlock
- type SuppliesBlockData
- type Supply
- type Symbols
- type SynthAssetSupply
- type TopAsset
- type Trade
- func (t *Trade) GetBaseToken() string
- func (t *Trade) IdentifyDuplicateFull(falseDuplicateTrades *timedmap.TimedMap, memory time.Duration) (discardTrade bool)
- func (t *Trade) IdentifyDuplicateTagset(duplicateTrades *timedmap.TimedMap, memory time.Duration)
- func (e *Trade) MarshalBinary() ([]byte, error)
- func (t *Trade) TradeIdentifierFull() string
- func (t *Trade) TradeIdentifierTagset() string
- func (e *Trade) UnmarshalBinary(data []byte) error
- type TradesBlock
- type TradesBlockData
- type VerificationMechanism
- type VolatilityRatio
Constants ¶
const ( ArthswapExchange = "Arthswap" DiffusionExchange = "Diffusion" OmniDexExchange = "OmniDex" NetswapExchange = "Netswap" TethysExchange = "Tethys" HermesExchange = "Hermes" AnyswapExchange = "Anyswap" BalancerExchange = "Balancer" BalancerV2Exchange = "BalancerV2" BalancerV2ExchangeArbitrum = "BalancerV2-Arbitrum" BalancerV2ExchangePolygon = "BalancerV2-Polygon" BeetsExchange = "Beets" KrakenExchange = "Kraken" BitfinexExchange = "Bitfinex" BitforexExchange = "Bitforex" BinanceExchange = "Binance" Binance2Exchange = "Binance2" BinanceExchangeUS = "BinanceUS" BitstampExchange = "Bitstamp" CryptoDotComExchange = "Crypto.com" FTXExchange = "FTX" Opyn = "OPYN" Premia = "Premia" BitBayExchange = "BitBay" BittrexExchange = "Bittrex" CoinBaseExchange = "CoinBase" HitBTCExchange = "HitBTC" HuckleberryExchange = "Huckleberry" TraderJoeExchange = "TraderJoe" PangolinExchange = "Pangolin" PlatypusExchange = "PlatypusFinance" 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" UniswapExchangeV3Arbitrum = "UniswapV3-Arbitrum" LoopringExchange = "Loopring" CamelotExchange = "Camelot" CurveFIExchange = "Curvefi" CurveFIExchangeFantom = "Curvefi-Fantom" CurveFIExchangeMoonbeam = "Curvefi-Moonbeam" CurveFIExchangePolygon = "Curvefi-Polygon" CurveFIExchangeArbitrum = "Curvefi-Arbitrum" 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" BKEXExchange = "BKEX" BKEX2Exchange = "BKEX2" CREX24Exchange = "CREX24" STEXExchange = "STEX" Deribit = "Deribit" DfynNetwork = "DFYN" UbeswapExchange = "Ubeswap" SpookyswapExchange = "Spookyswap" SpiritswapExchange = "Spiritswap" QuickswapExchange = "Quickswap" SerumExchange = "Serum" OrcaExchange = "Orca" SolarbeamExchange = "Solarbeam" TrisolarisExchange = "Trisolaris" ByBitExchange = "ByBit" BitMexExchange = "BitMex" MultiChain = "MultiChain" StellaswapExchange = "Stellaswap" WanswapExchange = "Wanswap" OsmosisExchange = "Osmosis" )
const ( CryptoPunks = "CryptopunkMarket" CryptoKitties = "CryptoKitties" Topshot = "Topshot" X2Y2 = "X2Y2" Opensea = "OpenSea" OpenseaBAYC = "OpenseaBAYC" OpenseaSeaport = "OpenseaSeaport" BlurV1 = "BlurV1" LooksRare = "LooksRare" TofuNFTAstar = "TofuNFT-Astar" TofuNFTBinanceSmartChain = "TofuNFT-BinanceSmartChain" MagicEden = "MagicEden" )
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" WANCHAIN = "Wanchain" OSMOSIS = "Osmosis" 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 Asset ¶ added in v1.2.0
type Asset struct { Symbol string `json:"Symbol"` Name string `json:"Name"` Address string `json:"Address"` Decimals uint8 `json:"Decimals"` Blockchain string `json:"Blockchain"` }
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) Identifier ¶ added in v1.4.159
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 AssetLiquidity ¶ added in v1.4.68
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:"GasLimit"` GasUsed uint64 `json:"GasUsed"` Difficulty *big.Int `json:"Difficulty"` Time uint64 `json:"Time"` Size common.StorageSize `json:"Size"` Number uint64 `json:"Number"` MixDigest common.Hash `json:"MixDigest"` Nonce uint64 `json:"Nonce"` Coinbase common.Address `json:"Coinbase"` Root common.Hash `json:"Root"` ParentHash common.Hash `json:"ParentHash"` TxHash common.Hash `json:"TxHash"` ReceiptHash common.Hash `json:"ReceiptHash"` UncleHash common.Hash `json:"UncleHash"` 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"` ScraperActive bool `json:"ScraperActive"` }
type ExchangePair ¶ added in v1.2.0
type ExchangePair struct { Symbol string `json:"Symbol"` ForeignName string `json:"ForeignName"` Exchange string `json:"EXchange"` Verified bool `json:"Verified"` UnderlyingPair Pair `json:"UnderlyingPair"` }
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 `json:"BlockHash"` IndexBlockData IndexBlockData `json:"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 IndexBlockData struct { FiltersBlockHash string `json:"FiltersBlockHash"` SuppliesBlockHash string `json:"SuppliesBlockHash"` VolatilityBlockHash string `json:"VolatilityBlockHash"` IndexElements []IndexElement `json:"IndexElements"` IndexElementsNumber int `json:"IndexElementsNumber"` Time time.Time `json:"Time"` IndexValue float64 `json:"IndexValue"` ValueTokenette float64 `json:"ValueTokenette"` ValueToken float64 `json:"ValueToken"` USDPerPointsOfIndex float64 `json:"USDPerPointsOfIndex"` }
type IndexElement ¶
type IndexElement struct { Name string Symbol string Percentage float64 FilteredPoint FilterPoint Supply Supply VolatilityRatio VolatilityRatio }
type NFT ¶
type NFT struct { NFTClass NFTClass `json:"NFTClass"` TokenID string `json:"TokenID"` CreationTime time.Time `json:"CreationTme"` CreatorAddress string `json:"CreatorAddress"` URI string `json:"URI"` // @Attributes is a collection of attributes from on- and off-chain // TO DO: Should we split up into two fields? Attributes NFTAttributes `json:"Attributes"` }
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 `json:"NFT"` Value *big.Int `json:"Value"` FromAddress string `json:"FromAddress"` CurrencySymbol string `json:"CurrencySymbol"` CurrencyAddress string `json:"CurrencyAddress"` CurrencyDecimals int32 `json:"CurrencyDecimals"` BlockNumber uint64 `json:"BlockNumber"` BlockPosition uint64 `json:"BlockPosition"` Timestamp time.Time `json:"Timestamp"` TxHash string `json:"TxHash"` Exchange string `json:"Exchange"` }
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 `json:"Address"` Symbol string `json:"Symbol"` Name string `json:"Name"` Blockchain string `json:"Blockchain"` ContractType string `json:"ContractType"` Category string `json:"Category"` }
NFTClass is the container for a nft class defined by a contract (address) on a blockchain.
func (*NFTClass) MarshalBinary ¶
MarshalBinary for NFTClass
func (*NFTClass) UnmarshalBinary ¶
UnmarshalBinary for NFTClass
type NFTExchange ¶ added in v1.4.7
type NFTExchangeStats ¶ added in v1.4.2
type NFTOffer ¶ added in v1.2.0
type NFTOffer struct { NFT NFT `json:"NFT"` // Start and EndValue are for auction types. Otherwise, use StartValue // and leave EndValue blank. StartValue *big.Int `json:"StartValue"` EndValue *big.Int `json:"EndValue"` // Duration of the offer/auction measured in seconds Duration time.Duration `json:"Duration"` FromAddress string `json:"FromAddress"` // Type of offer can be auction, simple offer,... AuctionType string `json:"AuctionType"` CurrencySymbol string `json:"CurrencySymbol"` CurrencyAddress string `json:"CurrencyAddress"` CurrencyDecimals int32 `json:"CurrencyDecimals"` BlockNumber uint64 `json:"BlockNumber"` BlockPosition uint64 `json:"BlockPosition"` Timestamp time.Time `json:"Timestamp"` TxHash string `json:"TxHash"` Exchange string `json:"Exchange"` }
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 `json:"NFT"` Price *big.Int `json:"Price"` PriceUSD float64 `json:"PriceUSD"` FromAddress string `json:"FromAddress"` ToAddress string `json:"ToAddress"` Currency Asset `json:"Currency"` BundleSale bool `json:"BundleSale"` BlockNumber uint64 `json:"BlockNumber"` Timestamp time.Time `json:"Timestamp"` TxHash string `json:"TxHash"` Exchange string `json:"Exchange"` }
func (*NFTTrade) MarshalBinary ¶
MarshalBinary for NFTTrade
func (*NFTTrade) UnmarshalBinary ¶
UnmarshalBinary for NFTTrade
type OracleConfig ¶ added in v1.4.117
type OracleConfig struct { Symbols []string FeederID string Address string FeederAddress string Owner string ChainID string Active bool Frequency string SleepSeconds string DeviationPermille string BlockchainNode string MandatoryFrequency string CreatedDate time.Time LastUpdate time.Time Deleted bool `json:"Deleted,omitempty"` }
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
func (*Pair) Identifier ¶ added in v1.4.131
func (*Pair) PairExchangeIdentifier ¶ added in v1.4.131
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 []AssetVolume Time time.Time }
Pool is the container for liquidity pools on DEXes.
type SuppliesBlock ¶
type SuppliesBlock struct { BlockHash string `json:"BlockHash"` BlockData SuppliesBlockData `json:"BlockData"` }
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 `json:"Asset"` Supply float64 `json:"Supply"` CirculatingSupply float64 `json:"CirculatingSupply"` Source string `json:"Source"` Time time.Time `json:"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 TotalDebt float64 }
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 `json:"Symbol"` Pair string `json:"Pair"` // Final fields for trade QuoteToken Asset `json:"QuoteToken"` BaseToken Asset `json:"BaseToken"` Price float64 `json:"Price"` Volume float64 `json:"Volume"` // Quantity of bought/sold units of Quote token. Negative if result of Market order Sell Time time.Time `json:"Time"` ForeignTradeID string `json:"ForeignTradeID"` EstimatedUSDPrice float64 `json:"EstimatedUSDPrice"` // will be filled by the TradesBlockService Source string `json:"Source"` VerifiedPair bool `json:"VerifiedPair"` // 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) IdentifyDuplicateFull ¶ added in v1.4.136
func (t *Trade) IdentifyDuplicateFull(falseDuplicateTrades *timedmap.TimedMap, memory time.Duration) (discardTrade bool)
IdentifyDuplicateFull returns true in case a trade is fully identical to one stored in the timed map @falseDuplicateTrades.
func (*Trade) IdentifyDuplicateTagset ¶ added in v1.4.136
IdentifyDuplicateTagset identifies trades with identical timestamps and tagsets and add a Nanosecond to the timestamp in order for the trade not to be overwritten in Influx.
func (*Trade) TradeIdentifierFull ¶ added in v1.4.136
TradeIdentifierFull returns an identifier with respect to all fields of a trade.
func (*Trade) TradeIdentifierTagset ¶ added in v1.4.136
TradeIdentifierTagset returns an identifier with respect to the tagset of a trade in Influx. In other words, a trade with this same tagset is overwritten in Influx trades table.
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 VerificationMechanism ¶
type VerificationMechanism string