writer

package
v4.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BarWriter

type BarWriter interface {
	Write(symbol string, bars []api.Bar) error
}

BarWriter is an interface to write chart data to the marketstore.

type BarWriterImpl

type BarWriterImpl struct {
	MarketStoreWriter MarketStoreWriter
	Timeframe         string
	// BarWriterImpl writes data with the timezone
	Timezone *time.Location
}

BarWriterImpl is an implementation of the BarWriter interface.

func (BarWriterImpl) Write

func (b BarWriterImpl) Write(symbol string, bars []api.Bar) error

Write converts the Response of the GetMultiBars API to a ColumnSeriesMap and write it to the local marketstore server.

type MarketStoreWriter

type MarketStoreWriter interface {
	Write(csm io.ColumnSeriesMap) error
}

MarketStoreWriter is an interface to write data to marketstore. this interface is necessary for writing unit tests of Alpaca Broker API Feeder without actually saving data to the marketstore.

type MarketStoreWriterImpl

type MarketStoreWriterImpl struct{}

MarketStoreWriterImpl writes the column series map data to the local marketstore data.

func (*MarketStoreWriterImpl) Write

type MarketTimeChecker added in v4.1.18

type MarketTimeChecker interface {
	IsOpen(t time.Time) bool
}

type NoopMarketTimeChecker added in v4.1.18

type NoopMarketTimeChecker struct{}

NoopMarketTimeChecker checks nothing and always returns IsOpen=true.

func (*NoopMarketTimeChecker) IsOpen added in v4.1.18

func (nc *NoopMarketTimeChecker) IsOpen(t time.Time) bool

type SnapshotWriter

type SnapshotWriter interface {
	Write(snapshots map[string]*api.Snapshot) error
}

SnapshotWriter is an interface to write the realtime stock data to the marketstore.

type SnapshotWriterImpl

type SnapshotWriterImpl struct {
	MarketStoreWriter MarketStoreWriter
	Timeframe         string
	// SnapshotWriterImpl writes data with the timezone
	Timezone    *time.Location
	TimeChecker MarketTimeChecker
}

SnapshotWriterImpl is an implementation of the SnapshotWriter interface.

func NewSnapshotWriterImpl added in v4.1.18

func NewSnapshotWriterImpl(w MarketStoreWriter, tf string, tz *time.Location, tc MarketTimeChecker,
) *SnapshotWriterImpl

func (SnapshotWriterImpl) Write

func (q SnapshotWriterImpl) Write(snapshots map[string]*api.Snapshot) error

Write converts the map(key:symbol, value:snapshot) to a ColumnSeriesMap and write it to the local marketstore server.

Jump to

Keyboard shortcuts

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