Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BookSource ¶
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 LastCandleEndStamp(base, quote uint32, candleDur uint64) (uint64, error) InsertCandles(base, quote uint32, dur uint64, cs []*candles.Candle) 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, registerHTTP func(route string, handler comms.HTTPHandler)) *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 ¶
MarketSource is a source of market information. Markets are added after construction but before use using the AddMarketSource method.