Documentation

Index

Constants

View Source
const (
	// DefaultCandleRequest is the number of candles to return if the request
	// does not specify otherwise.
	DefaultCandleRequest = 50
	// CacheSize is the default cache size. Also represents the maximum number
	// of candles that can be requested at once.
	CacheSize = 1000
)

Variables

View Source
var (
	// BinSizes is the default bin sizes for candlestick data sets. Exported for
	// use in the 'config' response. Internally, we will parse these to uint64
	// milliseconds.
	BinSizes = []string{"24h", "1h", "5m"}
)

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 []*db.CandleCache) 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(ctx context.Context, 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.

                  Source Files