configs

package
v4.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomDay

type CustomDay time.Time

CustomDay is a date time object in the cdLayout format

func (*CustomDay) UnmarshalJSON

func (cd *CustomDay) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a string in the cdLayout

type CustomTime

type CustomTime time.Time

CustomTime is a date time object in the ctLayout format

func (*CustomTime) UnmarshalJSON

func (ct *CustomTime) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a string in the ctLayout

type DefaultConfig

type DefaultConfig struct {
	Exchanges           []string  `json:"exchanges"`
	IndexGroups         []string  `json:"index_groups"`
	UpdateTime          time.Time `json:"update_time"`
	Timeframe           string    `json:"timeframe"`
	APIToken            string    `json:"token"`
	Timeout             int       `json:"timeout"`
	OpenTime            time.Time
	CloseTime           time.Time
	ClosedDaysOfTheWeek []time.Weekday
	ClosedDays          []time.Time
	Interval            int `json:"interval"`
	// If a non-zero value is set for OffHoursInterval,
	// the data-feeding is executed every offHoursInterval[minute] even when the market is closed.
	OffHoursInterval int `json:"off_hours_interval"`
	Backfill         struct {
		Enabled   bool      `json:"enabled"`
		Since     CustomDay `json:"since"`
		Timeframe string    `json:"timeframe"`
	} `json:"backfill"`
	// for the past X market-open days,
	// Xignite Feeder can feed 5-minute chart data for the target symbols in addition to daily-chart data backfill.
	RecentBackfill struct {
		Enabled   bool   `json:"enabled"`
		Days      int    `json:"days"`
		Timeframe string `json:"timeframe"`
	} `json:"recentBackfill"`
}

DefaultConfig is the configuration for XigniteFeeder you can define in marketstore's config file through bgworker extension.

func NewConfig

func NewConfig(config map[string]interface{}) (*DefaultConfig, error)

NewConfig casts a map object to Config struct and returns it through json marshal->unmarshal

func (*DefaultConfig) UnmarshalJSON

func (c *DefaultConfig) UnmarshalJSON(input []byte) error

UnmarshalJSON parses the config data to the DefaultConfig object. Because some parameters (OpenTime, ClosedDaysOfTheWeek, etc) have their original types and unmarshal methods but it's troublesome for other business logic to use those not-general types, so this method parses the data to an auxiliary struct and cast the types first, then parse to the DefaultConfig object.

Jump to

Keyboard shortcuts

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