candlesv2

package
v0.78.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: AGPL-3.0 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 `description:"candles with the given intervals will always be created and exist by default" string:"default-candle-intervals"`
}

type CandleUpdates added in v0.55.0

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 added in v0.55.0

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 added in v0.55.0

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

type CandleUpdatesConfig

type CandleUpdatesConfig struct {
	CandleUpdatesStreamBufferSize                int               `` /* 137-byte string literal not displayed */
	CandleUpdatesStreamInterval                  encoding.Duration `` /* 134-byte string literal not displayed */
	CandlesFetchTimeout                          encoding.Duration `description:"Maximum time permissible to fetch candles"                                          long:"candles-fetch-timeout"`
	CandleUpdatesStreamSubscriptionMsgBufferSize int               `` /* 150-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