apidata

package
v0.5.9-beta6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: BlueOak-1.0.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookSource

type BookSource interface {
	Book(mktName string) (*msgjson.OrderBook, error)
}

BookSource is a source of order book information. The BookSource is added after construction but before use.

type DBSource

type DBSource interface {
	LoadEpochStats(base, quote uint32, caches []*candles.Cache) error
}

DBSource is a source of persistent data. DBSource is used to prime the caches at startup.

type DataAPI

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

DataAPI is a data API backend.

func NewDataAPI

func NewDataAPI(dbSrc DBSource) *DataAPI

NewDataAPI is the constructor for a new DataAPI.

func (*DataAPI) AddMarketSource

func (s *DataAPI) AddMarketSource(mkt MarketSource) error

AddMarketSource should be called before any markets are running.

func (*DataAPI) ReportEpoch

func (s *DataAPI) ReportEpoch(base, quote uint32, epochIdx uint64, stats *matcher.MatchCycleStats) (*msgjson.Spot, error)

ReportEpoch should be called by every Market after every match cycle to report their epoch stats.

func (*DataAPI) SetBookSource

func (s *DataAPI) SetBookSource(bs BookSource)

SetBookSource should be called before the first call to handleBook.

type MarketSource

type MarketSource interface {
	EpochDuration() uint64
	Base() uint32
	Quote() uint32
}

MarketSource is a source of market information. Markets are added after construction but before use using the AddMarketSource method.

Jump to

Keyboard shortcuts

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