feed

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 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 Backfill

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

Backfill aggregates daily chart data using Xignite API and store it to

func NewBackfill

func NewBackfill(symbolManager symbols.Manager, apiClient api.Client, writer writer.QuotesWriter,
	rangeWriter writer.QuotesRangeWriter, Since time.Time,
) *Backfill

NewBackfill initializes the module to backfill the historical daily chart data to marketstore

func (*Backfill) Update

func (b *Backfill) Update()

Update calls UpdateSymbols and UpdateIndexSymbols functions sequentially

func (*Backfill) UpdateClosingPrice

func (b *Backfill) UpdateClosingPrice()

UpdateClosingPrice get real-time quotes data for the target symbols and store them into the local marketstore server.

func (*Backfill) UpdateIndexSymbols

func (b *Backfill) UpdateIndexSymbols()

UpdateIndexSymbols aggregates daily chart data of index symbols since the specified date and store it to "{symbol}/{timeframe}/OHLCV" bucket in marketstore

func (*Backfill) UpdateSymbols

func (b *Backfill) UpdateSymbols()

UpdateSymbols aggregates daily chart data since the specified date and store it to "{symbol}/{timeframe}/OHLCV" bucket in marketstore

type DefaultMarketTimeChecker

type DefaultMarketTimeChecker struct {
	// i.e. []string{"Saturday", "Sunday"}
	ClosedDaysOfTheWeek []time.Weekday
	ClosedDays          []time.Time
	OpenTime            time.Time
	CloseTime           time.Time
}

DefaultMarketTimeChecker is an implementation for MarketTimeChecker object. this checker checks the followings: - the market is open at this days of the week - the market is open at this time - the market is open today (= check if today is a holiday or not) all those settings should be defined in this object

func NewDefaultMarketTimeChecker

func NewDefaultMarketTimeChecker(closedDaysOfTheWeek []time.Weekday, closedDays []time.Time, openTime time.Time, closeTime time.Time) *DefaultMarketTimeChecker

NewDefaultMarketTimeChecker initializes the DefaultMarketTimeChecker object with the specifier parameters.s

func (*DefaultMarketTimeChecker) IsOpen

func (m *DefaultMarketTimeChecker) IsOpen(t time.Time) bool

IsOpen returns true on weekdays from 08:55 to 15:10. if closedDates are defined, return false on those days

func (*DefaultMarketTimeChecker) Sub

func (m *DefaultMarketTimeChecker) Sub(dateInJST time.Time, businessDay int) (time.Time, error)

Sub returns a date before X business days (= days which market is open). businessDay should be a positive value.

type MarketTimeChecker

type MarketTimeChecker interface {
	IsOpen(t time.Time) bool
	// Sub returns a date after X business day (= day which market is open). businessDay can be a negative value.
	Sub(date time.Time, businessDay int) (time.Time, error)
}

MarketTimeChecker is an interface to check if the market is open at the specified time or not

type RecentBackfill

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

RecentBackfill aggregates daily chart data using Xignite API and store it to

func NewRecentBackfill

func NewRecentBackfill(sm symbols.Manager, mtc MarketTimeChecker, ac api.Client, writer writer.BarWriter, days int,
) *RecentBackfill

NewRecentBackfill initializes the module to backfill the historical 5-minute chart data to marketstore

func (*RecentBackfill) Update

func (b *RecentBackfill) Update()

func (*RecentBackfill) UpdateIndexSymbols

func (b *RecentBackfill) UpdateIndexSymbols()

UpdateIndexSymbols aggregates recent chart data of index symbols for the past X business days and store it to "{symbol}/5Min/OHLCV" bucket in marketstore

func (*RecentBackfill) UpdateSymbols

func (b *RecentBackfill) UpdateSymbols()

UpdateSymbols aggregates recent chart data for the past X business days and store it to "{symbol}/5Min/OHLCV" bucket in marketstore

type Worker

type Worker struct {
	MarketTimeChecker MarketTimeChecker
	APIClient         api.Client
	SymbolManager     symbols.Manager
	QuotesWriter      writer.QuotesWriter
	Interval          int
}

Worker is the main worker instance. It implements bgworker.Run().

func (*Worker) Run

func (w *Worker) Run()

Run runs forever to get quotes data for each symbol in the target exchanges using Xignite API periodically, and writes the data to the local marketstore server.

Jump to

Keyboard shortcuts

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