scrapers

package
v0.0.0-...-3beb7e2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: GPL-2.0 Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BalancerApiDelay       = 20
	BalancerBatchDelay     = 60 * 1
	BalancerLookBackBlocks = 6 * 60 * 24 * 20
)
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) ([]byte, error)

func NewTrade

func NewTrade(pair dia.Pair, info krakenapi.TradeInfo, foreignTradeID string) *dia.Trade

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.Pair) (PairScraper, error)
	// FetchAvailablePairs returns a list with all available trade pairs
	FetchAvailablePairs() (pairs []dia.Pair, err error)
	NormalizePair(pair dia.Pair) (dia.Pair, 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, key string, secret string) APIScraper

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.Pair

type BalancerScraper

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

func NewBalancerScraper

func NewBalancerScraper(exchange dia.Exchange) *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.Pair, err error)

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

func (*BalancerScraper) NormalizePair

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

func (*BalancerScraper) ScrapePair

func (scraper *BalancerScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

func (*BancorScraper) GetConversion

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

func (*BancorScraper) GetPair

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

func (*BancorScraper) GetpoolAddress

func (scraper *BancorScraper) GetpoolAddress()

func (*BancorScraper) NormalizePair

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

func (*BancorScraper) ScrapePair

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

type BancorSwap

type BancorSwap struct {
	Pair       dia.Pair
	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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BinanceScraper) NormalizePair

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

func (*BinanceScraper) ScrapePair

func (s *BinanceScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BitBayScraper) NormalizePair

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

func (*BitBayScraper) ScrapePair

func (s *BitBayScraper) ScrapePair(pair dia.Pair) (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 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.Pair

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) *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.Pair, err error)

func (*BitMaxScraper) NormalizePair

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

func (*BitMaxScraper) ScrapePair

func (s *BitMaxScraper) ScrapePair(pair dia.Pair) (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

func (ps *BitfinexPairScraper) Pair() dia.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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BitfinexScraper) NormalizePair

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

func (*BitfinexScraper) ScrapePair

func (s *BitfinexScraper) ScrapePair(pair dia.Pair) (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 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.Pair

Pair returns the pair this scraper is subscribed to

type BittrexScraper

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

func NewBittrexScraper

func NewBittrexScraper(exchange dia.Exchange) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*BittrexScraper) NormalizePair

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

func (*BittrexScraper) ScrapePair

func (s *BittrexScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

func (*CREX24Scraper) NormalizePair

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

func (*CREX24Scraper) ScrapePair

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

type Channel

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

type CoinBasePairScraper

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

NewCoinBaseScraper 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

func (ps *CoinBasePairScraper) Pair() dia.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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*CoinBaseScraper) NormalizePair

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

func (*CoinBaseScraper) ScrapePair

func (s *CoinBaseScraper) ScrapePair(pair dia.Pair) (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
}

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.Pair

type CurveFIScraper

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

func NewCurveFIScraper

func NewCurveFIScraper(exchange dia.Exchange) *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.Pair, err error)

func (*CurveFIScraper) NormalizePair

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

func (*CurveFIScraper) ScrapePair

func (scraper *CurveFIScraper) ScrapePair(pair dia.Pair) (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.Pair

type DforceScraper

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

func NewDforceScraper

func NewDforceScraper(exchange dia.Exchange) *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.Pair, err error)

func (*DforceScraper) NormalizePair

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

func (*DforceScraper) ScrapePair

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

type DforceToken

type DforceToken struct {
	Symbol   string
	Decimals uint8
}

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.Pair

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) NormalizePair

func (s *ECBScraper) NormalizePair(pair dia.Pair) (dia.Pair, error)

func (*ECBScraper) ScrapePair

func (s *ECBScraper) ScrapePair(pair dia.Pair) (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

retrieve 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 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 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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*GateIOScraper) NormalizePair

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

func (*GateIOScraper) ScrapePair

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

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

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.Pair

type GnosisScraper

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

func NewGnosisScraper

func NewGnosisScraper(exchange dia.Exchange) *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.Pair, err error)

func (*GnosisScraper) NormalizePair

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

func (*GnosisScraper) ScrapePair

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

type GnosisToken

type GnosisToken struct {
	Symbol   string
	Decimals uint8
}

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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*HitBTCScraper) NormalizePair

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

func (*HitBTCScraper) ScrapePair

func (s *HitBTCScraper) ScrapePair(pair dia.Pair) (PairScraper, error)

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

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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*HuobiScraper) NormalizePair

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

func (*HuobiScraper) ScrapePair

func (s *HuobiScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*KrakenScraper) NormalizePair

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

NormalizePair accounts for the par

func (*KrakenScraper) ScrapePair

func (s *KrakenScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

func (*KuCoinScraper) NormalizePair

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

func (*KuCoinScraper) ScrapePair

func (s *KuCoinScraper) ScrapePair(pair dia.Pair) (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 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.Pair

type KyberScraper

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

func NewKyberScraper

func NewKyberScraper(exchange dia.Exchange) *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.Pair, err error)

func (*KyberScraper) NormalizePair

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

func (*KyberScraper) ScrapePair

func (scraper *KyberScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*LBankScraper) NormalizePair

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

func (*LBankScraper) ScrapePair

func (s *LBankScraper) ScrapePair(pair dia.Pair) (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

func (ps *LoopringPairScraper) Pair() dia.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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*LoopringScraper) NormalizePair

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

func (*LoopringScraper) Pong

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

Pong sends the string "pong" to the server.

func (*LoopringScraper) ScrapePair

func (s *LoopringScraper) ScrapePair(pair dia.Pair) (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.Pair

type MakerScraper

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

func NewMakerScraper

func NewMakerScraper(exchange dia.Exchange) *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.Pair, err error)

func (*MakerScraper) GetNewTrades

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

func (*MakerScraper) NormalizePair

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

func (*MakerScraper) ScrapePair

func (scraper *MakerScraper) ScrapePair(pair dia.Pair) (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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*OKExScraper) NormalizePair

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

func (*OKExScraper) ScrapePair

func (s *OKExScraper) ScrapePair(pair dia.Pair) (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.Pair
}

PairScraper receives trades for a single pc.Pair 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.Pair

type QuoineScraper

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

func NewQuoineScraper

func NewQuoineScraper(exchange dia.Exchange) *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.Pair, err error)

func (*QuoineScraper) NormalizePair

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

func (*QuoineScraper) ScrapePair

func (scraper *QuoineScraper) ScrapePair(pair dia.Pair) (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     int64       `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 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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

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.Pair) (dia.Pair, error)

func (*STEXScraper) ScrapePair

func (s *STEXScraper) ScrapePair(pair dia.Pair) (PairScraper, error)

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

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 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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*SimexScraper) NormalizePair

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

func (*SimexScraper) ScrapePair

func (s *SimexScraper) ScrapePair(pair dia.Pair) (PairScraper, error)

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

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 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.Pair

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

func (ps *UniswapPairV3Scraper) Pair() dia.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) *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.Pair, err error)

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

func (*UniswapScraper) GetAllPairs

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

GetAllPairs is similar to FetchAvailablePairs. But instead of dia.Pairs 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) 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 *uniswapcontract.UniswapV2PairSwap, error)

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

func (*UniswapScraper) NormalizePair

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

func (*UniswapScraper) ScrapePair

func (s *UniswapScraper) ScrapePair(pair dia.Pair) (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
}

type UniswapV3Scraper

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

func NewUniswapV3Scraper

func NewUniswapV3Scraper(exchange dia.Exchange) *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.Pair, err error)

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

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.Pair) (dia.Pair, error)

func (*UniswapV3Scraper) ScrapePair

func (s *UniswapV3Scraper) ScrapePair(pair dia.Pair) (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 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.Pair

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) *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.Pair, err error)

FetchAvailablePairs returns a list with all available trade pairs

func (*ZBScraper) NormalizePair

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

func (*ZBScraper) ScrapePair

func (s *ZBScraper) ScrapePair(pair dia.Pair) (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.Pair

type ZeroxScraper

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

func NewZeroxScraper

func NewZeroxScraper(exchange dia.Exchange) *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.Pair, err error)

func (*ZeroxScraper) NormalizePair

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

func (*ZeroxScraper) ScrapePair

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

type ZeroxToken

type ZeroxToken struct {
	Symbol   string
	Decimals uint8
}

Jump to

Keyboard shortcuts

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