Documentation ¶
Index ¶
- Constants
- func ContainsExchangePair(pairs []ExchangePair, pair ExchangePair) bool
- func Exchanges() []string
- func GetAllSymbolsFromPairs(pairs []ExchangePair) ([]string, error)
- func GetPairSymbols(pair ExchangePair) ([]string, error)
- func GetSymbolsList(url string) ([]string, error)
- type Asset
- type BlockChain
- type Client
- type ConfigApi
- type ConfigConnector
- type CviDataPoint
- type DefiProtocol
- type DefiProtocolState
- type DefiRate
- type Exchange
- type ExchangePair
- type FilterPoint
- type FiltersBlock
- type FiltersBlockData
- type IndexBlock
- type IndexBlockData
- type IndexElement
- type ItinToken
- type NFT
- type NFTClass
- type NFTTrade
- type OptionMeta
- type OptionMetaForward
- type OptionMetaIndex
- type OptionOrderbookDatum
- type OptionType
- type Pair
- type Pairs
- type SuppliesBlock
- type SuppliesBlockData
- type Supply
- type Symbols
- type Trade
- type TradesBlock
- type TradesBlockData
- type VerificationMechanism
- type VolatilityRatio
Constants ¶
const ( BalancerExchange = "Balancer" GnosisExchange = "Gnosis" KrakenExchange = "Kraken" BitfinexExchange = "Bitfinex" BinanceExchange = "Binance" BitBayExchange = "BitBay" BittrexExchange = "Bittrex" CoinBaseExchange = "CoinBase" HitBTCExchange = "HitBTC" SimexExchange = "Simex" OKExExchange = "OKEx" HuobiExchange = "Huobi" LBankExchange = "LBank" GateIOExchange = "GateIO" ZBExchange = "ZB" QuoineExchange = "Quoine" UnknownExchange = "Unknown" BlockSizeSeconds = 120 FilterKing = "MA120" BancorExchange = "Bancor" UniswapExchange = "Uniswap" LoopringExchange = "Loopring" CurveFIExchange = "Curvefi" MakerExchange = "Maker" KuCoinExchange = "KuCoin" SushiSwapExchange = "SushiSwap" PanCakeSwap = "PanCakeSwap" DforceExchange = "Dforce" ZeroxExchange = "0x" KyberExchange = "Kyber" BitMaxExchange = "Bitmax" CREX24Exchange = "CREX24" STEXExchange = "STEX" )
const ( Diadata = "diadata.org" PROOF_OF_STAKE VerificationMechanism = "pos" PROOF_OF_WORK VerificationMechanism = "pow" BITCOIN = "Bitcoin" ETHEREUM = "Ethereum" BINANCESMARTCHAIN = "BinanceSmartChain" 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
Asset is the data type for all assets, ranging from fiat to crypto.
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 BlockChain ¶
type BlockChain struct { Name string `json:"Name"` GenesisDate time.Time `json:"GenesisDate"` NativeToken string `json:"NativeToken"` VerificationMechanism VerificationMechanism `json:"VerificationMechanism"` }
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 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 CviDataPoint ¶
type DefiProtocol ¶
func (*DefiProtocol) MarshalBinary ¶
func (e *DefiProtocol) MarshalBinary() ([]byte, error)
MarshalBinary for DefiProtocol
func (*DefiProtocol) UnmarshalBinary ¶
func (e *DefiProtocol) UnmarshalBinary(data []byte) error
UnmarshalBinary for DefiProtocol
type DefiProtocolState ¶
type DefiProtocolState struct { TotalUSD float64 TotalETH float64 Timestamp time.Time Protocol DefiProtocol }
func (*DefiProtocolState) MarshalBinary ¶
func (e *DefiProtocolState) MarshalBinary() ([]byte, error)
MarshalBinary for DefiProtocolState
func (*DefiProtocolState) UnmarshalBinary ¶
func (e *DefiProtocolState) UnmarshalBinary(data []byte) error
UnmarshalBinary for DefiProtocolState
type DefiRate ¶
type DefiRate struct { Timestamp time.Time LendingRate float64 BorrowingRate float64 Asset string Protocol string }
func (*DefiRate) MarshalBinary ¶
MarshalBinary for DefiRate
func (*DefiRate) UnmarshalBinary ¶
UnmarshalBinary for DefiRate
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 FilterPoint ¶
FilterPoint contains the resulting value of a filter applied to an asset.
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 ItinToken ¶
type ItinToken struct { Itin string Symbol string Label string Url_website string Coinmarketcap_url string Coinmarketcap_slug string }
func (*ItinToken) MarshalBinary ¶
MarshalBinary -
func (*ItinToken) UnmarshalBinary ¶
UnmarshalBinary -
type NFT ¶
type NFT struct { NFTClass NFTClass TokenID uint64 CreationTime time.Time CreatorAddress common.Address URI string Attributes []byte }
NFT is the container for a specific NFT defined by the pair (address,tokenID).
func (*NFT) MarshalBinary ¶
MarshalBinary for DefiProtocolState
func (*NFT) UnmarshalBinary ¶
UnmarshalBinary for DefiProtocolState
type NFTClass ¶
type NFTClass struct { Address common.Address 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 DefiProtocolState
func (*NFTClass) UnmarshalBinary ¶
UnmarshalBinary for DefiProtocolState
type NFTTrade ¶
type NFTTrade struct { NFT NFT BlockNumber *big.Int PriceUSD float64 FromAddress common.Address ToAddress common.Address Exchange string }
func (*NFTTrade) MarshalBinary ¶
MarshalBinary for DefiProtocolState
func (*NFTTrade) UnmarshalBinary ¶
UnmarshalBinary for DefiProtocolState
type OptionMeta ¶
type OptionMeta struct { InstrumentName string BaseCurrency string ExpirationTime time.Time StrikePrice float64 OptionType OptionType }
func (*OptionMeta) MarshalBinary ¶
func (e *OptionMeta) MarshalBinary() ([]byte, error)
func (*OptionMeta) UnmarshalBinary ¶
func (e *OptionMeta) UnmarshalBinary(data []byte) error
type OptionMetaForward ¶
type OptionMetaIndex ¶
type OptionMetaIndex struct { OptionMeta OptionOrderbookDatum }
type OptionOrderbookDatum ¶
type OptionType ¶
type OptionType int
const ( CallOption OptionType = iota + 1 PutOption )
signals if the option is call or a put
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 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 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 VerificationMechanism ¶
type VerificationMechanism string