fetcher

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain interface {
	FetchBalanceData(addr ethereum.Address, timepoint uint64) (map[string]common.BalanceEntry, error)
	FetchRates(sources, dests []common.Token, timepoint uint64) (common.AllRateEntry, error)
	IsMined(tx ethereum.Hash) (bool, error)
}

type ConcurrentAllPriceData

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

func NewConcurrentAllPriceData

func NewConcurrentAllPriceData() *ConcurrentAllPriceData

func (*ConcurrentAllPriceData) GetData

func (*ConcurrentAllPriceData) SetOnePrice

func (self *ConcurrentAllPriceData) SetOnePrice(
	exchange common.ExchangeID,
	pair common.TokenPairID,
	d common.ExchangePrice)

type Exchange

type Exchange interface {
	ID() common.ExchangeID
	Name() string
	TokenPairs() []common.TokenPair
	FetchPriceData(timepoint uint64) (map[common.TokenPairID]common.ExchangePrice, error)
	FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
	FetchOrderData(timepoint uint64) (common.OrderEntry, error)
	OrderStatus(id common.ActivityID, timepoint uint64) (string, error)
	DepositStatus(id common.ActivityID, timepoint uint64) (string, error)
	WithdrawStatus(id common.ActivityID, timepoint uint64) (string, error)
}

type Fetcher

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

func NewFetcher

func NewFetcher(
	storage Storage,
	runner FetcherRunner,
	address ethereum.Address) *Fetcher

func (*Fetcher) AddExchange

func (self *Fetcher) AddExchange(exchange Exchange)

func (*Fetcher) Run

func (self *Fetcher) Run() error

func (*Fetcher) SetBlockchain

func (self *Fetcher) SetBlockchain(blockchain Blockchain)

func (*Fetcher) Stop

func (self *Fetcher) Stop() error

type FetcherRunner

type FetcherRunner interface {
	GetExchangeTicker() <-chan time.Time
	GetBlockchainTicker() <-chan time.Time
	// Start must be non-blocking and must only return after runner
	// gets to ready state before GetExchangeTicker() and
	// GetBlockchainTicker() get called
	Start() error
	// Stop should only be invoked when the runner is already running
	Stop() error
}

Runner to trigger fetcher

type Storage

type Storage interface {
	StorePrice(data map[common.TokenPairID]common.OnePrice, timepoint uint64) error
	StoreBalance(data map[string]common.BalanceEntry, timepoint uint64) error
	StoreEBalance(data map[common.ExchangeID]common.EBalanceEntry, timepoint uint64) error
	StoreRate(data common.AllRateEntry, timepoint uint64) error

	GetPendingActivities() ([]common.ActivityRecord, error)
	UpdateActivityStatus(action string, id common.ActivityID, destination string, status string) error
}

type TickerRunner

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

func NewTickerRunner

func NewTickerRunner(eduration, bduration time.Duration) *TickerRunner

func (*TickerRunner) GetBlockchainTicker

func (self *TickerRunner) GetBlockchainTicker() <-chan time.Time

func (*TickerRunner) GetExchangeTicker

func (self *TickerRunner) GetExchangeTicker() <-chan time.Time

func (*TickerRunner) Start

func (self *TickerRunner) Start() error

func (*TickerRunner) Stop

func (self *TickerRunner) Stop() error

type TimestampRunner

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

func NewTimestampRunner

func NewTimestampRunner(timestamps []uint64, bduration time.Duration) *TimestampRunner

func (*TimestampRunner) GetBlockchainTicker

func (self *TimestampRunner) GetBlockchainTicker() <-chan time.Time

func (*TimestampRunner) GetExchangeTicker

func (self *TimestampRunner) GetExchangeTicker() <-chan time.Time

func (*TimestampRunner) Start

func (self *TimestampRunner) Start() error

func (*TimestampRunner) Stop

func (self *TimestampRunner) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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