origins

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2022 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

TODO: check if it's possible to merge coinbase and coinbasepro

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyOriginResponse = fmt.Errorf("empty origin response received")
View Source
var ErrInvalidPrice = fmt.Errorf("invalid price from origin")
View Source
var ErrInvalidResponseStatus = fmt.Errorf("invalid response status from origin")
View Source
var ErrMissingResponseForPair = fmt.Errorf("no response for pair from origin")
View Source
var ErrUnknownOrigin = errors.New("unknown origin")

Functions

This section is empty.

Types

type Balancer

type Balancer struct {
	WorkerPool        query.WorkerPool
	BaseURL           string
	ContractAddresses ContractAddresses
}

func (Balancer) Pool

func (s Balancer) Pool() query.WorkerPool

func (Balancer) PullPrices

func (s Balancer) PullPrices(pairs []Pair) []FetchResult

type BalancerV2

type BalancerV2 struct {
	ContractAddresses ContractAddresses
	// contains filtered or unexported fields
}

func NewBalancerV2

func NewBalancerV2(ethClient ethereum.Client, addrs ContractAddresses, blocks []int64) (*BalancerV2, error)

func (BalancerV2) PullPrices

func (s BalancerV2) PullPrices(pairs []Pair) []FetchResult

type BaseExchangeHandler

type BaseExchangeHandler struct {
	ExchangeHandler
	// contains filtered or unexported fields
}

func NewBaseExchangeHandler

func NewBaseExchangeHandler(handler ExchangeHandler, aliases SymbolAliases) *BaseExchangeHandler

func (BaseExchangeHandler) Fetch

func (h BaseExchangeHandler) Fetch(pairs []Pair) []FetchResult

type Binance

type Binance struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Binance origin handler

func (Binance) Pool

func (b Binance) Pool() query.WorkerPool

func (Binance) PullPrices

func (b Binance) PullPrices(pairs []Pair) []FetchResult

type BitThump

type BitThump struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Bithumb origin handler

func (BitThump) Pool

func (c BitThump) Pool() query.WorkerPool

func (BitThump) PullPrices

func (c BitThump) PullPrices(pairs []Pair) []FetchResult

type Bitfinex

type Bitfinex struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (Bitfinex) Pool

func (b Bitfinex) Pool() query.WorkerPool

func (Bitfinex) PullPrices

func (b Bitfinex) PullPrices(pairs []Pair) []FetchResult

type Bitstamp

type Bitstamp struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Bitstamp origin handler

func (Bitstamp) Pool

func (b Bitstamp) Pool() query.WorkerPool

func (Bitstamp) PullPrices

func (b Bitstamp) PullPrices(pairs []Pair) []FetchResult

type Bittrex

type Bittrex struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Bittrex origin handler

func (Bittrex) Pool

func (b Bittrex) Pool() query.WorkerPool

func (Bittrex) PullPrices

func (b Bittrex) PullPrices(pairs []Pair) []FetchResult

type CoinMarketCap

type CoinMarketCap struct {
	WorkerPool query.WorkerPool
	BaseURL    string
	APIKey     string
}

Exchange handler

func (CoinMarketCap) Pool

func (c CoinMarketCap) Pool() query.WorkerPool

func (CoinMarketCap) PullPrices

func (c CoinMarketCap) PullPrices(pairs []Pair) []FetchResult

type CoinbasePro

type CoinbasePro struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Coinbase origin handler

func (CoinbasePro) Pool

func (c CoinbasePro) Pool() query.WorkerPool

func (CoinbasePro) PullPrices

func (c CoinbasePro) PullPrices(pairs []Pair) []FetchResult

type ContractAddresses

type ContractAddresses map[string]string

func (ContractAddresses) AddressByPair

func (c ContractAddresses) AddressByPair(pair Pair) (ethereum.Address, bool, error)

func (ContractAddresses) ByPair

func (c ContractAddresses) ByPair(p Pair) (string, bool, bool)

type CryptoCompare

type CryptoCompare struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (CryptoCompare) Pool

func (c CryptoCompare) Pool() query.WorkerPool

func (CryptoCompare) PullPrices

func (c CryptoCompare) PullPrices(pairs []Pair) []FetchResult

type CurveFinance

type CurveFinance struct {
	// contains filtered or unexported fields
}

func NewCurveFinance

func NewCurveFinance(cli pkgEthereum.Client, addrs ContractAddresses, blocks []int64) (*CurveFinance, error)

func (CurveFinance) PullPrices

func (s CurveFinance) PullPrices(pairs []Pair) []FetchResult

type Ddex

type Ddex struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (Ddex) Pool

func (d Ddex) Pool() query.WorkerPool

func (Ddex) PullPrices

func (d Ddex) PullPrices(pairs []Pair) []FetchResult

type ExchangeHandler

type ExchangeHandler interface {
	// PullPrices is similar to Handler.Fetch
	// but pairs will be already renamed based on given BaseExchangeHandler.symbolAliases
	PullPrices(pairs []Pair) []FetchResult
}

type FetchResult

type FetchResult struct {
	Price Price
	Error error
}

type Folgory

type Folgory struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (Folgory) Pool

func (o Folgory) Pool() query.WorkerPool

func (Folgory) PullPrices

func (o Folgory) PullPrices(pairs []Pair) []FetchResult

type Fx

type Fx struct {
	WorkerPool query.WorkerPool
	BaseURL    string
	APIKey     string
}

Fx exchange handler

func (Fx) Pool

func (f Fx) Pool() query.WorkerPool

func (Fx) PullPrices

func (f Fx) PullPrices(pairs []Pair) []FetchResult

type Gateio

type Gateio struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Gateio exchange handler

func (Gateio) Pool

func (g Gateio) Pool() query.WorkerPool

func (Gateio) PullPrices

func (g Gateio) PullPrices(pairs []Pair) []FetchResult

type Gemini

type Gemini struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Gemini origin handler

func (Gemini) Pool

func (g Gemini) Pool() query.WorkerPool

func (Gemini) PullPrices

func (g Gemini) PullPrices(pairs []Pair) []FetchResult

type Handler

type Handler interface {
	// Fetch should implement making API request to origin URL and
	// collecting/parsing origin data.
	Fetch(pairs []Pair) []FetchResult
}

Handler is interface that all Origin API handlers should implement.

type Hitbtc

type Hitbtc struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Hitbtc exchange handler

func (Hitbtc) Pool

func (h Hitbtc) Pool() query.WorkerPool

func (Hitbtc) PullPrices

func (h Hitbtc) PullPrices(pairs []Pair) []FetchResult

type Huobi

type Huobi struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Huobi origin handler

func (Huobi) Pool

func (h Huobi) Pool() query.WorkerPool

func (Huobi) PullPrices

func (h Huobi) PullPrices(pairs []Pair) []FetchResult

type Kraken

type Kraken struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (Kraken) Pool

func (k Kraken) Pool() query.WorkerPool

func (Kraken) PullPrices

func (k Kraken) PullPrices(pairs []Pair) []FetchResult

type Kucoin

type Kucoin struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Kucoin origin handler

func (Kucoin) Pool

func (k Kucoin) Pool() query.WorkerPool

func (Kucoin) PullPrices

func (k Kucoin) PullPrices(pairs []Pair) []FetchResult

type Kyber

type Kyber struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (Kyber) Pool

func (k Kyber) Pool() query.WorkerPool

func (Kyber) PullPrices

func (k Kyber) PullPrices(pairs []Pair) []FetchResult

type Loopring

type Loopring struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Loopring origin handler

func (Loopring) Pool

func (l Loopring) Pool() query.WorkerPool

func (Loopring) PullPrices

func (l Loopring) PullPrices(pairs []Pair) []FetchResult

type Okex

type Okex struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Okex origin handler

func (Okex) Pool

func (o Okex) Pool() query.WorkerPool

func (Okex) PullPrices

func (o Okex) PullPrices(pairs []Pair) []FetchResult

type Okx

type Okx struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Okx origin handler

func (Okx) Pool

func (o Okx) Pool() query.WorkerPool

func (Okx) PullPrices

func (o Okx) PullPrices(pairs []Pair) []FetchResult

type OpenExchangeRates

type OpenExchangeRates struct {
	WorkerPool query.WorkerPool
	BaseURL    string
	APIKey     string
}

OpenExchangeRates origin handler

func (OpenExchangeRates) Pool

func (OpenExchangeRates) PullPrices

func (o OpenExchangeRates) PullPrices(pairs []Pair) []FetchResult

type Pair

type Pair struct {
	Base  string
	Quote string
	// contains filtered or unexported fields
}

func (Pair) Equal

func (p Pair) Equal(c Pair) bool

func (Pair) Inverse

func (p Pair) Inverse() Pair

func (Pair) String

func (p Pair) String() string

type Poloniex

type Poloniex struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

Poloniex origin handler

func (Poloniex) Pool

func (p Poloniex) Pool() query.WorkerPool

func (Poloniex) PullPrices

func (p Poloniex) PullPrices(pairs []Pair) []FetchResult

type Price

type Price struct {
	Pair      Pair
	Price     float64
	Bid       float64
	Ask       float64
	Volume24h float64
	Timestamp time.Time
}

type RocketPool

type RocketPool struct {
	// contains filtered or unexported fields
}

func NewRocketPool

func NewRocketPool(cli ethereum.Client, addrs ContractAddresses, blocks []int64) (*RocketPool, error)

func (RocketPool) PullPrices

func (s RocketPool) PullPrices(pairs []Pair) []FetchResult

type Set

type Set struct {
	// contains filtered or unexported fields
}

func DefaultOriginSet

func DefaultOriginSet(pool query.WorkerPool) *Set

func NewSet

func NewSet(list map[string]Handler) *Set

func (*Set) Fetch

func (e *Set) Fetch(originPairs map[string][]Pair) map[string][]FetchResult

Fetch makes handler fetch using handlers from the Set structure.

func (*Set) Handlers

func (e *Set) Handlers() map[string]Handler

func (*Set) SetHandler

func (e *Set) SetHandler(name string, handler Handler)

type Sushiswap

type Sushiswap struct {
	WorkerPool        query.WorkerPool
	BaseURL           string
	ContractAddresses ContractAddresses
}

func (Sushiswap) Pool

func (s Sushiswap) Pool() query.WorkerPool

func (Sushiswap) PullPrices

func (s Sushiswap) PullPrices(pairs []Pair) []FetchResult

type SymbolAliases

type SymbolAliases map[string]string

type Uniswap

type Uniswap struct {
	WorkerPool        query.WorkerPool
	BaseURL           string
	ContractAddresses ContractAddresses
}

func (Uniswap) Pool

func (u Uniswap) Pool() query.WorkerPool

func (Uniswap) PullPrices

func (u Uniswap) PullPrices(pairs []Pair) []FetchResult

type UniswapV3

type UniswapV3 struct {
	WorkerPool        query.WorkerPool
	BaseURL           string
	ContractAddresses ContractAddresses
}

func (UniswapV3) Pool

func (u UniswapV3) Pool() query.WorkerPool

func (UniswapV3) PullPrices

func (u UniswapV3) PullPrices(pairs []Pair) []FetchResult

type Upbit

type Upbit struct {
	WorkerPool query.WorkerPool
	BaseURL    string
}

func (Upbit) Pool

func (o Upbit) Pool() query.WorkerPool

func (Upbit) PullPrices

func (o Upbit) PullPrices(pairs []Pair) []FetchResult

type WrappedStakedETH

type WrappedStakedETH struct {
	// contains filtered or unexported fields
}

func NewWrappedStakedETH

func NewWrappedStakedETH(cli ethereum.Client, addrs ContractAddresses, blocks []int64) (*WrappedStakedETH, error)

func (WrappedStakedETH) PullPrices

func (s WrappedStakedETH) PullPrices(pairs []Pair) []FetchResult

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL