scrapers

package
v1.4.171 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: GPL-2.0 Imports: 85 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	ChannelHeartbeat = "heartbeat"
	ChannelTicker    = "ticker"
	ChannelLevel2    = "level2"
	ChannelUser      = "user"
	ChannelMatches   = "matches"
	ChannelFull      = "full"
)
View Source
const (
	OrcaProgWhirlpoolConfigAddr      = "2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ"
	OrcaProgWhirlpoolAddr            = "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
	OrcaProgWhirlpoolAccountDataSize = 653
	OrcaMaxRetries                   = 5
	OrcaRetryDelay                   = 3 * time.Second
)
View Source
const (
	BinanceUSWsURL = "wss://stream.binance.us:9443/ws"
)

Variables ¶

View Source
var (
	Exchanges          = make(map[string]dia.Exchange)
	ExchangeDuplicates = make(map[string]dia.Exchange)
)
View Source
var ByBitSocketURL string = "wss://stream.bybit.com/spot/public/v3"

Functions ¶

func AllFuturesMarketsHuobi ¶

func AllFuturesMarketsHuobi() []string

AllFuturesMarketsHuobi - returns all the futures markets tradable on Huobi. Lists all of the Huobi Futures markets. TODO: add a REST HTTP call to obtain the list of trdabale markets.

func FloatToString ¶

func FloatToString(input_num float64) string

func FormatUint64Decimals ¶ added in v1.4.81

func FormatUint64Decimals(value uint64, decimals int) (valueFormatted float64)

Format a uint64 to a float64 with the given number of decimals

func GetDecimals ¶ added in v1.4.2

func GetDecimals(tokenAddress common.Address, chainid string) (decimals uint8, err error)

func GetName ¶ added in v1.4.2

func GetName(tokenAddress common.Address, chainid string) (name string, err error)

func GetOrcaTokensMetadata ¶ added in v1.4.88

func GetOrcaTokensMetadata() map[string]interface{}

func GetSymbol ¶ added in v1.4.2

func GetSymbol(tokenAddress common.Address, chainid string) (name string, err error)

func GzipDecode ¶

func GzipDecode(in []byte) (content []byte, err error)

func InitialiseRestClientsMap ¶ added in v1.4.2

func InitialiseRestClientsMap()

func InitialiseWsClientsMap ¶ added in v1.4.2

func InitialiseWsClientsMap()

func NewTrade ¶

func NewTrade(pair dia.ExchangePair, info krakenapi.TradeInfo, foreignTradeID string, relDB *models.RelDB) *dia.Trade

func Populate ¶

func Populate(datastore *models.DB, rdb *models.RelDB, pairs []string)

Populate fetches historical daily datas from 1999 until today and saves them on the database

func Round ¶

func Round(x, unit float64) float64

Types ¶

type APIScraper ¶

type APIScraper interface {
	io.Closer
	// ScrapePair returns a PairScraper that continuously scrapes trades for a
	// single pair from this APIScraper
	ScrapePair(pair dia.ExchangePair) (PairScraper, error)
	// FetchAvailablePairs returns a list with all trading pairs available on
	// the exchange associated to the APIScraper. The format is such that it can
	// be used by the corr. pairScraper in order to fetch trades.
	FetchAvailablePairs() ([]dia.ExchangePair, error)

	// FillSymbolData collects information associated to the symbol ticker of an
	// asset traded on the exchange associated to the APIScraper.
	// Ideally, data is returned as close to original (blockchain) notation as possible.
	// This is only needed for CEX. For DEX the trade can be filled.
	FillSymbolData(symbol string) (dia.Asset, error)

	NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)
	// Channel returns a channel that can be used to receive trades
	Channel() chan *dia.Trade
}

APIScraper provides common methods needed to get Trade information from exchange APIs.

func NewAPIScraper ¶

func NewAPIScraper(exchange string, scrape bool, key string, secret string, relDB *models.RelDB) APIScraper

NewAPIScraper returns an API scraper for @exchange. If scrape==true it actually does scraping. Otherwise can be used for pairdiscovery.

type AllOKEXMarketResponse ¶

type AllOKEXMarketResponse struct {
	Code string       `json:"code"`
	Data []OKEXMarket `json:"data"`
	Msg  string       `json:"msg"`
}

type AnyswapPair ¶ added in v1.4.0

type AnyswapPair struct {
	Token0      UniswapToken
	Token1      UniswapToken
	ForeignName string
	Address     common.Address
}

type AnyswapPairScraper ¶ added in v1.4.0

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

UniswapPairScraper implements PairScraper for Uniswap

func (*AnyswapPairScraper) Close ¶ added in v1.4.0

func (ps *AnyswapPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*AnyswapPairScraper) Error ¶ added in v1.4.0

func (ps *AnyswapPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*AnyswapPairScraper) Pair ¶ added in v1.4.0

func (ps *AnyswapPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type AnyswapScraper ¶ added in v1.4.0

type AnyswapScraper struct {
	WsClientMap   map[string]*ethclient.Client
	RestClientMap map[string]*ethclient.Client
	// contains filtered or unexported fields
}

func NewAnyswapScraper ¶ added in v1.4.0

func NewAnyswapScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *AnyswapScraper

NewUniswapScraper returns a new UniswapScraper for the given pair

func (*AnyswapScraper) Channel ¶ added in v1.4.0

func (ps *AnyswapScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*AnyswapScraper) Close ¶ added in v1.4.0

func (s *AnyswapScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*AnyswapScraper) FetchAvailablePairs ¶ added in v1.4.0

func (s *AnyswapScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs as dia.ExchangePair for the pairDiscorvery service

func (*AnyswapScraper) FillSymbolData ¶ added in v1.4.0

func (s *AnyswapScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData is not used by DEX scrapers.

func (*AnyswapScraper) GetSwapOutChannel ¶ added in v1.4.0

func (s *AnyswapScraper) GetSwapOutChannel(tokens []common.Address, chainID string) (chan *anyswap.AnyswapV4RouterLogAnySwapOut, error)

GetSwapOutChannel returns the channel @sink delivering the events LogAnySwapOut.

func (*AnyswapScraper) ListenToChainOut ¶ added in v1.4.0

func (s *AnyswapScraper) ListenToChainOut(chainID string)

ListenToChainOut screens swaps out of the chain with @chainID to any other chain offered by Anyswap.

func (*AnyswapScraper) NormalizePair ¶ added in v1.4.0

func (up *AnyswapScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*AnyswapScraper) ScrapePair ¶ added in v1.4.0

func (s *AnyswapScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type AnyswapSwap ¶ added in v1.4.0

type AnyswapSwap struct {
	ID         string
	Timestamp  int64
	Pair       UniswapPair
	Amount0In  float64
	Amount0Out float64
	Amount1In  float64
	Amount1Out float64
}

type AnyswapToken ¶ added in v1.4.0

type AnyswapToken struct {
	Address  common.Address
	Symbol   string
	Decimals uint8
	Name     string
}

type BKEXExchangeInfo ¶ added in v1.4.6

type BKEXExchangeInfo struct {
	Code string               `json:"code"`
	Data []BKEXExchangeSymbol `json:"data"`
}

type BKEXExchangeSymbol ¶ added in v1.4.6

type BKEXExchangeSymbol struct {
	MinimumOrderSize   float64 `json:"minimumOrderSize"`
	MinimumTradeVolume float64 `json:"minimumTradeVolume"`
	PricePrecision     int     `json:"pricePrecision"`
	SupportTrade       bool    `json:"supportTrade"`
	Symbol             string  `json:"symbol"`
	VolumePrecision    int     `json:"volumePrecision"`
}

type BKEXPairScraper ¶ added in v1.4.6

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

BKEXPairScraper implements PairScraper for BKEX

func (*BKEXPairScraper) Close ¶ added in v1.4.6

func (ps *BKEXPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BKEXPairScraper) Error ¶ added in v1.4.6

func (ps *BKEXPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BKEXPairScraper) Pair ¶ added in v1.4.6

func (ps *BKEXPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type BKEXScraper ¶ added in v1.4.6

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

func NewBKEXScraper ¶ added in v1.4.6

func NewBKEXScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BKEXScraper

func (*BKEXScraper) Channel ¶ added in v1.4.6

func (s *BKEXScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BKEXScraper) Close ¶ added in v1.4.6

func (s *BKEXScraper) Close() error

func (*BKEXScraper) FetchAvailablePairs ¶ added in v1.4.6

func (s *BKEXScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*BKEXScraper) FillSymbolData ¶ added in v1.4.6

func (s *BKEXScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData from MEXCScraper @todo more update

func (*BKEXScraper) NormalizePair ¶ added in v1.4.6

func (s *BKEXScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BKEXScraper) ScrapePair ¶ added in v1.4.6

func (s *BKEXScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

type BKEXTradeRecord ¶ added in v1.4.6

type BKEXTradeRecord struct {
	Symbol    string  `json:"symbol"`
	Price     string  `json:"price"`
	Volume    float64 `json:"volume"`
	Direction string  `json:"direction"`
	Ts        int64   `json:"ts"`
}

type BKEXTradeResponse ¶ added in v1.4.6

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

type BalancerV2PairScraper ¶ added in v1.4.0

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

BalancerV2PairScraper implements PairScraper for BalancerV2

func (*BalancerV2PairScraper) Close ¶ added in v1.4.0

func (p *BalancerV2PairScraper) Close() error

Close stops listening for trades of the pair associated with the BalancerV2Scraper

func (*BalancerV2PairScraper) Error ¶ added in v1.4.0

func (p *BalancerV2PairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BalancerV2PairScraper) Pair ¶ added in v1.4.0

Pair returns the pair this scraper is subscribed to

type BalancerV2Scraper ¶ added in v1.4.0

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

BalancerV2Scraper is a scraper for Balancer V2

func NewBalancerV2Scraper ¶ added in v1.4.0

func NewBalancerV2Scraper(exchange dia.Exchange, scrape bool) *BalancerV2Scraper

NewBalancerV2Scraper returns a Balancer V2 scraper

func (*BalancerV2Scraper) Channel ¶ added in v1.4.0

func (s *BalancerV2Scraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BalancerV2Scraper) Close ¶ added in v1.4.0

func (s *BalancerV2Scraper) Close() error

Close unsubscribes data and closes any existing WebSocket connections, as well as channels of BalancerV2Scraper

func (*BalancerV2Scraper) FetchAvailablePairs ¶ added in v1.4.0

func (s *BalancerV2Scraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*BalancerV2Scraper) FillSymbolData ¶ added in v1.4.0

func (s *BalancerV2Scraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData adds the name to the asset underlying @symbol on BalancerV2

func (*BalancerV2Scraper) NormalizePair ¶ added in v1.4.0

func (s *BalancerV2Scraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BalancerV2Scraper) ScrapePair ¶ added in v1.4.0

func (s *BalancerV2Scraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the BalancerV2 scraper

type BalancerV2Swap ¶ added in v1.4.0

type BalancerV2Swap struct {
	SellToken  string
	BuyToken   string
	SellVolume float64
	BuyVolume  float64
	ID         string
	Timestamp  int64
}

BalancerV2Swap is a swap information

type BancorPairScraper ¶

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

func (*BancorPairScraper) Close ¶

func (pairScraper *BancorPairScraper) Close() error

func (*BancorPairScraper) Error ¶

func (pairScraper *BancorPairScraper) Error() error

func (*BancorPairScraper) Pair ¶

func (pairScraper *BancorPairScraper) Pair() dia.ExchangePair

type BancorPool ¶

type BancorPool struct {
	Reserves []struct {
		DltID   string `json:"dlt_id"`
		Symbol  string `json:"symbol"`
		Name    string `json:"name"`
		Balance struct {
			Usd string `json:"usd"`
		} `json:"balance"`
		Weight int `json:"weight"`
		Price  struct {
			Usd string `json:"usd"`
		} `json:"price"`
		Price24HAgo struct {
			Usd string `json:"usd"`
		} `json:"price_24h_ago"`
		Volume24H struct {
			Usd  string `json:"usd"`
			Base string `json:"base"`
		} `json:"volume_24h"`
	} `json:"reserves"`
	DltType        string `json:"dlt_type"`
	DltID          string `json:"dlt_id"`
	Type           int    `json:"type"`
	Version        int    `json:"version"`
	Symbol         string `json:"symbol"`
	Name           string `json:"name"`
	Supply         string `json:"supply"`
	ConverterDltID string `json:"converter_dlt_id"`
	ConversionFee  string `json:"conversion_fee"`
	Liquidity      struct {
		Usd string `json:"usd"`
	} `json:"liquidity"`
	Volume24H struct {
		Usd string `json:"usd"`
	} `json:"volume_24h"`
	Fees24H struct {
		Usd string `json:"usd"`
	} `json:"fees_24h"`
}

type BancorPools ¶

type BancorPools struct {
	Data      []BancorPool `json:"data"`
	Timestamp struct {
		Ethereum struct {
			Block     int   `json:"block"`
			Timestamp int64 `json:"timestamp"`
		} `json:"ethereum"`
	} `json:"timestamp"`
}

type BancorScraper ¶

type BancorScraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

func NewBancorScraper ¶

func NewBancorScraper(exchange dia.Exchange, scrape bool) *BancorScraper

func (*BancorScraper) Channel ¶

func (scraper *BancorScraper) Channel() chan *dia.Trade

func (*BancorScraper) Close ¶

func (scraper *BancorScraper) Close() error

func (*BancorScraper) ConverterTypeFour ¶

func (scraper *BancorScraper) ConverterTypeFour(address common.Address) (tokenAddress []common.Address, err error)

func (*BancorScraper) ConverterTypeOne ¶

func (scraper *BancorScraper) ConverterTypeOne(address common.Address) (tokenAddress []common.Address, err error)

func (*BancorScraper) ConverterTypeThree ¶

func (scraper *BancorScraper) ConverterTypeThree(address common.Address) (tokenAddress []common.Address, err error)

func (*BancorScraper) ConverterTypeZero ¶

func (scraper *BancorScraper) ConverterTypeZero(address common.Address) (tokenAddress []common.Address, err error)

func (*BancorScraper) FetchAvailablePairs ¶

func (scraper *BancorScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*BancorScraper) FillSymbolData ¶

func (scraper *BancorScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*BancorScraper) GetConversion ¶

func (scraper *BancorScraper) GetConversion() (chan *BancorNetwork.BancorNetworkConversion, error)

func (*BancorScraper) GetPair ¶

func (scraper *BancorScraper) GetPair(address []common.Address) dia.ExchangePair

func (*BancorScraper) GetpoolAddress ¶

func (scraper *BancorScraper) GetpoolAddress()

func (*BancorScraper) NormalizePair ¶

func (scraper *BancorScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BancorScraper) ScrapePair ¶

func (scraper *BancorScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

type BancorSwap ¶

type BancorSwap struct {
	Pair       dia.ExchangePair
	FromAmount float64
	ToAmount   float64
	ID         string
	Timestamp  int64
}

type BinancePairScraper ¶

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

BinancePairScraper implements PairScraper for Binance

func (*BinancePairScraper) Close ¶

func (ps *BinancePairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BinancePairScraper) Error ¶

func (ps *BinancePairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BinancePairScraper) Pair ¶

func (ps *BinancePairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type BinanceScraper ¶

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

BinanceScraper is a Scraper for collecting trades from the Binance websocket API

func NewBinanceScraper ¶

func NewBinanceScraper(apiKey string, secretKey string, exchange dia.Exchange, scraperName string, scrape bool, relDB *models.RelDB) *BinanceScraper

NewBinanceScraper returns a new BinanceScraper for the given pair

func (*BinanceScraper) Channel ¶

func (ps *BinanceScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BinanceScraper) Close ¶

func (s *BinanceScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BinanceScraper) FetchAvailablePairs ¶

func (s *BinanceScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BinanceScraper) FillSymbolData ¶

func (s *BinanceScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*BinanceScraper) NormalizePair ¶

func (up *BinanceScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BinanceScraper) ScrapePair ¶

func (s *BinanceScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type BinanceScraperUS ¶ added in v1.4.2

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

BinanceScraperUS is a Scraper for collecting trades from the Binance websocket API

func NewBinanceScraperUS ¶ added in v1.4.2

func NewBinanceScraperUS(apiKey string, secretKey string, exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BinanceScraperUS

NewBinanceScraperUS returns a new BinanceScraperUS for the given pair

func (*BinanceScraperUS) Channel ¶ added in v1.4.2

func (ps *BinanceScraperUS) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BinanceScraperUS) Close ¶ added in v1.4.2

func (s *BinanceScraperUS) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BinanceScraperUS) FetchAvailablePairs ¶ added in v1.4.2

func (s *BinanceScraperUS) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BinanceScraperUS) FillSymbolData ¶ added in v1.4.2

func (s *BinanceScraperUS) FillSymbolData(symbol string) (dia.Asset, error)

func (*BinanceScraperUS) NormalizePair ¶ added in v1.4.2

func (up *BinanceScraperUS) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BinanceScraperUS) ScrapePair ¶ added in v1.4.2

func (s *BinanceScraperUS) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type BinanceUSPairScraper ¶ added in v1.4.2

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

BinanceUSPairScraper implements PairScraper for Binance

func (*BinanceUSPairScraper) Close ¶ added in v1.4.2

func (ps *BinanceUSPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BinanceUSPairScraper) Error ¶ added in v1.4.2

func (ps *BinanceUSPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BinanceUSPairScraper) Pair ¶ added in v1.4.2

Pair returns the pair this scraper is subscribed to

type BinanceUSPairScraperSet ¶ added in v1.4.2

type BinanceUSPairScraperSet map[*BinanceUSPairScraper]nothing

type BitMartPairScraper ¶ added in v1.4.2

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

BitMartPairScraper implements PairScraper for BitMart

func (*BitMartPairScraper) Close ¶ added in v1.4.2

func (ps *BitMartPairScraper) Close() error

Close stops listening for trades of the pair associated with the BitMart scraper

func (*BitMartPairScraper) Error ¶ added in v1.4.2

func (ps *BitMartPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BitMartPairScraper) Pair ¶ added in v1.4.2

func (ps *BitMartPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type BitMartScraper ¶ added in v1.4.2

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

BitMartScraper is a scraper for BitMart

func NewBitMartScraper ¶ added in v1.4.2

func NewBitMartScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BitMartScraper

NewBitMartScraper returns a new BitMart scraper

func (*BitMartScraper) Channel ¶ added in v1.4.2

func (s *BitMartScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BitMartScraper) Close ¶ added in v1.4.2

func (s *BitMartScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BitMartScraper) FetchAvailablePairs ¶ added in v1.4.2

func (s *BitMartScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BitMartScraper) FillSymbolData ¶ added in v1.4.2

func (s *BitMartScraper) FillSymbolData(symbol string) (dia.Asset, error)

TODO: FillSymbolData adds the name to the asset underlying @symbol on BitMart

func (*BitMartScraper) NormalizePair ¶ added in v1.4.2

func (s *BitMartScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

TODO: NormalizePair accounts for the par

func (*BitMartScraper) ScrapePair ¶ added in v1.4.2

func (s *BitMartScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the BitMart scraper

type BitMaxAsset ¶

type BitMaxAsset struct {
	AssetCode        string `json:"assetCode"`
	AssetName        string `json:"assetName"`
	PrecisionScale   int    `json:"precisionScale"`
	NativeScale      int    `json:"nativeScale"`
	WithdrawalFee    string `json:"withdrawalFee"`
	MinWithdrawalAmt string `json:"minWithdrawalAmt"`
	Status           string `json:"status"`
}

type BitMaxAssets ¶

type BitMaxAssets struct {
	Code int           `json:"code"`
	Data []BitMaxAsset `json:"data"`
}

type BitMaxPair ¶

type BitMaxPair struct {
	Symbol                string `json:"symbol"`
	DisplayName           string `json:"displayName"`
	BaseAsset             string `json:"baseAsset"`
	QuoteAsset            string `json:"quoteAsset"`
	Status                string `json:"status"`
	MinNotional           string `json:"minNotional"`
	MaxNotional           string `json:"maxNotional"`
	MarginTradable        bool   `json:"marginTradable"`
	CommissionType        string `json:"commissionType"`
	CommissionReserveRate string `json:"commissionReserveRate"`
	TickSize              string `json:"tickSize"`
	LotSize               string `json:"lotSize"`
}

type BitMaxPairResponse ¶

type BitMaxPairResponse struct {
	Code int          `json:"code"`
	Data []BitMaxPair `json:"data"`
}

type BitMaxPairScraper ¶

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

BitMax implements PairScraper for BitMax

func (*BitMaxPairScraper) Close ¶

func (ps *BitMaxPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BitMaxPairScraper) Error ¶

func (ps *BitMaxPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BitMaxPairScraper) Pair ¶

func (ps *BitMaxPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type BitMaxRequest ¶

type BitMaxRequest struct {
	Op string `json:"op"`
	ID string `json:"id"`
	Ch string `json:"ch"`
}

type BitMaxScraper ¶

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

func NewBitMaxScraper ¶

func NewBitMaxScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BitMaxScraper

func (*BitMaxScraper) Channel ¶

func (ps *BitMaxScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BitMaxScraper) Close ¶

func (s *BitMaxScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BitMaxScraper) FetchAvailablePairs ¶

func (s *BitMaxScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*BitMaxScraper) FillSymbolData ¶

func (s *BitMaxScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData collects all available information on an asset traded on Bitmax

func (*BitMaxScraper) NormalizePair ¶

func (s *BitMaxScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BitMaxScraper) ScrapePair ¶

func (s *BitMaxScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type BitMaxTradeResponse ¶

type BitMaxTradeResponse struct {
	M      string `json:"m"`
	Symbol string `json:"symbol"`
	Data   []struct {
		P      string `json:"p"`
		Q      string `json:"q"`
		Ts     int64  `json:"ts"`
		Bm     bool   `json:"bm"`
		Seqnum int64  `json:"seqnum"`
	} `json:"data"`
}

type BitMexPairScraper ¶ added in v1.4.0

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

BitMexPairScraper implements PairScraper for BitMex

func (*BitMexPairScraper) Close ¶ added in v1.4.0

func (p *BitMexPairScraper) Close() error

Close stops listening for trades of the pair associated with the BitMex scraper

func (*BitMexPairScraper) Error ¶ added in v1.4.0

func (p *BitMexPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BitMexPairScraper) Pair ¶ added in v1.4.0

Pair returns the pair this scraper is subscribed to

type BitMexScraper ¶ added in v1.4.0

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

BitMexScraper is a scraper for bitmex.com

func NewBitMexScraper ¶ added in v1.4.0

func NewBitMexScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BitMexScraper

NewBitMexScraper returns a new BitMex scraper

func (*BitMexScraper) Channel ¶ added in v1.4.0

func (s *BitMexScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BitMexScraper) Close ¶ added in v1.4.0

func (s *BitMexScraper) Close() error

Close unsubscribes data and closes any existing WebSocket connections, as well as channels of BitMexScraper

func (*BitMexScraper) FetchAvailablePairs ¶ added in v1.4.0

func (s *BitMexScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns all traded pairs on BitMex

func (*BitMexScraper) FillSymbolData ¶ added in v1.4.0

func (s *BitMexScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData adds the name to the asset underlying @symbol on BitMex

func (*BitMexScraper) NormalizePair ¶ added in v1.4.0

func (s *BitMexScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BitMexScraper) ScrapePair ¶ added in v1.4.0

func (s *BitMexScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the BitMex scraper

type BitfinexPairScraper ¶

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

BitfinexPairScraper implements PairScraper for Bitfinex

func (*BitfinexPairScraper) Close ¶

func (ps *BitfinexPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BitfinexPairScraper) Error ¶

func (ps *BitfinexPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BitfinexPairScraper) Pair ¶

Pair returns the pair this scraper is subscribed to

type BitfinexScraper ¶

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

BitfinexScraper is a Scraper for collecting trades from the Bitfinex websocket API

func NewBitfinexScraper ¶

func NewBitfinexScraper(key string, secret string, exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BitfinexScraper

NewBitfinexScraper returns a new BitfinexScraper for the given pair

func (*BitfinexScraper) Channel ¶

func (ps *BitfinexScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BitfinexScraper) Close ¶

func (s *BitfinexScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BitfinexScraper) FetchAvailablePairs ¶

func (s *BitfinexScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BitfinexScraper) FillSymbolData ¶

func (s *BitfinexScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

func (*BitfinexScraper) NormalizePair ¶

func (s *BitfinexScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BitfinexScraper) ScrapePair ¶

func (s *BitfinexScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type BitflyerScraper ¶

type BitflyerScraper struct {
	Markets   []string
	WaitGroup *sync.WaitGroup
	Writer    writers.Writer
	Logger    *zap.SugaredLogger
}

BitflyerScraper - use the NewBitflyerFuturesScraper function to create an instance

func (*BitflyerScraper) Authenticate ¶

func (s *BitflyerScraper) Authenticate(market string, connection interface{}) error

Authenticate - placeholder here, since we do not need to authneticate the connection.

func (*BitflyerScraper) Scrape ¶

func (s *BitflyerScraper) Scrape(market string)

Scrape starts a websocket scraper for market

func (*BitflyerScraper) ScrapeMarkets ¶

func (s *BitflyerScraper) ScrapeMarkets()

ScrapeMarkets - will scrape the markets specified during instantiation

func (*BitflyerScraper) ScraperClose ¶

func (s *BitflyerScraper) ScraperClose(market string, connection interface{}) error

ScraperClose - safely closes the scraper; We pass the interface connection as the second argument primarily for the reason that Huobi scraper does not use the gorilla websocket; It uses golang's x websocket; If we did not define this method in our FuturesScraper interface, we could have easily used the pointer to gorilla websocket here; However, to make FuturesScraper more ubiquituous, we need an interface here.

type BitmartHttpSymbolsDetailsResponse ¶ added in v1.4.2

type BitmartHttpSymbolsDetailsResponse struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
	Trace   string `json:"trace"`
	Data    struct {
		Symbols []struct {
			Symbol            string `json:"symbol"`
			SymbolId          int    `json:"symbol_id"`
			BaseCurrency      string `json:"base_currency"`
			QuoteCurrency     string `json:"quote_currency"`
			QuoteIncrement    string `json:"quote_increment"`
			BaseMinSize       string `json:"base_min_size"`
			PriceMinPrecision int    `json:"price_min_precision"`
			PriceMaxPrecision int    `json:"price_max_precision"`
			Expiration        string `json:"expiration"`
			MinBuyAmount      string `json:"min_buy_amount"`
			MinSellAmount     string `json:"min_sell_amount"`
			TradeStatus       string `json:"trade_status"`
		} `json:"symbols"`
	} `json:"data"`
}

type BitmartWsRequest ¶ added in v1.4.2

type BitmartWsRequest struct {
	Op   string   `json:"op"`
	Args []string `json:"args"`
}

type BitmartWsTradeResponse ¶ added in v1.4.2

type BitmartWsTradeResponse struct {
	Table string `json:"table"`
	Data  []struct {
		Symbol       string `json:"symbol"`
		Price        string `json:"price"`
		Side         string `json:"side"`
		Size         string `json:"size"`
		TimestampSec int    `json:"s_t"`
	} `json:"data"`
	ErrorMessage string `json:"errorMessage"`
	ErrorCode    string `json:"errorCode"`
	Event        string `json:"event"`
}

type BitmexScraper ¶

type BitmexScraper struct {
	Markets   []string
	WaitGroup *sync.WaitGroup
	Writer    writers.Writer
	Logger    *zap.SugaredLogger
}

BitmexScraper - use the NewBitmexFuturesScraper function to create an instance

func (*BitmexScraper) Authenticate ¶

func (s *BitmexScraper) Authenticate(market string, connection interface{}) error

Authenticate - placeholder here, since we do not need to authneticate the connection.

func (*BitmexScraper) Scrape ¶

func (s *BitmexScraper) Scrape(market string)

Scrape starts a websocket scraper for market

func (*BitmexScraper) ScrapeMarkets ¶

func (s *BitmexScraper) ScrapeMarkets()

ScrapeMarkets - will scrape the markets specified during instantiation

func (*BitmexScraper) ScraperClose ¶

func (s *BitmexScraper) ScraperClose(market string, connection interface{}) error

ScraperClose - safely closes the scraper; We pass the interface connection as the second argument primarily for the reason that Huobi scraper does not use the gorilla websocket; It uses golang's x websocket; If we did not define this method in our FuturesScraper interface, we could have easily used the pointer to gorilla websocket here; However, to make FuturesScraper more ubiquituous, we need an interface here.

type BitstampPairScraper ¶ added in v1.4.153

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

func (*BitstampPairScraper) Close ¶ added in v1.4.153

func (ps *BitstampPairScraper) Close() error

func (*BitstampPairScraper) Error ¶ added in v1.4.153

func (ps *BitstampPairScraper) Error() error

func (*BitstampPairScraper) Pair ¶ added in v1.4.153

type BitstampPairsInfo ¶ added in v1.4.153

type BitstampPairsInfo []struct {
	Name                        string `json:"name"`
	UrlSymbol                   string `json:"url_symbol"`
	BaseDecimal                 uint8  `json:"base_decimal"`
	CounterDecimals             uint8  `json:"counter_decimals"`
	InstantOrderCounterDecimals uint8  `json:"instant_order_counter_decimals"`
	MinimumOrder                string `json:"minimum_order"`
	Trading                     string `json:"trading"`
	InstantAndMarketOrders      string `json:"instant_and_market_orders"`
	Description                 string `json:"description"`
}

type BitstampPingData ¶ added in v1.4.153

type BitstampPingData struct {
	Status string `json:"status"`
}

type BitstampScraper ¶ added in v1.4.153

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

func NewBitstampScraper ¶ added in v1.4.153

func NewBitstampScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BitstampScraper

func (*BitstampScraper) Channel ¶ added in v1.4.153

func (s *BitstampScraper) Channel() chan *dia.Trade

func (*BitstampScraper) Close ¶ added in v1.4.153

func (s *BitstampScraper) Close() error

func (*BitstampScraper) FetchAvailablePairs ¶ added in v1.4.153

func (s *BitstampScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*BitstampScraper) FillSymbolData ¶ added in v1.4.153

func (s *BitstampScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*BitstampScraper) NormalizePair ¶ added in v1.4.153

func (s *BitstampScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BitstampScraper) ScrapePair ¶ added in v1.4.153

func (s *BitstampScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

type BitstampTradeData ¶ added in v1.4.153

type BitstampTradeData struct {
	Id             string  `json:"id"`
	Amount         float64 `json:"amount"`
	AmountStr      string  `json:"amount_str"`
	Price          float64 `json:"price"`
	PriceStr       string  `json:"price_str"`
	Type           uint8   `json:"type"`
	Timestamp      string  `json:"timestamp"`
	Microtimestamp string  `json:"microtimestamp"`
	BuyOrderId     uint64  `json:"buy_order_id"`
	SellOrderId    uint64  `json:"sell_order_id"`
}

type BitstampWsResponse ¶ added in v1.4.153

type BitstampWsResponse struct {
	Event   string      `json:"event"`
	Channel string      `json:"channel"`
	Data    interface{} `json:"data"`
}

type BittrexPairScraper ¶

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

BittrexPairScraper implements PairScraper for Bittrex

func (*BittrexPairScraper) Close ¶

func (p *BittrexPairScraper) Close() error

Close stops listening for trades of the pair associated with the Bittrex scraper

func (*BittrexPairScraper) Error ¶

func (p *BittrexPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BittrexPairScraper) Pair ¶

Pair returns the pair this scraper is subscribed to

type BittrexScraper ¶

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

func NewBittrexScraper ¶

func NewBittrexScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BittrexScraper

func (*BittrexScraper) Channel ¶

func (s *BittrexScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*BittrexScraper) Close ¶

func (s *BittrexScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BittrexScraper) FetchAvailablePairs ¶

func (s *BittrexScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BittrexScraper) FillSymbolData ¶

func (s *BittrexScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData adds the name to the asset underlying @symbol on Bittrex

func (*BittrexScraper) NormalizePair ¶

func (s *BittrexScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BittrexScraper) ScrapePair ¶

func (s *BittrexScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the Bittrex scraper

type BridgeSwapPair ¶ added in v1.4.2

type BridgeSwapPair struct {
	Token0      BridgeSwapToken
	Token1      BridgeSwapToken
	ForeignName string
	Address     common.Address
}

type BridgeSwapPairScraper ¶ added in v1.4.2

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

BridgeSwapPairScraper implements PairScraper for Uniswap

func (*BridgeSwapPairScraper) Close ¶ added in v1.4.2

func (ps *BridgeSwapPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BridgeSwapPairScraper) Error ¶ added in v1.4.2

func (ps *BridgeSwapPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*BridgeSwapPairScraper) Pair ¶ added in v1.4.2

Pair returns the pair this scraper is subscribed to

type BridgeSwapScraper ¶ added in v1.4.2

type BridgeSwapScraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

func NewBridgeSwapScraper ¶ added in v1.4.2

func NewBridgeSwapScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BridgeSwapScraper

NewBridgeSwapScraper returns a new BridgeSwapScraper for the given pair

func (*BridgeSwapScraper) Channel ¶ added in v1.4.2

func (ps *BridgeSwapScraper) Channel() chan *dia.Trade

func (*BridgeSwapScraper) Close ¶ added in v1.4.2

func (s *BridgeSwapScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*BridgeSwapScraper) FetchAvailablePairs ¶ added in v1.4.2

func (b *BridgeSwapScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*BridgeSwapScraper) FillSymbolData ¶ added in v1.4.2

func (s *BridgeSwapScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*BridgeSwapScraper) NormalizePair ¶ added in v1.4.2

func (up *BridgeSwapScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*BridgeSwapScraper) ScrapePair ¶ added in v1.4.2

func (s *BridgeSwapScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

type BridgeSwapSwap ¶ added in v1.4.2

type BridgeSwapSwap struct {
	TransactionHash string
	TokenAddress    common.Address
	ToAddress       common.Address
	Amount          *big.Int
	FromChainId     *big.Int
	ToChainId       *big.Int
}

type BridgeSwapToken ¶ added in v1.4.2

type BridgeSwapToken struct {
	Address  common.Address
	Symbol   string
	Decimals uint8
	Name     string
}

type ByBitMarket ¶ added in v1.4.0

type ByBitMarket struct {
	Name           string `json:"name"`
	Alias          string `json:"alias"`
	Status         string `json:"status"`
	BaseCurrency   string `json:"base_currency"`
	QuoteCurrency  string `json:"quote_currency"`
	PriceScale     int    `json:"price_scale"`
	TakerFee       string `json:"taker_fee"`
	MakerFee       string `json:"maker_fee"`
	LeverageFilter struct {
		MinLeverage  int    `json:"min_leverage"`
		MaxLeverage  int    `json:"max_leverage"`
		LeverageStep string `json:"leverage_step"`
	} `json:"leverage_filter"`
	PriceFilter struct {
		MinPrice string `json:"min_price"`
		MaxPrice string `json:"max_price"`
		TickSize string `json:"tick_size"`
	} `json:"price_filter"`
	LotSizeFilter struct {
		MaxTradingQty float64 `json:"max_trading_qty"`
		MinTradingQty float64 `json:"min_trading_qty"`
		QtyStep       float64 `json:"qty_step"`
	} `json:"lot_size_filter"`
}

type ByBitMarketsResponse ¶ added in v1.4.0

type ByBitMarketsResponse struct {
	RetCode int           `json:"ret_code"`
	RetMsg  string        `json:"ret_msg"`
	ExtCode string        `json:"ext_code"`
	ExtInfo string        `json:"ext_info"`
	Result  []ByBitMarket `json:"result"`
	TimeNow string        `json:"time_now"`
}

type ByBitPairScraper ¶ added in v1.4.0

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

ByBitPairScraper implements PairScraper for ByBit

func (*ByBitPairScraper) Close ¶ added in v1.4.0

func (ps *ByBitPairScraper) Close() error

Close stops listening for trades of the pair associated

func (*ByBitPairScraper) Error ¶ added in v1.4.0

func (ps *ByBitPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*ByBitPairScraper) Pair ¶ added in v1.4.0

func (ps *ByBitPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type ByBitScraper ¶ added in v1.4.0

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

ByBitScraper provides methods needed to get Trade information from ByBit

func NewByBitScraper ¶ added in v1.4.0

func NewByBitScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *ByBitScraper

NewByBitScraper get a scrapper for ByBit exchange

func (*ByBitScraper) Channel ¶ added in v1.4.0

func (s *ByBitScraper) Channel() chan *dia.Trade

Channel returns the channel to get trades

func (*ByBitScraper) Close ¶ added in v1.4.0

func (s *ByBitScraper) Close() error

Close any existing API connections, as well as channels, and terminates main loop

func (*ByBitScraper) Error ¶ added in v1.4.0

func (s *ByBitScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*ByBitScraper) FetchAvailablePairs ¶ added in v1.4.0

func (s *ByBitScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*ByBitScraper) FillSymbolData ¶ added in v1.4.0

func (s *ByBitScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*ByBitScraper) NormalizePair ¶ added in v1.4.0

func (s *ByBitScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*ByBitScraper) ScrapePair ¶ added in v1.4.0

func (s *ByBitScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type ByBitSubscribe ¶ added in v1.4.0

type ByBitSubscribe struct {
	OP   string   `json:"op"`
	Args []string `json:"args"`
}

type ByBitTradeResponse ¶ added in v1.4.0

type ByBitTradeResponse struct {
	Data struct {
		TradeID   string `json:"v"`
		Timestamp int64  `json:"t"`
		Price     string `json:"p"`
		Size      string `json:"q"`
		Side      bool   `json:"m"`
		Type      string `json:"type"`
	} `json:"data"`
	Type      string `json:"type"`
	Topic     string `json:"topic"`
	Timestamp int64  `json:"ts"`
}

type CoinBasePairScraper ¶

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

CoinBasePairScraper implements PairScraper for GDax

func (*CoinBasePairScraper) Close ¶

func (ps *CoinBasePairScraper) Close() error

func (*CoinBasePairScraper) Error ¶

func (ps *CoinBasePairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*CoinBasePairScraper) Pair ¶

Pair returns the pair this scraper is subscribed to

type CoinBaseScraper ¶

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

func NewCoinBaseScraper ¶

func NewCoinBaseScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *CoinBaseScraper

NewCoinBaseScraper returns a new CoinBaseScraper initialized with default values. The instance is asynchronously scraping as soon as it is created.

func (*CoinBaseScraper) Channel ¶

func (ps *CoinBaseScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades/pricing information

func (*CoinBaseScraper) Close ¶

func (s *CoinBaseScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*CoinBaseScraper) FetchAvailablePairs ¶

func (s *CoinBaseScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*CoinBaseScraper) FillSymbolData ¶

func (s *CoinBaseScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData collects all available information on an asset traded on CoinBase

func (*CoinBaseScraper) NormalizePair ¶

func (s *CoinBaseScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*CoinBaseScraper) ScrapePair ¶

func (s *CoinBaseScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type CoinflexFuturesScraper ¶

type CoinflexFuturesScraper struct {
	Markets   []string
	WaitGroup *sync.WaitGroup
	Writer    writers.Writer
	Logger    *zap.SugaredLogger
}

CoinflexFuturesScraper - scrapes the futures from the Coinflex exchange

func (*CoinflexFuturesScraper) Authenticate ¶

func (s *CoinflexFuturesScraper) Authenticate(market string, connection interface{}) error

Authenticate - placeholder here, since we do not need to authneticate the connection.

func (*CoinflexFuturesScraper) Scrape ¶

func (s *CoinflexFuturesScraper) Scrape(market string)

Scrape starts a websocket scraper for market

func (*CoinflexFuturesScraper) ScrapeMarkets ¶

func (s *CoinflexFuturesScraper) ScrapeMarkets()

ScrapeMarkets - will scrape the markets specified during instantiation

func (*CoinflexFuturesScraper) ScraperClose ¶

func (s *CoinflexFuturesScraper) ScraperClose(market string, connection interface{}) error

ScraperClose - safely closes the scraper; We pass the interface connection as the second argument primarily for the reason that Huobi scraper does not use the gorilla websocket; It uses golang's x websocket; If we did not define this method in our FuturesScraper interface, we could have easily used the pointer to gorilla websocket here; However, to make FuturesScraper more ubiquituous, we need an interface here.

type ComputedCVI ¶

type ComputedCVI struct {
	CVI             float64
	CalculationTime time.Time
}

ComputedCVI is a struct representing our CVI value at a point in time

type ComputedCVIs ¶

type ComputedCVIs chan ComputedCVI

ComputedCVIs is the channel type that will communicate the cvis

type CryptoDotComPairScraper ¶ added in v1.4.0

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

CryptoDotComPairScraper implements PairScraper for Crypto.com

func (*CryptoDotComPairScraper) Close ¶ added in v1.4.0

func (p *CryptoDotComPairScraper) Close() error

Close stops listening for trades of the pair associated with the Crypto.com scraper

func (*CryptoDotComPairScraper) Error ¶ added in v1.4.0

func (p *CryptoDotComPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*CryptoDotComPairScraper) Pair ¶ added in v1.4.0

Pair returns the pair this scraper is subscribed to

type CryptoDotComScraper ¶ added in v1.4.0

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

CryptoDotComScraper is a scraper for Crypto.com

func NewCryptoDotComScraper ¶ added in v1.4.0

func NewCryptoDotComScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *CryptoDotComScraper

NewCryptoDotComScraper returns a new Crypto.com scraper

func (*CryptoDotComScraper) Channel ¶ added in v1.4.0

func (s *CryptoDotComScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*CryptoDotComScraper) Close ¶ added in v1.4.0

func (s *CryptoDotComScraper) Close() error

Close unsubscribes data and closes any existing WebSocket connections, as well as channels of CryptoDotComScraper

func (*CryptoDotComScraper) FetchAvailablePairs ¶ added in v1.4.0

func (s *CryptoDotComScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns all traded pairs on Crypto.com

func (*CryptoDotComScraper) FillSymbolData ¶ added in v1.4.0

func (s *CryptoDotComScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData adds the name to the asset underlying @symbol on Crypto.com

func (*CryptoDotComScraper) NormalizePair ¶ added in v1.4.0

func (s *CryptoDotComScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*CryptoDotComScraper) ScrapePair ¶ added in v1.4.0

func (s *CryptoDotComScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the Crypto.com scraper

type CurveCoin ¶

type CurveCoin struct {
	Symbol   string
	Decimals uint8
	Address  string
	Name     string
}

type CurveFIPairScraper ¶

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

func (*CurveFIPairScraper) Close ¶

func (pairScraper *CurveFIPairScraper) Close() error

func (*CurveFIPairScraper) Error ¶

func (pairScraper *CurveFIPairScraper) Error() error

func (*CurveFIPairScraper) Pair ¶

func (pairScraper *CurveFIPairScraper) Pair() dia.ExchangePair

type CurveFIScraper ¶

type CurveFIScraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

CurveFIScraper is a curve finance scraper on a specific blockchain.

func NewCurveFIScraper ¶

func NewCurveFIScraper(exchange dia.Exchange, scrape bool) *CurveFIScraper

func (*CurveFIScraper) Channel ¶

func (scraper *CurveFIScraper) Channel() chan *dia.Trade

func (*CurveFIScraper) Close ¶

func (scraper *CurveFIScraper) Close() error

func (*CurveFIScraper) FetchAvailablePairs ¶

func (scraper *CurveFIScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*CurveFIScraper) FillSymbolData ¶

func (scraper *CurveFIScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*CurveFIScraper) NormalizePair ¶

func (scraper *CurveFIScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*CurveFIScraper) ScrapePair ¶

func (scraper *CurveFIScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

type DeribitScraper ¶

type DeribitScraper struct {
	Markets      []string
	WaitGroup    *sync.WaitGroup
	Logger       *zap.SugaredLogger
	DataStore    *models.DB
	WsConnection *websocket.Conn

	// required for deribit to:
	// 1. authenticate (trades is a private channel)
	// 2. referesh the token from step 1., so that the channel isn't closed
	AccessKey    string
	AccessSecret string

	RefreshTokenEvery int16 // how often we refresh the token (in seconds)
	MarketKind        DeribitScraperKind
}

DeribitScraper - used in conjunction with the DeribitScraperKind in a new struct to define futures and options scrapers

func (*DeribitScraper) Scrape ¶

func (s *DeribitScraper) Scrape(market string)

Scrape starts a websocket scraper for market

func (*DeribitScraper) ScrapeMarkets ¶

func (s *DeribitScraper) ScrapeMarkets()

ScrapeMarkets - will scrape the markets specified during instantiation

func (*DeribitScraper) ScraperClose ¶

func (s *DeribitScraper) ScraperClose(market string, websocketConnection interface{}) error

ScraperClose - responsible for closing out the scraper for a market

type DeribitScraperKind ¶

type DeribitScraperKind int

DeribitScraperKind - used to distinguish between the futures and options scrapers

const (
	// DeribitFuture - constant to signal the futures scraper
	DeribitFuture DeribitScraperKind = iota + 1
	// DeribitOption - constant to signal the options scraper
	DeribitOption
)

type ECBPairScraper ¶

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

ECBPairScraper implements PairScraper for ECB

func (*ECBPairScraper) Close ¶

func (ps *ECBPairScraper) Close() error

func (*ECBPairScraper) Error ¶

func (ps *ECBPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*ECBPairScraper) Pair ¶

func (ps *ECBPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type ECBScraper ¶

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

func SpawnECBScraper ¶

func SpawnECBScraper(datastore models.Datastore) *ECBScraper

SpawnECBScraper returns a new ECBScraper initialized with default values. The instance is asynchronously scraping as soon as it is created.

func (*ECBScraper) Channel ¶

func (ps *ECBScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades/pricing information

func (*ECBScraper) Close ¶

func (s *ECBScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*ECBScraper) ScrapePair ¶

func (s *ECBScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

func (*ECBScraper) Update ¶

func (s *ECBScraper) Update() error

Update performs a HTTP Get request for the rss feed and decodes the results.

type EventType ¶

type EventType struct {
	Sub  string `json:"sub,omitempty"`
	Id   string `json:"id,omitempty"`
	Pong int    `json:"pong,omitempty"`
}

type FTXFuturesScraper ¶

type FTXFuturesScraper struct {
	Markets   []string
	WaitGroup *sync.WaitGroup
	Writer    writers.Writer
	Logger    *zap.SugaredLogger
}

FTXFuturesScraper - scrapes the futures from the FTX exchange

func (*FTXFuturesScraper) Authenticate ¶

func (s *FTXFuturesScraper) Authenticate(market string, connection interface{}) error

Authenticate - placeholder here, since we do not need to authneticate the connection.

func (*FTXFuturesScraper) Scrape ¶

func (s *FTXFuturesScraper) Scrape(market string)

Scrape starts a websocket scraper for market

func (*FTXFuturesScraper) ScrapeMarkets ¶

func (s *FTXFuturesScraper) ScrapeMarkets()

ScrapeMarkets - will scrape the markets specified during instantiation

func (*FTXFuturesScraper) ScraperClose ¶

func (s *FTXFuturesScraper) ScraperClose(market string, connection interface{}) error

ScraperClose - safely closes the scraper; We pass the interface connection as the second argument primarily for the reason that Huobi scraper does not use the gorilla websocket; It uses golang's x websocket; If we did not define this method in our FuturesScraper interface, we could have easily used the pointer to gorilla websocket here; However, to make FuturesScraper more ubiquituous, we need an interface here.

type FinageForexPairScraper ¶

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

ECBPairScraper implements PairScraper for ECB

func (*FinageForexPairScraper) Close ¶

func (pairScraper *FinageForexPairScraper) Close() error

func (*FinageForexPairScraper) Error ¶

func (pairScraper *FinageForexPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*FinageForexPairScraper) Pair ¶

func (pairScraper *FinageForexPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type FinageForexScraper ¶

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

func NewFinageForexScraper ¶

func NewFinageForexScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB, finageAPIkey string, finageWebsocketKey string) *FinageForexScraper

SpawnECBScraper returns a new ECBScraper initialized with default values. The instance is asynchronously scraping as soon as it is created.

func (*FinageForexScraper) Channel ¶

func (scraper *FinageForexScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades/pricing information

func (*FinageForexScraper) Close ¶

func (scraper *FinageForexScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*FinageForexScraper) FetchAvailablePairs ¶

func (scraper *FinageForexScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*FinageForexScraper) FillSymbolData ¶

func (scraper *FinageForexScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

func (*FinageForexScraper) NormalizePair ¶

func (scraper *FinageForexScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*FinageForexScraper) ScrapePair ¶

func (scraper *FinageForexScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

func (*FinageForexScraper) Update ¶

func (scraper *FinageForexScraper) Update() error

Update performs a HTTP Get request for the rss feed and decodes the results.

type FinageSymbolResponse ¶

type FinageSymbolResponse struct {
	Page      int `json:"page"`
	TotalPage int `json:"totalPage"`
	Symbols   []struct {
		Symbol string `json:"symbol"`
		Name   string `json:"name"`
	} `json:"symbols"`
}

type FinageTrade ¶

type FinageTrade struct {
	Symbol    string  `json:"s"`
	PriceAsk  float64 `json:"a"`
	PriceBid  float64 `json:"b"`
	VolumeAsk string  `json:"dc"`
	VolumeBid string  `json:"dd"`
	Timestamp int64   `json:"t"`
}

type FinageWSMessage ¶

type FinageWSMessage struct {
	Action  string `json:"action"`
	Symbols string `json:"symbols"`
}

type FuturesScraper ¶

type FuturesScraper interface {
	Scrape(market string) // a self-sustained goroutine that scrapes a single market
	ScrapeMarkets()       // will scrape the futures markets defined during instantiation of the scraper
	ScraperClose(market string, websocketConnection interface{}) error
}

FuturesScraper is an interface for all of the Futures Contracts scrapers

func NewBitflyerFuturesScraper ¶

func NewBitflyerFuturesScraper(markets []string) FuturesScraper

NewBitflyerFuturesScraper - returns an instance of an options scraper.

func NewBitmexFuturesScraper ¶

func NewBitmexFuturesScraper(markets []string) FuturesScraper

NewBitmexFuturesScraper - returns an instance of an options scraper.

func NewCoinflexFuturesScraper ¶

func NewCoinflexFuturesScraper(markets []string) FuturesScraper

NewCoinflexFuturesScraper - returns an instance of the coinflex scraper

func NewFTXFuturesScraper ¶

func NewFTXFuturesScraper(markets []string) FuturesScraper

NewFTXFuturesScraper - returns an instance of the FTX scraper

func NewHuobiFuturesScraper ¶

func NewHuobiFuturesScraper(markets []string) FuturesScraper

NewHuobiFuturesScraper - returns an instance of the Huobi scraper

type GateIOCurrency ¶

type GateIOCurrency struct {
	No          int    `json:"no"`
	Symbol      string `json:"symbol"`
	Name        string `json:"name"`
	NameEn      string `json:"name_en"`
	NameCn      string `json:"name_cn"`
	Pair        string `json:"pair"`
	Rate        string `json:"rate"`
	VolA        string `json:"vol_a"`
	VolB        string `json:"vol_b"`
	CurrA       string `json:"curr_a"`
	CurrB       string `json:"curr_b"`
	CurrSuffix  string `json:"curr_suffix"`
	RatePercent string `json:"rate_percent"`
	Trend       string `json:"trend"`
	Lq          string `json:"lq"`
	PRate       int    `json:"p_rate"`
}

type GateIOPair ¶

type GateIOPair struct {
	ID              string `json:"id"`
	Base            string `json:"base"`
	Quote           string `json:"quote"`
	Fee             string `json:"fee"`
	MinQuoteAmount  string `json:"min_quote_amount,omitempty"`
	AmountPrecision int    `json:"amount_precision"`
	Precision       int    `json:"precision"`
	TradeStatus     string `json:"trade_status"`
	SellStart       int    `json:"sell_start"`
	BuyStart        int    `json:"buy_start"`
	MinBaseAmount   string `json:"min_base_amount,omitempty"`
}

type GateIOPairScraper ¶

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

GateIOPairScraper implements PairScraper for GateIO

func (*GateIOPairScraper) Close ¶

func (ps *GateIOPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*GateIOPairScraper) Error ¶

func (ps *GateIOPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*GateIOPairScraper) Pair ¶

func (ps *GateIOPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type GateIOResponseTrade ¶

type GateIOResponseTrade struct {
	Time    int    `json:"time"`
	Channel string `json:"channel"`
	Event   string `json:"event"`
	Result  struct {
		ID           int    `json:"id"`
		CreateTime   int    `json:"create_time"`
		CreateTimeMs string `json:"create_time_ms"`
		Side         string `json:"side"`
		CurrencyPair string `json:"currency_pair"`
		Amount       string `json:"amount"`
		Price        string `json:"price"`
	} `json:"result"`
}

type GateIOScraper ¶

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

func NewGateIOScraper ¶

func NewGateIOScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *GateIOScraper

NewGateIOScraper returns a new GateIOScraper for the given pair

func (*GateIOScraper) Channel ¶

func (ps *GateIOScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*GateIOScraper) Close ¶

func (s *GateIOScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*GateIOScraper) FetchAvailablePairs ¶

func (s *GateIOScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*GateIOScraper) FillSymbolData ¶

func (s *GateIOScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FetchTickerData collects all available information on an asset traded on GateIO

func (*GateIOScraper) NormalizePair ¶

func (s *GateIOScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*GateIOScraper) ScrapePair ¶

func (s *GateIOScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type GateIOTickerData ¶

type GateIOTickerData struct {
	Result string           `json:"result"`
	Data   []GateIOCurrency `json:"data"`
}

type GateIPPairResponse ¶

type GateIPPairResponse []GateIOPair

type HuobiCurrency ¶

type HuobiCurrency struct {
	Code int `json:"code"`
	Data []struct {
		Currency  string `json:"currency"`
		AssetType int    `json:"assetType"`
		Chains    []struct {
			Chain                  string      `json:"chain"`
			DisplayName            string      `json:"displayName"`
			BaseChain              string      `json:"baseChain"`
			BaseChainProtocol      string      `json:"baseChainProtocol"`
			IsDynamic              bool        `json:"isDynamic"`
			NumOfConfirmations     int         `json:"numOfConfirmations"`
			NumOfFastConfirmations int         `json:"numOfFastConfirmations"`
			DepositStatus          string      `json:"depositStatus"`
			MinDepositAmt          string      `json:"minDepositAmt"`
			WithdrawStatus         string      `json:"withdrawStatus"`
			MinWithdrawAmt         string      `json:"minWithdrawAmt"`
			WithdrawPrecision      int         `json:"withdrawPrecision"`
			MaxWithdrawAmt         string      `json:"maxWithdrawAmt"`
			WithdrawQuotaPerDay    string      `json:"withdrawQuotaPerDay"`
			WithdrawQuotaPerYear   interface{} `json:"withdrawQuotaPerYear"`
			WithdrawQuotaTotal     interface{} `json:"withdrawQuotaTotal"`
			WithdrawFeeType        string      `json:"withdrawFeeType"`
			TransactFeeWithdraw    string      `json:"transactFeeWithdraw"`
			AddrWithTag            bool        `json:"addrWithTag"`
			AddrDepositTag         bool        `json:"addrDepositTag"`
		} `json:"chains"`
		InstStatus string `json:"instStatus"`
	} `json:"data"`
}

type HuobiFuturesScraper ¶

type HuobiFuturesScraper struct {
	Markets   []string // markets to scrape. To scrape all, call AllFuturesMarketsHuobi()
	WaitGroup *sync.WaitGroup
	Writer    writers.Writer // an interface to write the messages
	Logger    *zap.SugaredLogger
}

HuobiFuturesScraper - scrapes huobi's futures markets

func (*HuobiFuturesScraper) Authenticate ¶

func (s *HuobiFuturesScraper) Authenticate(market string, connection interface{}) error

Authenticate - not required for Huobi to scrape the futures data.

func (*HuobiFuturesScraper) Scrape ¶

func (s *HuobiFuturesScraper) Scrape(market string)

Scrape starts a websocket scraper for market

func (*HuobiFuturesScraper) ScrapeMarkets ¶

func (s *HuobiFuturesScraper) ScrapeMarkets()

ScrapeMarkets - will scrape the markets specified during instantiation

func (*HuobiFuturesScraper) ScraperClose ¶

func (s *HuobiFuturesScraper) ScraperClose(market string, connection interface{}) error

ScraperClose - clean up after the scraper.

type HuobiPairScraper ¶

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

HuobiPairScraper implements PairScraper for Huobi exchange

func (*HuobiPairScraper) Close ¶

func (ps *HuobiPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*HuobiPairScraper) Error ¶

func (ps *HuobiPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*HuobiPairScraper) Pair ¶

func (ps *HuobiPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type HuobiScraper ¶

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

func NewHuobiScraper ¶

func NewHuobiScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *HuobiScraper

NewHuobiScraper returns a new HuobiScraper for the given pair

func (*HuobiScraper) Channel ¶

func (ps *HuobiScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*HuobiScraper) Close ¶

func (s *HuobiScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*HuobiScraper) FetchAvailablePairs ¶

func (s *HuobiScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*HuobiScraper) FillSymbolData ¶

func (s *HuobiScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData collects all available information on an asset traded on huobi

func (*HuobiScraper) NormalizePair ¶

func (s *HuobiScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*HuobiScraper) ScrapePair ¶

func (s *HuobiScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type InfluxPairScraper ¶

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

GateIOPairScraper implements PairScraper for GateIO

func (*InfluxPairScraper) Close ¶

func (ps *InfluxPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*InfluxPairScraper) Error ¶

func (ps *InfluxPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*InfluxPairScraper) Pair ¶

func (ps *InfluxPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type InfluxScraper ¶

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

func NewInfluxScraper ¶

func NewInfluxScraper(scrape bool) *InfluxScraper

NewGateIOScraper returns a new GateIOScraper for the given pair

func (*InfluxScraper) Channel ¶

func (s *InfluxScraper) Channel() chan *dia.Trade

func (*InfluxScraper) Close ¶

func (s *InfluxScraper) Close() error

func (*InfluxScraper) FetchAvailablePairs ¶

func (s *InfluxScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*InfluxScraper) FillSymbolData ¶

func (s *InfluxScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FetchTickerData collects all available information on an asset traded on GateIO

func (*InfluxScraper) NormalizePair ¶

func (s *InfluxScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*InfluxScraper) ScrapePair ¶

func (s *InfluxScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type KrakenPairScraper ¶

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

KrakenPairScraper implements PairScraper for Kraken

func (*KrakenPairScraper) Close ¶

func (ps *KrakenPairScraper) Close() error

func (*KrakenPairScraper) Error ¶

func (ps *KrakenPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*KrakenPairScraper) Pair ¶

func (ps *KrakenPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type KrakenScraper ¶

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

func NewKrakenScraper ¶

func NewKrakenScraper(key string, secret string, exchange dia.Exchange, scrape bool, relDB *models.RelDB) *KrakenScraper

NewKrakenScraper returns a new KrakenScraper initialized with default values. The instance is asynchronously scraping as soon as it is created.

func (*KrakenScraper) Channel ¶

func (ps *KrakenScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades/pricing information

func (*KrakenScraper) Close ¶

func (s *KrakenScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*KrakenScraper) FetchAvailablePairs ¶

func (s *KrakenScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*KrakenScraper) FillSymbolData ¶

func (s *KrakenScraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*KrakenScraper) NormalizePair ¶

func (ps *KrakenScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

NormalizePair accounts for the par

func (*KrakenScraper) ScrapePair ¶

func (s *KrakenScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

func (*KrakenScraper) Update ¶

func (s *KrakenScraper) Update()

type KuCoinPairScraper ¶

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

KuCoinPairScraper implements PairScraper for kuCoin

func (*KuCoinPairScraper) Close ¶

func (ps *KuCoinPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*KuCoinPairScraper) Error ¶

func (ps *KuCoinPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*KuCoinPairScraper) Pair ¶

func (ps *KuCoinPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type KuCoinScraper ¶

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

func NewKuCoinScraper ¶

func NewKuCoinScraper(apiKey string, secretKey string, exchange dia.Exchange, scrape bool, relDB *models.RelDB) *KuCoinScraper

func (*KuCoinScraper) Channel ¶

func (ps *KuCoinScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*KuCoinScraper) Close ¶

func (s *KuCoinScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*KuCoinScraper) FetchAvailablePairs ¶

func (s *KuCoinScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns all traded pairs on kucoin.

func (*KuCoinScraper) FillSymbolData ¶

func (s *KuCoinScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData adds the name to the asset underlying @symbol on kucoin.

func (*KuCoinScraper) NormalizePair ¶

func (s *KuCoinScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*KuCoinScraper) ScrapePair ¶

func (s *KuCoinScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type KuExchangePair ¶

type KuExchangePair struct {
	Symbol          string `json:"symbol"`
	Name            string `json:"name"`
	BaseCurrency    string `json:"baseCurrency"`
	QuoteCurrency   string `json:"quoteCurrency"`
	FeeCurrency     string `json:"feeCurrency"`
	Market          string `json:"market"`
	BaseMinSize     string `json:"baseMinSize"`
	QuoteMinSize    string `json:"quoteMinSize"`
	BaseMaxSize     string `json:"baseMaxSize"`
	QuoteMaxSize    string `json:"quoteMaxSize"`
	BaseIncrement   string `json:"baseIncrement"`
	QuoteIncrement  string `json:"quoteIncrement"`
	PriceIncrement  string `json:"priceIncrement"`
	PriceLimitRate  string `json:"priceLimitRate"`
	IsMarginEnabled bool   `json:"isMarginEnabled"`
	EnableTrading   bool   `json:"enableTrading"`
}

type KuExchangePairs ¶

type KuExchangePairs []KuExchangePair

type KucoinCurrency ¶

type KucoinCurrency struct {
	Symbol  string `json:"currency"`
	Name    string `json:"fullName"`
	Address string `json:"contractAddress"`
}

type KucoinMarketMatch ¶

type KucoinMarketMatch struct {
	Symbol       string `json:"symbol"`
	Sequence     string `json:"sequence"`
	Side         string `json:"side"`
	Size         string `json:"size"`
	Price        string `json:"price"`
	TakerOrderID string `json:"takerOrderId"`
	Time         string `json:"time"`
	Type         string `json:"type"`
	MakerOrderID string `json:"makerOrderId"`
	TradeID      string `json:"tradeId"`
}

type MEXCExchangeInfo ¶ added in v1.4.2

type MEXCExchangeInfo struct {
	Timezone        string               `json:"timezone"`
	ServerTime      int                  `json:"serverTime"`
	RateLimits      string               `json:"rateLimits"`
	ExchangeFilters string               `json:"exchangeFilters"`
	Symbols         []MEXCExchangeSymbol `json:"symbols"`
}

type MEXCExchangeSymbol ¶ added in v1.4.2

type MEXCExchangeSymbol struct {
	Symbol                     string   `json:"symbol"`
	Status                     string   `json:"status"`
	BaseAsset                  string   `json:"baseAsset"`
	BaseAssetPrecision         int      `json:"baseAssetPrecision"`
	QuoteAsset                 string   `json:"quoteAsset"`
	QuotePrecision             int      `json:"quotePrecision"`
	QuoteAssetPrecision        int      `json:"quoteAssetPrecision"`
	BaseCommissionPrecision    int      `json:"baseCommissionPrecision"`
	QuoteCommissionPrecision   int      `json:"quoteCommissionPrecision"`
	OrderTypes                 []string `json:"orderTypes"` // [LIMIT, LIMIT_MAKER]
	QuoteOrderQtyMarketAllowed bool     `json:"quoteOrderQtyMarketAllowed"`
	IsSpotTradingAllowed       bool     `json:"isSpotTradingAllowed"`
	IsMarginTradingAllowed     bool     `json:"isMarginTradingAllowed"`
	QuoteAmountPrecision       string   `json:"quoteAmountPrecision"`
	BaseSizePrecision          string   `json:"baseSizePrecision"`
	Permissions                []string `json:"permissions"`
	Filters                    []string `json:"filters"`
	MaxQuoteAmount             string   `json:"maxQuoteAmount"`
	MakerCommission            string   `json:"makerCommission"`
	TakerCommission            string   `json:"takerCommission"`
}

type MEXCPairScraper ¶ added in v1.4.2

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

MEXCPairScraper implements PairScraper for MEXC

func (*MEXCPairScraper) Close ¶ added in v1.4.2

func (ps *MEXCPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*MEXCPairScraper) Error ¶ added in v1.4.2

func (ps *MEXCPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*MEXCPairScraper) Pair ¶ added in v1.4.2

func (ps *MEXCPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type MEXCRequest ¶ added in v1.4.2

type MEXCRequest struct {
	Method string   `json:"method"`
	Params []string `json:"params"`
	ID     int64    `json:"id"`
}

type MEXCScraper ¶ added in v1.4.2

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

MEXCScraper is a scraper for MEXC

func NewMEXCScraper ¶ added in v1.4.2

func NewMEXCScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *MEXCScraper

func (*MEXCScraper) Channel ¶ added in v1.4.2

func (s *MEXCScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*MEXCScraper) Close ¶ added in v1.4.2

func (s *MEXCScraper) Close() error

func (*MEXCScraper) FetchAvailablePairs ¶ added in v1.4.2

func (s *MEXCScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

func (*MEXCScraper) FillSymbolData ¶ added in v1.4.2

func (s *MEXCScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData from MEXCScraper @todo more update

func (*MEXCScraper) NormalizePair ¶ added in v1.4.2

func (s *MEXCScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*MEXCScraper) ScrapePair ¶ added in v1.4.2

func (s *MEXCScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

type MEXCTradeResponse ¶ added in v1.4.2

type MEXCTradeResponse struct {
	C string `json:"c"`
	D struct {
		Deals []struct {
			Side   int    `json:"S"`
			Price  string `json:"p"`
			Volume string `json:"v"`
			TS     int64  `json:"t"`
		} `json:"deals"`
	} `json:"d"`
	Symbol string `json:"s"`
}

type MEXCWSConnection ¶ added in v1.4.52

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

type MultiChainConfig ¶ added in v1.4.2

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

type OKEXArgs ¶

type OKEXArgs struct {
	Channel string `json:"channel"`
	InstID  string `json:"instId"`
}

type OKEXMarket ¶

type OKEXMarket struct {
	Alias     string `json:"alias"`
	BaseCcy   string `json:"baseCcy"`
	Category  string `json:"category"`
	CtMult    string `json:"ctMult"`
	CtType    string `json:"ctType"`
	CtVal     string `json:"ctVal"`
	CtValCcy  string `json:"ctValCcy"`
	ExpTime   string `json:"expTime"`
	InstID    string `json:"instId"`
	InstType  string `json:"instType"`
	Lever     string `json:"lever"`
	ListTime  string `json:"listTime"`
	LotSz     string `json:"lotSz"`
	MinSz     string `json:"minSz"`
	OptType   string `json:"optType"`
	QuoteCcy  string `json:"quoteCcy"`
	SettleCcy string `json:"settleCcy"`
	State     string `json:"state"`
	Stk       string `json:"stk"`
	TickSz    string `json:"tickSz"`
	Uly       string `json:"uly"`
}

type OKEXWSResponse ¶

type OKEXWSResponse struct {
	Arg struct {
		Channel string `json:"channel"`
		InstID  string `json:"instId"`
	} `json:"arg"`
	Data []struct {
		InstID  string `json:"instId"`
		TradeID string `json:"tradeId"`
		Px      string `json:"px"`
		Sz      string `json:"sz"`
		Side    string `json:"side"`
		Ts      string `json:"ts"`
	} `json:"data"`
}

type OKExPairScraper ¶

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

OKExPairScraper implements PairScraper for OKEx exchange

func (*OKExPairScraper) Close ¶

func (ps *OKExPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*OKExPairScraper) Error ¶

func (ps *OKExPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*OKExPairScraper) Pair ¶

func (ps *OKExPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type OKExScraper ¶

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

func NewOKExScraper ¶

func NewOKExScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *OKExScraper

NewOKExScraper returns a new OKExScraper for the given pair

func (*OKExScraper) Channel ¶

func (s *OKExScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*OKExScraper) Close ¶

func (s *OKExScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*OKExScraper) FetchAvailablePairs ¶

func (s *OKExScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*OKExScraper) FillSymbolData ¶

func (s *OKExScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

func (*OKExScraper) NormalizePair ¶

func (s *OKExScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*OKExScraper) ScrapePair ¶

func (s *OKExScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type OptionSettlement ¶

type OptionSettlement int

OptionSettlement - is an enum, signalling if the settlement is regular or weekly

const (
	RegularOptionSettlement OptionSettlement = iota + 1
	WeeklyOptionSettlement
)

OptionSettlement enums

type OptionsScraper ¶

type OptionsScraper interface {
	Scrape(market string) // a self-sustained goroutine that scrapes a single market
	//	ScrapeMarkets()       // will scrape the options markets defined during instantiation of the scraper
	ScraperClose(market string, websocketConnection interface{}) error
	Authenticate(market string, websocketConnection interface{}) error
}

OptionsScraper is an interface for all of the Options Contracts scrapers

type OrcaPairScraper ¶ added in v1.4.81

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

func (*OrcaPairScraper) Close ¶ added in v1.4.81

func (ps *OrcaPairScraper) Close() error

Close stops listening for trades of the pair associated with the scraper

func (*OrcaPairScraper) Error ¶ added in v1.4.81

func (ps *OrcaPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*OrcaPairScraper) Pair ¶ added in v1.4.81

func (ps *OrcaPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type OrcaScraper ¶ added in v1.4.81

type OrcaScraper struct {
	RestClient *rpc.Client
	WsClient   *ws.Client
	// contains filtered or unexported fields
}

The scraper object for Orca

func NewOrcaScraper ¶ added in v1.4.81

func NewOrcaScraper(exchange dia.Exchange, scrape bool) *OrcaScraper

Returns a new exchange scraper

func (*OrcaScraper) Channel ¶ added in v1.4.81

func (s *OrcaScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*OrcaScraper) Close ¶ added in v1.4.81

func (s *OrcaScraper) Close() error

Closes any existing API connections, as well as channels of pairScrapers from calls to ScrapePair

func (*OrcaScraper) FetchAvailablePairs ¶ added in v1.4.81

func (s *OrcaScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

Returns the list of all available trade pairs in order to pairDiscoveryService service work

func (*OrcaScraper) FillSymbolData ¶ added in v1.4.81

func (s *OrcaScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData adds the name to the asset underlying @symbol on scraper

func (*OrcaScraper) NormalizePair ¶ added in v1.4.81

func (s *OrcaScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

NormalizePair accounts for the pair

func (*OrcaScraper) ScrapePair ¶ added in v1.4.81

func (s *OrcaScraper) ScrapePair(pair dia.ExchangePair) (ps PairScraper, err error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the scraper

type OrcaTokenMetadata ¶ added in v1.4.88

type OrcaTokenMetadata interface {
	GetName() string
	GetSymbol() string
}

type PairScraper ¶

type PairScraper interface {
	io.Closer
	// Error returns an error when the channel Channel() is closed
	// and nil otherwise
	Error() error

	// Pair returns the pair this scraper is subscribed to
	Pair() dia.ExchangePair
}

PairScraper receives trades for a single pc.ExchangePair from a single exchange.

type ParsedDeribitOptionOrderbookEntry ¶

type ParsedDeribitOptionOrderbookEntry struct {
	Timestamp      int64       `json:"timestamp"`
	InstrumentName string      `json:"instrument_name"`
	ChangeId       int64       `json:"change_id"`
	Bids           [][]float64 `json:"bids"`
	Asks           [][]float64 `json:"asks"`
}

type ParsedDeribitResponse ¶

type ParsedDeribitResponse struct {
	Jsonrpc string                      `json:"jsonrpc"`
	Method  string                      `json:"method"`
	Params  ParsedDeribitResponseParams `json:"params"`
}

type ParsedDeribitResponseParams ¶

type ParsedDeribitResponseParams struct {
	Channel string                            `json:"channel"`
	Data    ParsedDeribitOptionOrderbookEntry `json:"data"`
}

type PlatypusCoin ¶ added in v1.4.2

type PlatypusCoin struct {
	Symbol   string
	Decimals uint8
	Address  string
	Name     string
}

type PlatypusPairScraper ¶ added in v1.4.2

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

func (*PlatypusPairScraper) Close ¶ added in v1.4.2

func (ps *PlatypusPairScraper) Close() error

Close stops listening for trades of the pair associated with the scraper

func (*PlatypusPairScraper) Error ¶ added in v1.4.2

func (ps *PlatypusPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*PlatypusPairScraper) Pair ¶ added in v1.4.2

Pair returns the pair this scraper is subscribed to

type PlatypusPools ¶ added in v1.4.2

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

type PlatypusScraper ¶ added in v1.4.2

type PlatypusScraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

PlatypusScraper The scraper object for Platypus Finance

func NewPlatypusScraper ¶ added in v1.4.2

func NewPlatypusScraper(exchange dia.Exchange, scrape bool) *PlatypusScraper

NewPlatypusScraper Returns a new exchange scraper

func (*PlatypusScraper) Channel ¶ added in v1.4.2

func (s *PlatypusScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*PlatypusScraper) Close ¶ added in v1.4.2

func (s *PlatypusScraper) Close() error

Close Closes any existing API connections, as well as channels of pairScrapers from calls to ScrapePair

func (*PlatypusScraper) FetchAvailablePairs ¶ added in v1.4.2

func (s *PlatypusScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

Returns the list of all available trade pairs

func (*PlatypusScraper) FillSymbolData ¶ added in v1.4.2

func (s *PlatypusScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData adds the name to the asset underlying @symbol on scraper

func (*PlatypusScraper) NormalizePair ¶ added in v1.4.2

func (s *PlatypusScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

NormalizePair accounts for the pair

func (*PlatypusScraper) ScrapePair ¶ added in v1.4.2

func (s *PlatypusScraper) ScrapePair(pair dia.ExchangePair) (ps PairScraper, err error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from the scraper

type Pools ¶

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

type Response ¶

type Response struct {
	Channel string     `json:"channel"`
	Data    [][]string `json:"data"`
	Binary  int        `json:"binary"`
}

type ResponseGate ¶

type ResponseGate struct {
	Method string        `json:"method,omitempty"`
	Params []interface{} `json:"params,omitempty"`
	Id     interface{}   `json:"id,omitempty"`
}

type ResponseType ¶

type ResponseType struct {
	Id     string      `json:"id,omitempty"`
	Status string      `json:"status,omitempty"`
	Subbed string      `json:"subbed,omitempty"`
	Ts     int64       `json:"ts,omitempty"`
	Ping   int         `json:"ping,omitempty"`
	Ch     string      `json:"ch,omitempty"`
	Tick   interface{} `json:"tick,omitempty"`
}

type Responses ¶

type Responses []Response

type Subscribe ¶

type Subscribe struct {
	OP   string     `json:"op"`
	Args []OKEXArgs `json:"args"`
}

type SubscribeGate ¶

type SubscribeGate struct {
	Time    int64    `json:"time"`
	Channel string   `json:"channel"`
	Event   string   `json:"event"`
	Payload []string `json:"payload"`
}

type UniswapHistoryPairScraper ¶

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

UniswapPairScraper implements PairScraper for Uniswap

func (*UniswapHistoryPairScraper) Close ¶

func (ps *UniswapHistoryPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*UniswapHistoryPairScraper) Error ¶

func (ps *UniswapHistoryPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*UniswapHistoryPairScraper) Pair ¶

Pair returns the pair this scraper is subscribed to

type UniswapHistoryScraper ¶

type UniswapHistoryScraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

func NewUniswapHistoryScraper ¶

func NewUniswapHistoryScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *UniswapHistoryScraper

NewUniswapScraper returns a new UniswapScraper for the given pair

func (*UniswapHistoryScraper) Channel ¶

func (ps *UniswapHistoryScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*UniswapHistoryScraper) Close ¶

func (s *UniswapHistoryScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*UniswapHistoryScraper) FetchAvailablePairs ¶

func (s *UniswapHistoryScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs as dia.ExchangePair for the pairDiscorvery service

func (*UniswapHistoryScraper) FillSymbolData ¶

func (s *UniswapHistoryScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData is not used by DEX scrapers.

func (*UniswapHistoryScraper) GetAllPairs ¶

func (s *UniswapHistoryScraper) GetAllPairs() ([]UniswapPair, error)

GetAllPairs is similar to FetchAvailablePairs. But instead of dia.ExchangePairs it returns all pairs as UniswapPairs, i.e. including the pair's address

func (*UniswapHistoryScraper) GetDecimals ¶

func (s *UniswapHistoryScraper) GetDecimals(tokenAddress common.Address) (decimals uint8, err error)

GetDecimals returns the decimals of the token with address @tokenAddress

func (*UniswapHistoryScraper) GetName ¶

func (s *UniswapHistoryScraper) GetName(tokenAddress common.Address) (name string, err error)

func (*UniswapHistoryScraper) GetPairByAddress ¶

func (s *UniswapHistoryScraper) GetPairByAddress(pairAddress common.Address) (pair UniswapPair, err error)

GetPairByAddress returns the UniswapPair with pair address @pairAddress

func (*UniswapHistoryScraper) GetPairByID ¶

func (s *UniswapHistoryScraper) GetPairByID(num int64) (UniswapPair, error)

GetPairByID returns the UniswapPair with the integer id @num

func (*UniswapHistoryScraper) NormalizePair ¶

func (up *UniswapHistoryScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*UniswapHistoryScraper) ScrapePair ¶

func (s *UniswapHistoryScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type UniswapPair ¶

type UniswapPair struct {
	Token0      UniswapToken
	Token1      UniswapToken
	ForeignName string
	Address     common.Address
}

type UniswapPairScraper ¶

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

UniswapPairScraper implements PairScraper for Uniswap

func (*UniswapPairScraper) Close ¶

func (ps *UniswapPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*UniswapPairScraper) Error ¶

func (ps *UniswapPairScraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*UniswapPairScraper) Pair ¶

func (ps *UniswapPairScraper) Pair() dia.ExchangePair

Pair returns the pair this scraper is subscribed to

type UniswapPairV3Scraper ¶

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

UniswapPairScraper implements PairScraper for Uniswap

func (*UniswapPairV3Scraper) Close ¶

func (ps *UniswapPairV3Scraper) Close() error

Close stops listening for trades of the pair associated with s

func (*UniswapPairV3Scraper) Error ¶

func (ps *UniswapPairV3Scraper) Error() error

Error returns an error when the channel Channel() is closed and nil otherwise

func (*UniswapPairV3Scraper) Pair ¶

Pair returns the pair this scraper is subscribed to

type UniswapScraper ¶

type UniswapScraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

func NewUniswapScraper ¶

func NewUniswapScraper(exchange dia.Exchange, scrape bool) *UniswapScraper

NewUniswapScraper returns a new UniswapScraper for the given pair

func (*UniswapScraper) Channel ¶

func (ps *UniswapScraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*UniswapScraper) Close ¶

func (s *UniswapScraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*UniswapScraper) FetchAvailablePairs ¶

func (s *UniswapScraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs as dia.ExchangePair for the pairDiscorvery service

func (*UniswapScraper) FillSymbolData ¶

func (s *UniswapScraper) FillSymbolData(symbol string) (dia.Asset, error)

FillSymbolData is not used by DEX scrapers.

func (*UniswapScraper) GetAllPairs ¶

func (s *UniswapScraper) GetAllPairs() ([]UniswapPair, error)

GetAllPairs is similar to FetchAvailablePairs. But instead of dia.ExchangePairs it returns all pairs as UniswapPairs, i.e. including the pair's address

func (*UniswapScraper) GetDecimals ¶

func (s *UniswapScraper) GetDecimals(tokenAddress common.Address) (decimals uint8, err error)

GetDecimals returns the decimals of the token with address @tokenAddress

func (*UniswapScraper) GetName ¶

func (s *UniswapScraper) GetName(tokenAddress common.Address) (name string, err error)

func (*UniswapScraper) GetPairByAddress ¶

func (s *UniswapScraper) GetPairByAddress(pairAddress common.Address) (pair UniswapPair, err error)

GetPairByAddress returns the UniswapPair with pair address @pairAddress

func (*UniswapScraper) GetPairByID ¶

func (s *UniswapScraper) GetPairByID(num int64) (UniswapPair, error)

GetPairByID returns the UniswapPair with the integer id @num

func (*UniswapScraper) GetSwapsChannel ¶

func (s *UniswapScraper) GetSwapsChannel(pairAddress common.Address) (chan *uniswap.UniswapV2PairSwap, error)

GetSwapsChannel returns a channel for swaps of the pair with address @pairAddress

func (*UniswapScraper) ListenToPair ¶ added in v1.3.4

func (s *UniswapScraper) ListenToPair(i int, address common.Address)

ListenToPair subscribes to a uniswap pool. If @byAddress is true, it listens by pool address, otherwise by index.

func (*UniswapScraper) NormalizePair ¶

func (up *UniswapScraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*UniswapScraper) ScrapePair ¶

func (s *UniswapScraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type UniswapSwap ¶

type UniswapSwap struct {
	ID         string
	Timestamp  int64
	Pair       UniswapPair
	Amount0In  float64
	Amount0Out float64
	Amount1In  float64
	Amount1Out float64
}

type UniswapToken ¶

type UniswapToken struct {
	Address  common.Address
	Symbol   string
	Decimals uint8
	Name     string
}

type UniswapV3Scraper ¶

type UniswapV3Scraper struct {
	WsClient   *ethclient.Client
	RestClient *ethclient.Client
	// contains filtered or unexported fields
}

func NewUniswapV3Scraper ¶

func NewUniswapV3Scraper(exchange dia.Exchange, scrape bool) *UniswapV3Scraper

NewUniswapV3Scraper returns a new UniswapV3Scraper

func (*UniswapV3Scraper) Channel ¶

func (s *UniswapV3Scraper) Channel() chan *dia.Trade

Channel returns a channel that can be used to receive trades

func (*UniswapV3Scraper) Close ¶

func (s *UniswapV3Scraper) Close() error

Close closes any existing API connections, as well as channels of PairScrapers from calls to ScrapePair

func (*UniswapV3Scraper) FetchAvailablePairs ¶

func (s *UniswapV3Scraper) FetchAvailablePairs() (pairs []dia.ExchangePair, err error)

FetchAvailablePairs returns a list with all available trade pairs as dia.Pair for the pairDiscorvery service

func (*UniswapV3Scraper) FillSymbolData ¶

func (s *UniswapV3Scraper) FillSymbolData(symbol string) (dia.Asset, error)

func (*UniswapV3Scraper) GetDecimals ¶

func (s *UniswapV3Scraper) GetDecimals(tokenAddress common.Address) (decimals uint8, err error)

GetDecimals returns the decimals of the token with address @tokenAddress

func (*UniswapV3Scraper) GetPairByTokenAddress ¶

func (s *UniswapV3Scraper) GetPairByTokenAddress(address0 common.Address, address1 common.Address, pairAddress common.Address) (pair UniswapPair, err error)

func (*UniswapV3Scraper) GetPairData ¶

GetPairByID returns the UniswapPair with the integer id @num

func (*UniswapV3Scraper) GetSwapsChannel ¶

func (s *UniswapV3Scraper) GetSwapsChannel(pairAddress common.Address) (chan *UniswapV3Pair.UniswapV3PairSwap, error)

GetSwapsChannel returns a channel for swaps of the pair with address @pairAddress

func (*UniswapV3Scraper) NormalizePair ¶

func (s *UniswapV3Scraper) NormalizePair(pair dia.ExchangePair) (dia.ExchangePair, error)

func (*UniswapV3Scraper) ScrapePair ¶

func (s *UniswapV3Scraper) ScrapePair(pair dia.ExchangePair) (PairScraper, error)

ScrapePair returns a PairScraper that can be used to get trades for a single pair from this APIScraper

type UniswapV3Swap ¶

type UniswapV3Swap struct {
	ID        string
	Timestamp int64
	Pair      UniswapPair
	Amount0   float64
	Amount1   float64
}

type XMLCube ¶

type XMLCube struct {
	XMLName  xml.Name `xml:"Cube"`
	Currency string   `xml:"currency,attr"`
	Rate     string   `xml:"rate,attr"`
}

type XMLCubeTime ¶

type XMLCubeTime struct {
	XMLName xml.Name  `xml:"Cube"`
	Time    string    `xml:"time,attr"`
	Cube    []XMLCube `xml:"Cube"`
}

type XMLEnvelope ¶

type XMLEnvelope struct {
	XMLName  xml.Name      `xml:"Envelope"`
	CubeTime []XMLCubeTime `xml:"Cube>Cube"`
}

type XMLHistoricalEnvelope ¶

type XMLHistoricalEnvelope struct {
	XMLName xml.Name `xml:"GenericData"`
	Obs     []XMLObs `xml:"DataSet>Series>Obs"`
}

type XMLObs ¶

type XMLObs struct {
	XMLName   xml.Name        `xml:"Obs"`
	Timestamp XMLObsDimension `xml:"ObsDimension"`
	Price     XMLObsValue     `xml:"ObsValue"`
}

type XMLObsDimension ¶

type XMLObsDimension struct {
	XMLName xml.Name `xml:"ObsDimension"`
	Value   string   `xml:"value,attr"`
}

type XMLObsValue ¶

type XMLObsValue struct {
	XMLName xml.Name `xml:"ObsValue"`
	Value   string   `xml:"value,attr"`
}

Jump to

Keyboard shortcuts

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