Documentation ¶
Index ¶
- Constants
- Variables
- 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 AssetList
- type AssetVolume
- type BlockChain
- type BlockData
- type ChainConfig
- type Client
- type ConfigApi
- type ConfigConnector
- type EthereumBlockData
- type Exchange
- type ExchangeList
- type ExchangePair
- type ExchangeVolume
- type ExchangeVolumesList
- type ExchangepairSelection
- type FeedSelection
- type FeedSelectionAggregated
- type FeedUpdates
- type FilterPoint
- type FilterPointExtended
- type FilterPointMetadata
- type FiltersBlock
- type FiltersBlockData
- type IndexBlock
- type IndexBlockData
- type IndexElement
- type OracleConfig
- type OracleUpdate
- type Pair
- type PairVolume
- type Pairs
- type Pool
- type SuppliesBlock
- type SuppliesBlockData
- type Supply
- type Symbols
- 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) NormalizeSymbols(upperCase bool, pairSplitter string) error
- func (t *Trade) TradeIdentifierFull() string
- func (t *Trade) TradeIdentifierTagset() string
- func (e *Trade) UnmarshalBinary(data []byte) error
- func (t *Trade) VolumeUSD() float64
- 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" CoinBaseExchange = "CoinBase" HitBTCExchange = "HitBTC" HuckleberryExchange = "Huckleberry" TraderJoeExchange = "TraderJoe" TraderJoeExchangeV2_1 = "TraderJoeV2.1" TraderJoeExchangeV2_1Arbitrum = "TraderJoeV2.1-Arbitrum" TraderJoeExchangeV2_1Avalanche = "TraderJoeV2.1-Avalanche" TraderJoeExchangeV2_1BNB = "TraderJoeV2.1-BNB" TraderJoeExchangeV2_2Avalanche = "TraderJoeV2.2-Avalanche" 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" UniswapExchangeBase = "Uniswap-Base" UniswapExchangeV3 = "UniswapV3" UniswapExchangeV3Polygon = "UniswapV3-polygon" UniswapExchangeV3Arbitrum = "UniswapV3-Arbitrum" UniswapExchangeV3Base = "UniswapV3-Base" LoopringExchange = "Loopring" CamelotExchange = "Camelot" CamelotExchangeV3 = "CamelotV3" 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" PanCakeSwapExchangeV3 = "PanCakeSwapV3" 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" ZenlinkswapExchange = "Zenlink" ZenlinkswapExchangeBifrostPolkadot = "Zenlink-bifrost-polkadot" VelodromeExchange = "Velodrome" VelodromeSlipstreamExchange = "VelodromeSlipstream" MaverickExchange = "Maverick" MaverickExchangeZKSync = "Maverick-zksync" MaverickExchangeBNB = "Maverick-bnb" PearlfiExchangeTestnet = "Pearlfi-Testnet" PearlfiExchange = "Pearlfi" PearlfiStableswapExchange = "PearlfiStableswap" RamsesV1Exchange = "RamsesV1" RamsesV2Exchange = "RamsesV2" NileV1Exchange = "NileV1" NileV2Exchange = "NileV2" ThenaExchange = "Thena" ThenaV3Exchange = "ThenaV3" AyinExchange = "Ayin" BitflowExchange = "Bitflow" BitgetExchange = "Bitget" VelarExchange = "Velar" AerodromeSlipstreamExchange = "AerodromeSlipstream" AerodromeV1Exchange = "AerodromeV1" BifrostExchange = "Bifrost" HydrationExchange = "Hydration" )
const ( SCRAPER_TYPE_ASSETCOLLECTOR = "assetcollector" SCRAPER_TYPE_LIQUIDITYSCRAPER = "liquidityscraper" INDEX_TYPE_BLOCKNUMBER = "blocknumber" INDEX_TYPE_INDEX = "index" )
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" BIFROST = "Bifrost" BIFROST_POLKADOT = "Bifrost-polkadot" UNREAL_TESTNET = "Unreal-Testnet" UNREAL = "Unreal" LINEA = "Linea" OPTIMISM = "Optimism" ALEPHIUM = "Alephium" BASE = "Base" FILECOIN = "Filecoin" HYDRATION = "Hydration" )
const BaseUrl string = "https://api.diadata.org/"
Variables ¶
var CRYPTO_ZERO_UNIX_TIME = time.Unix(1230768000, 0)
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 AssetList ¶ added in v1.4.488
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 ExchangeList ¶ added in v1.4.488
func (ExchangeList) String ¶ added in v1.4.490
func (e ExchangeList) String() string
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 ExchangepairSelection ¶ added in v1.4.305
type FeedSelection ¶ added in v1.4.305
type FeedSelection struct { Asset Asset Exchangepairs []ExchangepairSelection LiquidityThreshold float64 }
type FeedSelectionAggregated ¶ added in v1.4.429
type FeedUpdates ¶ added in v1.4.435
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 FilterPointExtended ¶ added in v1.4.310
type FilterPointExtended struct { FilterPoint FilterPoint // Pools and pairs of the filter point's underlying trades. Pools []Pool Pairs []ExchangePair TradesCount int32 StatusMessage string StatusCode int32 }
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 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 Draft bool FeederSelection string Expired bool ExpiredDate time.Time ExpiringDate time.Time LastOracleUpdate time.Time CustomerID string Billable bool Name string Ecosystem bool }
func (*OracleConfig) MarshalBinary ¶ added in v1.4.439
func (e *OracleConfig) MarshalBinary() ([]byte, error)
func (*OracleConfig) UnmarshalBinary ¶ added in v1.4.439
func (e *OracleConfig) UnmarshalBinary(data []byte) error
UnmarshalBinary -
type OracleUpdate ¶ added in v1.4.272
type OracleUpdate struct { OracleAddress string TransactionHash string TransactionCost string AssetKey string AssetPrice string UpdateBlock uint64 UpdateFrom string FromBalance string GasCost string GasUsed float64 ChainID string UpdateTime time.Time CreationBlock uint64 CreationBlockTime time.Time }
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 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.
func (*Pool) GetPoolLiquidityUSD ¶ added in v1.4.306
GetPoolLiquidityUSD returns the total USD liquidity if available. @lowerBound is true in case USD liquidity is not available for all pool assets.
func (*Pool) SufficientNativeBalance ¶ added in v1.4.292
SufficientNativeBalance returns true if all pool assets have at least @threshold liquidity.
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 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"` PoolAddress string `json:"PoolAddress"` 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) NormalizeSymbols ¶ added in v1.4.320
NormalizeSymbols normalizes @t.Symbol and @t.Pair in a trade struct to upper case letters like so A@pairSplitterB. For instance, btcusdt will be BTC-USDT.
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
Directories ¶
Path | Synopsis |
---|---|
substrate-helper/gsrpc/gethrpc
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
|
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports. |
scraper
|
|
service
|
|