candlesv2

package
v0.0.0-...-589da53 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandleStore

type CandleStore interface {
	GetCandleDataForTimeSpan(ctx context.Context, candleID string, from *time.Time, to *time.Time,
		p entities.CursorPagination) ([]entities.Candle, entities.PageInfo, error)
	GetCandlesForMarket(ctx context.Context, market string) (map[string]string, error)
	CandleExists(ctx context.Context, candleID string) (bool, error)
	GetCandleIDForIntervalAndMarket(ctx context.Context, interval string, market string) (bool, string, error)
}

CandleStore ...

type CandleStoreConfig

type CandleStoreConfig struct {
	DefaultCandleIntervals string `string:"default-candle-intervals" description:"candles with the given intervals will always be created and exist by default"`
}

type CandleUpdates

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

func NewCandleUpdates

func NewCandleUpdates(ctx context.Context, log *logging.Logger, candleID string, candleSource candleSource,
	config CandleUpdatesConfig,
) *CandleUpdates

func (*CandleUpdates) Subscribe

func (s *CandleUpdates) Subscribe() (string, <-chan entities.Candle, error)

Subscribe returns a unique subscription id and channel on which updates will be sent.

func (*CandleUpdates) Unsubscribe

func (s *CandleUpdates) Unsubscribe(subscriptionID string) error

type CandleUpdatesConfig

type CandleUpdatesConfig struct {
	CandleUpdatesStreamBufferSize                int               `` /* 137-byte string literal not displayed */
	CandleUpdatesStreamInterval                  encoding.Duration `long:"candle-updates-stream-interval" description:"The time between sending updated candles"`
	CandlesFetchTimeout                          encoding.Duration `long:"candles-fetch-timeout" description:"Maximum time permissible to fetch candles"`
	CandleUpdatesStreamSubscriptionMsgBufferSize int               `` /* 137-byte string literal not displayed */
}

type Config

type Config struct {
	Level         encoding.LogLevel   `long:"log-level"`
	CandleStore   CandleStoreConfig   `group:"CandleStore" namespace:"candlestore"`
	CandleUpdates CandleUpdatesConfig `group:"CandleUpdates" namespace:"candleupdates"`
}

Config represent the configuration of the candle v2 package.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.

type Svc

type Svc struct {
	Config
	CandleStore
	// contains filtered or unexported fields
}

func NewService

func NewService(ctx context.Context, log *logging.Logger, config Config, candleStore CandleStore) *Svc

func (*Svc) Subscribe

func (cs *Svc) Subscribe(ctx context.Context, candleID string) (string, <-chan entities.Candle, error)

Subscribe to a channel of new or updated candles. The subscriber id will must be retained for future reference and to Unsubscribe.

func (*Svc) Unsubscribe

func (cs *Svc) Unsubscribe(subscriptionID string) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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