origins

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: AGPL-3.0 Imports: 15 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 ErrInvalidResponse = fmt.Errorf("invalid response 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
	ContractAddresses ContractAddresses
}

func (Balancer) Pool

func (s Balancer) Pool() query.WorkerPool

func (Balancer) PullPrices added in v0.3.0

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

type BalancerV2 added in v0.3.0

type BalancerV2 struct {
	EthRPCURL         string
	WorkerPool        query.WorkerPool
	ContractAddresses ContractAddresses
	// contains filtered or unexported fields
}

func NewBalancerV2 added in v0.3.0

func NewBalancerV2(
	ethRPCURL string,
	workerPool query.WorkerPool,
	contractAddresses ContractAddresses,
) (*BalancerV2, error)

func (BalancerV2) Pool added in v0.3.0

func (s BalancerV2) Pool() query.WorkerPool

func (BalancerV2) PullPrices added in v0.3.0

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

type BaseExchangeHandler added in v0.3.0

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

func NewBaseExchangeHandler added in v0.3.0

func NewBaseExchangeHandler(handler ExchangeHandler, aliases SymbolAliases) *BaseExchangeHandler

func (BaseExchangeHandler) Fetch added in v0.3.0

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

type Binance

type Binance struct {
	WorkerPool query.WorkerPool
}

Binance origin handler

func (Binance) Pool

func (b Binance) Pool() query.WorkerPool

func (Binance) PullPrices added in v0.3.0

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

type BitThump

type BitThump struct {
	WorkerPool query.WorkerPool
}

Bithumb origin handler

func (BitThump) Pool

func (c BitThump) Pool() query.WorkerPool

func (BitThump) PullPrices added in v0.3.0

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

type Bitfinex

type Bitfinex struct {
	WorkerPool query.WorkerPool
}

func (Bitfinex) Pool

func (b Bitfinex) Pool() query.WorkerPool

func (Bitfinex) PullPrices added in v0.3.0

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

type Bitstamp

type Bitstamp struct {
	WorkerPool query.WorkerPool
}

Bitstamp origin handler

func (Bitstamp) Pool

func (b Bitstamp) Pool() query.WorkerPool

func (Bitstamp) PullPrices added in v0.3.0

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

type Bittrex

type Bittrex struct {
	WorkerPool query.WorkerPool
}

Bittrex origin handler

func (Bittrex) Pool

func (b Bittrex) Pool() query.WorkerPool

func (Bittrex) PullPrices added in v0.3.0

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

type CoinMarketCap

type CoinMarketCap struct {
	WorkerPool query.WorkerPool
	APIKey     string
}

Exchange handler

func (CoinMarketCap) Pool

func (c CoinMarketCap) Pool() query.WorkerPool

func (CoinMarketCap) PullPrices added in v0.3.0

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

type CoinbasePro

type CoinbasePro struct {
	WorkerPool query.WorkerPool
}

Coinbase origin handler

func (CoinbasePro) Pool

func (c CoinbasePro) Pool() query.WorkerPool

func (CoinbasePro) PullPrices added in v0.3.0

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

type ContractAddresses added in v0.3.0

type ContractAddresses map[string]string

func (ContractAddresses) AddressByPair added in v0.3.0

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

func (ContractAddresses) ByPair added in v0.3.0

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

type CryptoCompare

type CryptoCompare struct {
	WorkerPool query.WorkerPool
}

func (CryptoCompare) Pool

func (c CryptoCompare) Pool() query.WorkerPool

func (CryptoCompare) PullPrices added in v0.3.0

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

type CurveFinance added in v0.3.0

type CurveFinance struct {
	EthRPCURL         string
	WorkerPool        query.WorkerPool
	ContractAddresses ContractAddresses
	// contains filtered or unexported fields
}

func NewCurveFinance added in v0.3.0

func NewCurveFinance(
	ethRPCURL string,
	workerPool query.WorkerPool,
	contractAddresses ContractAddresses,
) (*CurveFinance, error)

func (CurveFinance) Pool added in v0.3.0

func (s CurveFinance) Pool() query.WorkerPool

func (CurveFinance) PullPrices added in v0.3.0

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

type Ddex

type Ddex struct {
	WorkerPool query.WorkerPool
}

func (Ddex) Pool

func (d Ddex) Pool() query.WorkerPool

func (Ddex) PullPrices added in v0.3.0

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

type ExchangeHandler added in v0.3.0

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

	Pool() query.WorkerPool
}

type FetchResult

type FetchResult struct {
	Price Price
	Error error
}

type Folgory

type Folgory struct {
	WorkerPool query.WorkerPool
}

func (Folgory) Pool

func (o Folgory) Pool() query.WorkerPool

func (Folgory) PullPrices added in v0.3.0

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

type Ftx

type Ftx struct {
	WorkerPool query.WorkerPool
}

func (Ftx) Pool

func (f Ftx) Pool() query.WorkerPool

func (Ftx) PullPrices added in v0.3.0

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

type Fx

type Fx struct {
	WorkerPool query.WorkerPool
	APIKey     string
}

Fx exchange handler

func (Fx) Pool

func (f Fx) Pool() query.WorkerPool

func (Fx) PullPrices added in v0.3.0

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

type Gateio

type Gateio struct {
	WorkerPool query.WorkerPool
}

Gateio exchange handler

func (Gateio) Pool

func (g Gateio) Pool() query.WorkerPool

func (Gateio) PullPrices added in v0.3.0

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

type Gemini

type Gemini struct {
	WorkerPool query.WorkerPool
}

Gemini origin handler

func (Gemini) Pool

func (g Gemini) Pool() query.WorkerPool

func (Gemini) PullPrices added in v0.3.0

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
}

Hitbtc exchange handler

func (Hitbtc) Pool

func (h Hitbtc) Pool() query.WorkerPool

func (Hitbtc) PullPrices added in v0.3.0

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

type Huobi

type Huobi struct {
	WorkerPool query.WorkerPool
}

Huobi origin handler

func (Huobi) Pool

func (h Huobi) Pool() query.WorkerPool

func (Huobi) PullPrices added in v0.3.0

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

type Kraken

type Kraken struct {
	WorkerPool query.WorkerPool
}

func (Kraken) Pool

func (k Kraken) Pool() query.WorkerPool

func (Kraken) PullPrices added in v0.3.0

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

type Kucoin

type Kucoin struct {
	WorkerPool query.WorkerPool
}

Kucoin origin handler

func (Kucoin) Pool

func (k Kucoin) Pool() query.WorkerPool

func (Kucoin) PullPrices added in v0.3.0

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

type Kyber

type Kyber struct {
	WorkerPool query.WorkerPool
}

func (Kyber) Pool

func (k Kyber) Pool() query.WorkerPool

func (Kyber) PullPrices added in v0.3.0

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

type Loopring

type Loopring struct {
	WorkerPool query.WorkerPool
}

Loopring origin handler

func (Loopring) Pool

func (l Loopring) Pool() query.WorkerPool

func (Loopring) PullPrices added in v0.3.0

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

type Okex

type Okex struct {
	WorkerPool query.WorkerPool
}

Okex origin handler

func (Okex) Pool

func (o Okex) Pool() query.WorkerPool

func (Okex) PullPrices added in v0.3.0

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

type OpenExchangeRates

type OpenExchangeRates struct {
	WorkerPool query.WorkerPool
	APIKey     string
}

OpenExchangeRates origin handler

func (OpenExchangeRates) Pool

func (OpenExchangeRates) PullPrices added in v0.3.0

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 added in v0.3.0

func (p Pair) Inverse() Pair

func (Pair) String

func (p Pair) String() string

type Poloniex

type Poloniex struct {
	WorkerPool query.WorkerPool
}

Poloniex origin handler

func (Poloniex) Pool

func (p Poloniex) Pool() query.WorkerPool

func (Poloniex) PullPrices added in v0.3.0

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 Set

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

func DefaultOriginSet added in v0.2.0

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
	ContractAddresses ContractAddresses
}

func (Sushiswap) Pool

func (s Sushiswap) Pool() query.WorkerPool

func (Sushiswap) PullPrices added in v0.3.0

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

type SymbolAliases added in v0.3.0

type SymbolAliases map[string]string

type Uniswap

type Uniswap struct {
	WorkerPool        query.WorkerPool
	ContractAddresses ContractAddresses
}

func (Uniswap) Pool

func (u Uniswap) Pool() query.WorkerPool

func (Uniswap) PullPrices added in v0.3.0

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

type UniswapV3 added in v0.2.0

type UniswapV3 struct {
	WorkerPool        query.WorkerPool
	ContractAddresses ContractAddresses
}

func (UniswapV3) Pool added in v0.2.0

func (u UniswapV3) Pool() query.WorkerPool

func (UniswapV3) PullPrices added in v0.3.0

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

type Upbit

type Upbit struct {
	WorkerPool query.WorkerPool
}

func (Upbit) Pool

func (o Upbit) Pool() query.WorkerPool

func (Upbit) PullPrices added in v0.3.0

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

type WrappedStakedETH added in v0.3.0

type WrappedStakedETH struct {
	EthRPCURL         string
	WorkerPool        query.WorkerPool
	ContractAddresses ContractAddresses
	// contains filtered or unexported fields
}

func NewWrappedStakedETH added in v0.3.0

func NewWrappedStakedETH(
	ethRPCURL string,
	workerPool query.WorkerPool,
	contractAddresses ContractAddresses,
) (*WrappedStakedETH, error)

func (WrappedStakedETH) Pool added in v0.3.0

func (WrappedStakedETH) PullPrices added in v0.3.0

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