scrapers

package
v1.1.1-rc-110 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: GPL-2.0 Imports: 73 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	BalancerApiDelay   = 20
	BalancerBatchDelay = 60 * 1
)
View Source
const (
	ChannelHeartbeat = "heartbeat"
	ChannelTicker    = "ticker"
	ChannelLevel2    = "level2"
	ChannelUser      = "user"
	ChannelMatches   = "matches"
	ChannelFull      = "full"
)
View Source
const (
	API_DELAY       = 1*time.Second + 500*time.Millisecond
	EXECUTION_LIMIT = 200
)
View Source
const (
	MakerBatchDelay = 60 * 1
)
View Source
const WS_TIMEOUT = 10 * time.Second

Variables ¶

View Source
var BitBaySocketURL string = "wss://api.bitbay.net/websocket/"
View Source
var Exchanges map[string]dia.Exchange
View Source
var LiquidSocketRestURL string = "http://api.liquid.com"
View Source
var LiquidSocketURL string = "wss://tap.liquid.com/app/LiquidTapClient"
View Source
var (
	UniswapV3FactoryContractAddress = "0x1F98431c8aD98523631AE4a59f267346ea31F984"
)
View Source
var ZBSocketURL string = "wss://api.zb.work/websocket"

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 GzipDecode ¶

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

func NewTrade ¶

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

func Populate ¶ added in v1.2.0

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 AllDeribitOptionsScrapers ¶

type AllDeribitOptionsScrapers struct {
	Scrapers []*DeribitOptionsScraper

	WsConnection *websocket.Conn

	RefreshTokenEvery int16
	// contains filtered or unexported fields
}

func NewAllDeribitOptionsScrapers ¶

func NewAllDeribitOptionsScrapers(owg *sync.WaitGroup, markets []string, accessKey string, accessSecret string) AllDeribitOptionsScrapers

func (*AllDeribitOptionsScrapers) AddMarket ¶

func (s *AllDeribitOptionsScrapers) AddMarket(market string)

func (*AllDeribitOptionsScrapers) Authenticate ¶

func (s *AllDeribitOptionsScrapers) Authenticate(websocketConnection interface{}) error

Authenticate - authenticates with your access key and access secret to retrieve the trade details

func (*AllDeribitOptionsScrapers) Close ¶

func (s *AllDeribitOptionsScrapers) Close()

func (*AllDeribitOptionsScrapers) GetAndStoreOptionsMeta ¶

func (s *AllDeribitOptionsScrapers) GetAndStoreOptionsMeta(market string) error

GetAndStoreOptionsMeta - will make a REST API call to obtain options meta, it then checks if we already have this data. If we do not, we save the new data.

func (*AllDeribitOptionsScrapers) GetMetas ¶

func (s *AllDeribitOptionsScrapers) GetMetas()

func (*AllDeribitOptionsScrapers) MetaOnOptionIsAvailable ¶

func (s *AllDeribitOptionsScrapers) MetaOnOptionIsAvailable(option deribitInstrument) (bool, error)

note, this function requires meta to be stored in a file

func (*AllDeribitOptionsScrapers) RefreshMetas ¶

func (s *AllDeribitOptionsScrapers) RefreshMetas(currency string) error

func (*AllDeribitOptionsScrapers) ScrapeMarkets ¶

func (s *AllDeribitOptionsScrapers) ScrapeMarkets()

ScrapeMarkets - scrapes all the options markets

type AllOKEXMarketResponse ¶

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

type BalancerPairScraper ¶

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

func (*BalancerPairScraper) Close ¶

func (pairScraper *BalancerPairScraper) Close() error

func (*BalancerPairScraper) Error ¶

func (pairScraper *BalancerPairScraper) Error() error

func (*BalancerPairScraper) Pair ¶

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

type BalancerScraper ¶

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

func NewBalancerScraper ¶

func NewBalancerScraper(exchange dia.Exchange, scrape bool) *BalancerScraper

func (*BalancerScraper) Channel ¶

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

func (*BalancerScraper) Close ¶

func (scraper *BalancerScraper) Close() error

func (*BalancerScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs get pairs by getting all the LOGNEWPOOL contract events, and calling the method getCurrentTokens from each pool contract

func (*BalancerScraper) FillSymbolData ¶ added in v1.2.0

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

func (*BalancerScraper) NormalizePair ¶

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

func (*BalancerScraper) ScrapePair ¶

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

type BalancerSwap ¶

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

type BalancerToken ¶

type BalancerToken struct {
	Symbol   string
	Decimals uint8
}

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 ¶ added in v1.2.0

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, 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 ¶ added in v1.2.0

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 BitBayMarket ¶

type BitBayMarket struct {
	Code  string `json:"code"`
	First struct {
		Currency string `json:"currency"`
		MinOffer string `json:"minOffer"`
		Scale    int    `json:"scale"`
	} `json:"first"`
	Second struct {
		Currency string `json:"currency"`
		MinOffer string `json:"minOffer"`
		Scale    int    `json:"scale"`
	} `json:"second"`
}

type BitBayMarkets ¶

type BitBayMarkets struct {
	Status string                  `json:"status"`
	Items  map[string]BitBayMarket `json:"items"`
}

type BitBayPairScraper ¶

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

BitBayPairScraper implements PairScraper for BitBay

func (*BitBayPairScraper) Close ¶

func (ps *BitBayPairScraper) Close() error

Close stops listening for trades of the pair associated

func (*BitBayPairScraper) Error ¶

func (ps *BitBayPairScraper) Error() error

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

func (*BitBayPairScraper) Pair ¶

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

Pair returns the pair this scraper is subscribed to

type BitBayScraper ¶

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

BitBayScraper provides methods needed to get Trade information from BitBay

func NewBitBayScraper ¶

func NewBitBayScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *BitBayScraper

NewBitBayScraper get a scrapper for BitBay exchange

func (*BitBayScraper) Channel ¶

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

Channel returns the channel to get trades

func (*BitBayScraper) Close ¶

func (s *BitBayScraper) Close() error

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

func (*BitBayScraper) Error ¶

func (s *BitBayScraper) Error() error

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

func (*BitBayScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*BitBayScraper) FillSymbolData ¶ added in v1.2.0

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

func (*BitBayScraper) NormalizePair ¶

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

func (*BitBayScraper) ScrapePair ¶

func (s *BitBayScraper) 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 BitBaySubscribe ¶

type BitBaySubscribe struct {
	Action string `json:"action"`
	Module string `json:"module"`
	Path   string `json:"path"`
}

type BitBayTrade ¶

type BitBayTrade struct {
	Date            int64   `json:"date"`
	Price           float64 `json:"price"`
	TransactionType string  `json:"type"`
	Amount          float64 `json:"amount"`
	Tid             string  `json:"tid"`
}

TradeInfo as received from API response

type BitBayTransaction ¶

type BitBayTransaction struct {
	A  string `json:"a"`
	ID string `json:"id"`
	R  string `json:"r"`
	T  string `json:"t"`
	Ty string `json:"ty"`
}

type BitBayWSResponse ¶

type BitBayWSResponse struct {
	Action    string  `json:"action"`
	Message   Message `json:"message"`
	SeqNo     int     `json:"seqNo"`
	Timestamp string  `json:"timestamp"`
	Topic     string  `json:"topic"`
}

type BitMaxAsset ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 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 ¶ added in v1.2.0

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 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 BittrexAsset ¶ added in v1.2.0

type BittrexAsset struct {
	Symbol                   string        `json:"symbol"`
	Name                     string        `json:"name"`
	CoinType                 string        `json:"coinType"`
	Status                   string        `json:"status"`
	MinConfirmations         int           `json:"minConfirmations"`
	Notice                   string        `json:"notice"`
	TxFee                    string        `json:"txFee"`
	LogoURL                  string        `json:"logoUrl"`
	ProhibitedIn             []interface{} `json:"prohibitedIn"`
	BaseAddress              string        `json:"baseAddress"`
	AssociatedTermsOfService []interface{} `json:"associatedTermsOfService"`
	Tags                     []interface{} `json:"tags"`
}

type BittrexPairScraper ¶

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

BittrexPairScraper implements PairScraper for Bittrex

func (*BittrexPairScraper) Close ¶

func (ps *BittrexPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*BittrexPairScraper) Error ¶

func (ps *BittrexPairScraper) Error() error

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

func (*BittrexPairScraper) Pair ¶

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

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 (ps *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 ¶ added in v1.2.0

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

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 this APIScraper

type CREX24ApiInstrument ¶

type CREX24ApiInstrument struct {
	Symbol       string `json:"symbol"`
	BaseCurrency string `json:"baseCurrency"`
}

type CREX24ApiTrade ¶

type CREX24ApiTrade struct {
	Price     string `json:"P"`
	Volume    string `json:"V"`
	Side      string `json:"S"`
	Timestamp int64  `json:"T"`
}

type CREX24ApiTradeUpdate ¶

type CREX24ApiTradeUpdate struct {
	I  string
	NT []CREX24ApiTrade
}

type CREX24PairScraper ¶

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

func (*CREX24PairScraper) Close ¶

func (ps *CREX24PairScraper) Close() error

func (*CREX24PairScraper) Error ¶

func (ps *CREX24PairScraper) Error() error

func (*CREX24PairScraper) Pair ¶

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

type CREX24Scraper ¶

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

CREX24 Scraper is a scraper for collecting trades from the CREX24 signalR api

func NewCREX24Scraper ¶

func NewCREX24Scraper(exchange dia.Exchange, relDB *models.RelDB) *CREX24Scraper

func (*CREX24Scraper) Channel ¶

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

func (*CREX24Scraper) Close ¶

func (s *CREX24Scraper) Close() error

func (*CREX24Scraper) FetchAvailablePairs ¶

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

func (*CREX24Scraper) FillSymbolData ¶ added in v1.2.0

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

FillSymbolData collects all available information on an asset traded on CREX24

func (*CREX24Scraper) NormalizePair ¶

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

func (*CREX24Scraper) ScrapePair ¶

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

type CREX4Asset ¶ added in v1.2.0

type CREX4Asset []struct {
	Symbol                   string      `json:"symbol"`
	Name                     string      `json:"name"`
	IsFiat                   bool        `json:"isFiat"`
	DepositsAllowed          bool        `json:"depositsAllowed"`
	DepositConfirmationCount int         `json:"depositConfirmationCount"`
	MinDeposit               float64     `json:"minDeposit"`
	WithdrawalsAllowed       bool        `json:"withdrawalsAllowed"`
	WithdrawalPrecision      int         `json:"withdrawalPrecision"`
	MinWithdrawal            float64     `json:"minWithdrawal"`
	MaxWithdrawal            float64     `json:"maxWithdrawal"`
	IsDelisted               bool        `json:"isDelisted"`
	Transports               interface{} `json:"transports"`
}

type Channel ¶

type Channel struct {
	Channel string `json:"channel"`
}

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 ¶ added in v1.2.0

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 Confirm ¶

type Confirm struct {
	Data interface{} `json:"data"`
}

type ConfirmData ¶

type ConfirmData struct {
	Result  []interface{} `json:"result"`
	Success bool          `json:"success"`
	Message string        `json:"message"`
}

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
}

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 ¶ added in v1.2.0

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 DeribitOptionsScraper ¶

type DeribitOptionsScraper struct {
	ScraperIsRunning   bool
	ScraperIsRunningMu *sync.Mutex
	// contains filtered or unexported fields
}

DeribitOptionsScraper - used to maintain the order book and save it every x seconds

func NewDeribitOptionsScraper ¶

func NewDeribitOptionsScraper(ds *models.DB, owg *sync.WaitGroup, market string, accessKey string, accessSecret string, ws *websocket.Conn) DeribitOptionsScraper

NewDeribitOptionsScraper - returns an instance of an options scraper.

func (*DeribitOptionsScraper) Scrape ¶

func (s *DeribitOptionsScraper) Scrape(market string)

Scrape - scrapes the options markets (meta + order book data)

func (*DeribitOptionsScraper) ScraperClose ¶

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

ScraperClose - responsible for closing out the scraper for a market

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 DforcePairScraper ¶

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

func (*DforcePairScraper) Close ¶

func (pairScraper *DforcePairScraper) Close() error

func (*DforcePairScraper) Error ¶

func (pairScraper *DforcePairScraper) Error() error

func (*DforcePairScraper) Pair ¶

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

type DforceScraper ¶

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

func NewDforceScraper ¶

func NewDforceScraper(exchange dia.Exchange, scrape bool) *DforceScraper

func (*DforceScraper) Channel ¶

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

func (*DforceScraper) Close ¶

func (scraper *DforceScraper) Close() error

func (*DforceScraper) FetchAvailablePairs ¶

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

func (*DforceScraper) FillSymbolData ¶ added in v1.2.0

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

func (*DforceScraper) NormalizePair ¶

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

func (*DforceScraper) ScrapePair ¶

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

type DforceToken ¶

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

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 Event ¶

type Event struct {
	Method string      `json:"method"`
	Params interface{} `json:"params"`
	Id     int         `json:"id"`
}

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 ¶ added in v1.2.0

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

ECBPairScraper implements PairScraper for ECB

func (*FinageForexPairScraper) Close ¶ added in v1.2.0

func (ps *FinageForexPairScraper) Close() error

func (*FinageForexPairScraper) Error ¶ added in v1.2.0

func (ps *FinageForexPairScraper) Error() error

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

func (*FinageForexPairScraper) Pair ¶ added in v1.2.0

Pair returns the pair this scraper is subscribed to

type FinageForexScraper ¶ added in v1.2.0

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

func NewFinageForexScraper ¶ added in v1.2.0

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 ¶ added in v1.2.0

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

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

func (*FinageForexScraper) Close ¶ added in v1.2.0

func (s *FinageForexScraper) Close() error

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

func (*FinageForexScraper) FetchAvailablePairs ¶ added in v1.2.0

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

func (*FinageForexScraper) FillSymbolData ¶ added in v1.2.0

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

func (*FinageForexScraper) NormalizePair ¶ added in v1.2.0

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

func (*FinageForexScraper) ScrapePair ¶ added in v1.2.0

func (s *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 ¶ added in v1.2.0

func (s *FinageForexScraper) Update() error

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

type FinageSymbolResponse ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 NewDeribitFuturesScraper ¶

func NewDeribitFuturesScraper(markets []string, accessKey string, accessSecret string) FuturesScraper

NewDeribitFuturesScraper - creates a deribit futures scraper for you for the markets that you supply. Some of the markets available are: "BTC-PERPETUAL" and "ETH-PERPETUAL".

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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

type GateIPPairResponse ¶

type GateIPPairResponse []GateIOPair

type GnosisPairScraper ¶

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

func (*GnosisPairScraper) Close ¶

func (pairScraper *GnosisPairScraper) Close() error

func (*GnosisPairScraper) Error ¶

func (pairScraper *GnosisPairScraper) Error() error

func (*GnosisPairScraper) Pair ¶

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

type GnosisScraper ¶

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

func NewGnosisScraper ¶

func NewGnosisScraper(exchange dia.Exchange, scrape bool) *GnosisScraper

func (*GnosisScraper) Channel ¶

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

func (*GnosisScraper) Close ¶

func (scraper *GnosisScraper) Close() error

func (*GnosisScraper) FetchAvailablePairs ¶

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

func (*GnosisScraper) FillSymbolData ¶ added in v1.2.0

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

FillSymbolData is not used by DEX scrapers.

func (*GnosisScraper) NormalizePair ¶

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

func (*GnosisScraper) ScrapePair ¶

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

type GnosisToken ¶

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

type HitBTCAsset ¶ added in v1.2.0

type HitBTCAsset struct {
	ID                 string `json:"id"`
	FullName           string `json:"fullName"`
	Crypto             bool   `json:"crypto"`
	PayinEnabled       bool   `json:"payinEnabled"`
	PayinPaymentID     bool   `json:"payinPaymentId"`
	PayinConfirmations int    `json:"payinConfirmations"`
	PayoutEnabled      bool   `json:"payoutEnabled"`
	PayoutIsPaymentID  bool   `json:"payoutIsPaymentId"`
	TransferEnabled    bool   `json:"transferEnabled"`
	Delisted           bool   `json:"delisted"`
	PayoutFee          string `json:"payoutFee"`
	PrecisionPayout    int    `json:"precisionPayout"`
	PrecisionTransfer  int    `json:"precisionTransfer"`
}

type HitBTCPairScraper ¶

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

HitBTCPairScraper implements PairScraper for HitBTC

func (*HitBTCPairScraper) Close ¶

func (ps *HitBTCPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*HitBTCPairScraper) Error ¶

func (ps *HitBTCPairScraper) Error() error

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

func (*HitBTCPairScraper) Pair ¶

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

Pair returns the pair this scraper is subscribed to

type HitBTCScraper ¶

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

func NewHitBTCScraper ¶

func NewHitBTCScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *HitBTCScraper

NewHitBTCScraper returns a new HitBTCScraper for the given pair

func (*HitBTCScraper) Channel ¶

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

Channel returns a channel that can be used to receive trades

func (*HitBTCScraper) Close ¶

func (s *HitBTCScraper) Close() error

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

func (*HitBTCScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*HitBTCScraper) FillSymbolData ¶ added in v1.2.0

func (ps *HitBTCScraper) FillSymbolData(symbol string) (asset dia.Asset, err error)

FillSymbolData collects all available information on an asset traded on HitBTC

func (*HitBTCScraper) NormalizePair ¶

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

func (*HitBTCScraper) ScrapePair ¶

func (s *HitBTCScraper) 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 HuobiCurrency ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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

GateIOPairScraper implements PairScraper for GateIO

func (*InfluxPairScraper) Close ¶ added in v1.2.0

func (ps *InfluxPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*InfluxPairScraper) Error ¶ added in v1.2.0

func (ps *InfluxPairScraper) Error() error

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

func (*InfluxPairScraper) Pair ¶ added in v1.2.0

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

Pair returns the pair this scraper is subscribed to

type InfluxScraper ¶ added in v1.2.0

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

func NewInfluxScraper ¶ added in v1.2.0

func NewInfluxScraper(scrape bool) *InfluxScraper

NewGateIOScraper returns a new GateIOScraper for the given pair

func (*InfluxScraper) Channel ¶ added in v1.2.0

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

func (*InfluxScraper) Close ¶ added in v1.2.0

func (s *InfluxScraper) Close() error

func (*InfluxScraper) FetchAvailablePairs ¶ added in v1.2.0

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

FetchAvailablePairs returns a list with all available trade pairs

func (*InfluxScraper) FillSymbolData ¶ added in v1.2.0

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 ¶ added in v1.2.0

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

func (*InfluxScraper) ScrapePair ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 KyberPairScraper ¶

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

func (*KyberPairScraper) Close ¶

func (pairScraper *KyberPairScraper) Close() error

func (*KyberPairScraper) Error ¶

func (pairScraper *KyberPairScraper) Error() error

func (*KyberPairScraper) Pair ¶

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

type KyberScraper ¶

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

func NewKyberScraper ¶

func NewKyberScraper(exchange dia.Exchange, scrape bool) *KyberScraper

func (*KyberScraper) Channel ¶

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

func (*KyberScraper) Close ¶

func (scraper *KyberScraper) Close() error

func (*KyberScraper) FetchAvailablePairs ¶

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

func (*KyberScraper) FillSymbolData ¶ added in v1.2.0

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

func (*KyberScraper) NormalizePair ¶

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

func (*KyberScraper) ScrapePair ¶

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

type KyberToken ¶

type KyberToken struct {
	Symbol   string
	Decimals *big.Int
}

type LBankPairScraper ¶

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

LBankPairScraper implements PairScraper for LBank exchange

func (*LBankPairScraper) Close ¶

func (ps *LBankPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*LBankPairScraper) Error ¶

func (ps *LBankPairScraper) Error() error

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

func (*LBankPairScraper) Pair ¶

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

Pair returns the pair this scraper is subscribed to

type LBankScraper ¶

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

func NewLBankScraper ¶

func NewLBankScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *LBankScraper

NewLBankScraper returns a new LBankScraper for the given pair

func (*LBankScraper) Channel ¶

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

Channel returns a channel that can be used to receive trades

func (*LBankScraper) Close ¶

func (s *LBankScraper) Close() error

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

func (*LBankScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*LBankScraper) FillSymbolData ¶ added in v1.2.0

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

func (*LBankScraper) NormalizePair ¶

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

func (*LBankScraper) ScrapePair ¶

func (s *LBankScraper) 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 LiquidChannel ¶

type LiquidChannel struct {
	Channel string `json:"channel"`
}

type LiquidProduct ¶

type LiquidProduct struct {
	ID                      string      `json:"id"`
	ProductType             string      `json:"product_type"`
	Code                    string      `json:"code"`
	Name                    interface{} `json:"name"`
	MarketAsk               float64     `json:"market_ask"`
	MarketBid               float64     `json:"market_bid"`
	Indicator               interface{} `json:"indicator"`
	Currency                string      `json:"currency"`
	CurrencyPairCode        string      `json:"currency_pair_code"`
	Symbol                  interface{} `json:"symbol"`
	BtcMinimumWithdraw      interface{} `json:"btc_minimum_withdraw"`
	FiatMinimumWithdraw     interface{} `json:"fiat_minimum_withdraw"`
	PusherChannel           string      `json:"pusher_channel"`
	TakerFee                string      `json:"taker_fee"`
	MakerFee                string      `json:"maker_fee"`
	LowMarketBid            string      `json:"low_market_bid"`
	HighMarketAsk           string      `json:"high_market_ask"`
	Volume24H               string      `json:"volume_24h"`
	LastPrice24H            string      `json:"last_price_24h"`
	LastTradedPrice         string      `json:"last_traded_price"`
	LastTradedQuantity      string      `json:"last_traded_quantity"`
	AveragePrice            string      `json:"average_price"`
	QuotedCurrency          string      `json:"quoted_currency"`
	BaseCurrency            string      `json:"base_currency"`
	TickSize                string      `json:"tick_size"`
	Disabled                bool        `json:"disabled"`
	MarginEnabled           bool        `json:"margin_enabled"`
	CfdEnabled              bool        `json:"cfd_enabled"`
	PerpetualEnabled        bool        `json:"perpetual_enabled"`
	LastEventTimestamp      string      `json:"last_event_timestamp"`
	Timestamp               string      `json:"timestamp"`
	MultiplierUp            string      `json:"multiplier_up"`
	MultiplierDown          string      `json:"multiplier_down"`
	AverageTimeInterval     int         `json:"average_time_interval"`
	ProgressiveTierEligible bool        `json:"progressive_tier_eligible"`
}

type LiquidProducts ¶

type LiquidProducts []LiquidProduct

type LiquidResponse ¶

type LiquidResponse struct {
	Channel string `json:"channel,omitempty"`
	Data    string `json:"data,omitempty"`
	Event   string `json:"event,omitempty"`
}

type LiquidResponseTrade ¶

type LiquidResponseTrade struct {
	CreatedAt int     `json:"created_at"`
	ID        int     `json:"id"`
	Price     float64 `json:"price"`
	Quantity  float64 `json:"quantity"`
	TakerSide string  `json:"taker_side"`
	Timestamp string  `json:"timestamp"`
}

type LiquidSubscribe ¶

type LiquidSubscribe struct {
	Event string        `json:"event"`
	Data  LiquidChannel `json:"data"`
}

type LoopringKey ¶

type LoopringKey struct {
	Key string `json:"key"`
}

type LoopringMarket ¶

type LoopringMarket struct {
	Data []struct {
		Market             string `json:"market"`
		BaseTokenID        int    `json:"baseTokenId"`
		QuoteTokenID       int    `json:"quoteTokenId"`
		PrecisionForPrice  int    `json:"precisionForPrice"`
		OrderbookAggLevels int    `json:"orderbookAggLevels"`
		Enabled            bool   `json:"enabled"`
	} `json:"markets"`
}

type LoopringPairScraper ¶

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

LoopringPairScraper implements PairScraper for Loopring exchange

func (*LoopringPairScraper) Close ¶

func (ps *LoopringPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*LoopringPairScraper) Error ¶

func (ps *LoopringPairScraper) Error() error

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

func (*LoopringPairScraper) Pair ¶

Pair returns the pair this scraper is subscribed to

type LoopringScraper ¶

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

func NewLoopringScraper ¶

func NewLoopringScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *LoopringScraper

NewLoopringScraper returns a new LoopringScraper for the given pair

func (*LoopringScraper) Channel ¶

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

Channel returns a channel that can be used to receive trades

func (*LoopringScraper) Close ¶

func (s *LoopringScraper) Close() error

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

func (*LoopringScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*LoopringScraper) FillSymbolData ¶ added in v1.2.0

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

func (*LoopringScraper) NormalizePair ¶

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

func (*LoopringScraper) Pong ¶ added in v1.2.0

func (s *LoopringScraper) Pong(messageType int) error

Pong sends the string "pong" to the server.

func (*LoopringScraper) ScrapePair ¶

func (s *LoopringScraper) 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 LoopringTopic ¶

type LoopringTopic struct {
	Topic    string `json:"topic"`
	Market   string `json:"market"`
	Count    int64  `json:"count"`
	Snapshot bool   `json:"snapshot"`
}

type MakerPair ¶

type MakerPair struct {
	Base           string `json:"base"`
	Quote          string `json:"quote"`
	BasePrecision  int    `json:"basePrecision"`
	QuotePrecision int    `json:"quotePrecision"`
	Active         bool   `json:"active"`
}

type MakerPairResponse ¶

type MakerPairResponse struct {
	Data    map[string]MakerPair `json:"data"`
	Time    time.Time            `json:"time"`
	Message string               `json:"message"`
}

type MakerPairScraper ¶

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

func (*MakerPairScraper) Close ¶

func (pairScraper *MakerPairScraper) Close() error

func (*MakerPairScraper) Error ¶

func (pairScraper *MakerPairScraper) Error() error

func (*MakerPairScraper) Pair ¶

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

type MakerScraper ¶

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

func NewMakerScraper ¶

func NewMakerScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *MakerScraper

func (*MakerScraper) Channel ¶

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

func (*MakerScraper) Close ¶

func (scraper *MakerScraper) Close() error

func (*MakerScraper) FetchAvailablePairs ¶

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

func (*MakerScraper) FillSymbolData ¶ added in v1.2.0

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

FillSymbolData is not used by DEX scrapers.

func (*MakerScraper) GetNewTrades ¶

func (scraper *MakerScraper) GetNewTrades(pair string, startTradeID string) ([]MakerTrade, error)

func (*MakerScraper) NormalizePair ¶

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

func (*MakerScraper) ScrapePair ¶

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

type MakerTrade ¶

type MakerTrade struct {
	ID     int       `json:"id"`
	Price  string    `json:"price"`
	Volume string    `json:"volume"`
	Time   time.Time `json:"time"`
}

type MakerTradeResponse ¶

type MakerTradeResponse struct {
	MakerTrades []MakerTrade `json:"data"`
	Time        time.Time    `json:"time"`
	Message     string       `json:"message"`
}

type Message ¶

type Message struct {
	Transactions []BitBayTransaction `json:"transactions"`
}

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 ¶ added in v1.2.0

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 PairIdMap ¶

type PairIdMap struct {
	Id          float64
	LastIdTrade int
	Symbol      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 Pools ¶

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

type QuoinePairScraper ¶

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

func (*QuoinePairScraper) Close ¶

func (pairScraper *QuoinePairScraper) Close() error

func (*QuoinePairScraper) Error ¶

func (pairScraper *QuoinePairScraper) Error() error

func (*QuoinePairScraper) Pair ¶

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

type QuoineScraper ¶

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

func NewQuoineScraper ¶

func NewQuoineScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *QuoineScraper

func (*QuoineScraper) Channel ¶

func (pairScraper *QuoineScraper) Channel() chan *dia.Trade

func (*QuoineScraper) Close ¶

func (scraper *QuoineScraper) Close() error

func (*QuoineScraper) FetchAvailablePairs ¶

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

func (*QuoineScraper) FillSymbolData ¶ added in v1.2.0

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

func (*QuoineScraper) NormalizePair ¶

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

func (*QuoineScraper) ScrapePair ¶

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

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 ResponseLBank ¶

type ResponseLBank struct {
	Pair   string      `json:"pair"`
	Trade  interface{} `json:"trade"`
	Type   string      `json:"type"`
	Server string      `json:"SERVER"`
	Ts     string      `json:"TS"`
}

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 STEXAsset ¶ added in v1.2.0

type STEXAsset struct {
	ID        int    `json:"id"`
	Code      string `json:"code"`
	Name      string `json:"name"`
	Active    bool   `json:"active"`
	Delisted  bool   `json:"delisted"`
	Precision int    `json:"precision"`
}

type STEXPairScraper ¶

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

STEXPairScraper implements PairScraper for STEX

func (*STEXPairScraper) Close ¶

func (ps *STEXPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*STEXPairScraper) Error ¶

func (ps *STEXPairScraper) Error() error

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

func (*STEXPairScraper) Pair ¶

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

Pair returns the pair this scraper is subscribed to

type STEXScraper ¶

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

func NewSTEXScraper ¶

func NewSTEXScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *STEXScraper

NewSTEXScraper returns a new STEXScraper for the given pair

func (*STEXScraper) Channel ¶

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

Channel returns a channel that can be used to receive trades

func (*STEXScraper) Close ¶

func (s *STEXScraper) Close() error

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

func (*STEXScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*STEXScraper) FillSymbolData ¶ added in v1.2.0

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

FillSymbolData collects all available information on an asset traded on STEX

func (*STEXScraper) GetNewTrades ¶

func (s *STEXScraper) GetNewTrades(pairID string, fromTimestamp time.Time) ([]STEXTrade, error)

GetNewTrades fetches new trades from the STEX restAPI dating back until @fromTimestamp

func (*STEXScraper) NormalizePair ¶

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

func (*STEXScraper) ScrapePair ¶

func (s *STEXScraper) 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 STEXTickerData ¶ added in v1.2.0

type STEXTickerData struct {
	Success bool        `json:"success"`
	Data    []STEXAsset `json:"data"`
}

type STEXTrade ¶

type STEXTrade struct {
	ID        int        `json:"id"`
	Price     *big.Float `json:"price"`
	Amount    *big.Float `json:"amount"`
	Type      string     `json:"type"`
	TimeStamp string     `json:"timestamp"`
}

type SimexAsset ¶ added in v1.2.0

type SimexAsset struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type SimexPairScraper ¶

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

SimexPairScraper implements PairScraper for Simex

func (*SimexPairScraper) Close ¶

func (ps *SimexPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*SimexPairScraper) Error ¶

func (ps *SimexPairScraper) Error() error

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

func (*SimexPairScraper) Pair ¶

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

Pair returns the pair this scraper is subscribed to

type SimexScraper ¶

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

func NewSimexScraper ¶

func NewSimexScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *SimexScraper

func (*SimexScraper) Channel ¶

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

Channel returns a channel that can be used to receive trades

func (*SimexScraper) Close ¶

func (s *SimexScraper) Close() error

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

func (*SimexScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*SimexScraper) FillSymbolData ¶ added in v1.2.0

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

func (*SimexScraper) NormalizePair ¶

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

func (*SimexScraper) ScrapePair ¶

func (s *SimexScraper) 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 SimexTicker ¶ added in v1.2.0

type SimexTicker struct {
	Data []SimexAsset `json:"data"`
}

type StexTradeResponse ¶

type StexTradeResponse struct {
	SETXTrades []STEXTrade `json:"data"`
	Success    bool        `json:"success"`
}

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 SubscribeLBank ¶

type SubscribeLBank struct {
	Action    string `json:"action"`
	Subscribe string `json:"subscribe"`
	Pair      string `json:"pair"`
}

type Topic ¶

type Topic struct {
	Topic    string `json:"topic"`
	Market   string `json:"market"`
	Count    int64  `json:"count"`
	Snapshot bool   `json:"snapshot"`
}

type Trade ¶

type Trade struct {
	Amount         string      `json:"amount"`
	Amount2        float64     `json:"amount2"`
	BuyOrderID     int64       `json:"buy_order_id"`
	CurrencyPairID int64       `json:"currency_pair_id"`
	Date           string      `json:"date"`
	ID             int64       `json:"id"`
	OrderType      string      `json:"order_type"`
	Price          string      `json:"price"`
	SellOrderID    int64       `json:"sell_order_id"`
	Socket         interface{} `json:"socket"`
	Timestamp      int64       `json:"timestamp"`
}

type UniswapHistoryPairScraper ¶ added in v1.2.0

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

UniswapPairScraper implements PairScraper for Uniswap

func (*UniswapHistoryPairScraper) Close ¶ added in v1.2.0

func (ps *UniswapHistoryPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*UniswapHistoryPairScraper) Error ¶ added in v1.2.0

func (ps *UniswapHistoryPairScraper) Error() error

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

func (*UniswapHistoryPairScraper) Pair ¶ added in v1.2.0

Pair returns the pair this scraper is subscribed to

type UniswapHistoryScraper ¶ added in v1.2.0

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

func NewUniswapHistoryScraper ¶ added in v1.2.0

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

NewUniswapScraper returns a new UniswapScraper for the given pair

func (*UniswapHistoryScraper) Channel ¶ added in v1.2.0

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

Channel returns a channel that can be used to receive trades

func (*UniswapHistoryScraper) Close ¶ added in v1.2.0

func (s *UniswapHistoryScraper) Close() error

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

func (*UniswapHistoryScraper) FetchAvailablePairs ¶ added in v1.2.0

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 ¶ added in v1.2.0

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

FillSymbolData is not used by DEX scrapers.

func (*UniswapHistoryScraper) GetAllPairs ¶ added in v1.2.0

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 ¶ added in v1.2.0

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

GetDecimals returns the decimals of the token with address @tokenAddress

func (*UniswapHistoryScraper) GetName ¶ added in v1.2.0

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

func (*UniswapHistoryScraper) GetPairByAddress ¶ added in v1.2.0

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

GetPairByAddress returns the UniswapPair with pair address @pairAddress

func (*UniswapHistoryScraper) GetPairByID ¶ added in v1.2.0

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

GetPairByID returns the UniswapPair with the integer id @num

func (*UniswapHistoryScraper) NormalizePair ¶ added in v1.2.0

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

func (*UniswapHistoryScraper) ScrapePair ¶ added in v1.2.0

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 ¶ added in v1.2.0

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 ¶ added in v1.2.0

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) ListenToPairByIndex ¶ added in v1.2.0

func (s *UniswapScraper) ListenToPairByIndex(i int)

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 ¶ added in v1.2.0

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) GetPairByAddress ¶

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

GetPairByAddress returns the UniswapPair with pair address @pairAddress

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 WebSocketRequest ¶

type WebSocketRequest struct {
	Op       string          `json:"op"`
	Sequence int             `json:"sequence"`
	Topics   []LoopringTopic `json:"topics"`
	Result   struct {
		Status string `json:"status"`
	} `json:"result"`
}

type WebSocketResponse ¶

type WebSocketResponse struct {
	Topic struct {
		Topic  string `json:"topic"`
		Market string `json:"market"`
	} `json:"topic"`
	Ts   int64      `json:"ts"`
	Data [][]string `json:"data"`
}

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 ¶ added in v1.2.0

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

type XMLObs ¶ added in v1.2.0

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

type XMLObsDimension ¶ added in v1.2.0

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

type XMLObsValue ¶ added in v1.2.0

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

type ZBPairScraper ¶

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

ZBPairScraper implements PairScraper for ZB

func (*ZBPairScraper) Close ¶

func (ps *ZBPairScraper) Close() error

Close stops listening for trades of the pair associated with s

func (*ZBPairScraper) Error ¶

func (ps *ZBPairScraper) Error() error

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

func (*ZBPairScraper) Pair ¶

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

Pair returns the pair this scraper is subscribed to

type ZBScraper ¶

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

func NewZBScraper ¶

func NewZBScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *ZBScraper

NewZBScraper returns a new ZBScraper for the given pair

func (*ZBScraper) Channel ¶

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

Channel returns a channel that can be used to receive trades

func (*ZBScraper) Close ¶

func (s *ZBScraper) Close() error

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

func (*ZBScraper) FetchAvailablePairs ¶

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

FetchAvailablePairs returns a list with all available trade pairs

func (*ZBScraper) FillSymbolData ¶ added in v1.2.0

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

FillSymbolData is not used by DEX scrapers.

func (*ZBScraper) NormalizePair ¶

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

func (*ZBScraper) ScrapePair ¶

func (s *ZBScraper) 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 ZBSubscribe ¶

type ZBSubscribe struct {
	Event   string `json:"event"`
	Channel string `json:"channel"`
}

type ZBTradeResponse ¶

type ZBTradeResponse struct {
	DataType string `json:"dataType"`
	Data     []struct {
		Amount    string `json:"amount"`
		Price     string `json:"price"`
		Tid       int    `json:"tid"`
		Date      int    `json:"date"`
		Type      string `json:"type"`
		TradeType string `json:"trade_type"`
	} `json:"data"`
	Channel string `json:"channel"`
}

type ZeroxPairScraper ¶

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

func (*ZeroxPairScraper) Close ¶

func (pairScraper *ZeroxPairScraper) Close() error

func (*ZeroxPairScraper) Error ¶

func (pairScraper *ZeroxPairScraper) Error() error

func (*ZeroxPairScraper) Pair ¶

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

type ZeroxScraper ¶

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

func NewZeroxScraper ¶

func NewZeroxScraper(exchange dia.Exchange, scrape bool) *ZeroxScraper

func (*ZeroxScraper) Channel ¶

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

func (*ZeroxScraper) Close ¶

func (scraper *ZeroxScraper) Close() error

func (*ZeroxScraper) FetchAvailablePairs ¶

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

func (*ZeroxScraper) FetchTickerData ¶ added in v1.2.0

func (scraper *ZeroxScraper) FetchTickerData(symbol string) (dia.Asset, error)

func (*ZeroxScraper) FillSymbolData ¶ added in v1.2.0

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

FillSymbolData is not used by DEX scrapers.

func (*ZeroxScraper) NormalizePair ¶

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

func (*ZeroxScraper) ScrapePair ¶

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

type ZeroxToken ¶

type ZeroxToken struct {
	Symbol     string
	Name       string
	Address    string
	Blockchain dia.BlockChain
	Decimals   uint8
}

Jump to

Keyboard shortcuts

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