configs

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

View Source
const (
	AMEX     = Exchange("AMEX")
	ARCA     = Exchange("ARCA")
	BATS     = Exchange("BATS")
	NYSE     = Exchange("NYSE")
	NASDAQ   = Exchange("NASDAQ")
	NYSEARCA = Exchange("NYSEARCA")
	OTC      = Exchange("OTC")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomDay

type CustomDay time.Time

CustomDay is a date time object (UTC) 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                  []Exchange `json:"exchanges"`
	SymbolsUpdateTime          time.Time  `json:"symbols_update_time"`
	UpdateTime                 time.Time  `json:"update_time"`
	StocksJSONURL              string     `json:"stocks_json_url"`
	StocksJSONBasicAuth        string     `json:"stocks_json_basic_auth"`
	Timeframe                  string     `json:"timeframe"`
	APIKeyID                   string     `json:"api_key_id"`
	APISecretKey               string     `json:"api_secret_key"`
	AuthMethod                 string     `json:"auth_method"`
	OpenHourNY, OpenMinuteNY   int
	CloseHourNY, CloseMinuteNY int
	ExtendedHours              bool `json:"extended_hours"`
	ClosedDaysOfTheWeek        []time.Weekday
	ClosedDays                 []time.Time
	Interval                   int `json:"interval"`
	// The data-feeding is executed when 'minute' of the current time matches off_hours_schedule
	// even when the market is cloded. Example: "10" -> execute at 00:10, 01:10, 02:10,...,23:10
	// Numbers separated by commas are allowed.  Example: "0,15,30,45" -> execute every 15 minutes.
	// Whitespaces are ignored.
	OffHoursSchedule string `json:"off_hours_schedule"`
	Backfill         struct {
		Enabled bool `json:"enabled"`
		// Since has only year, month, and day (00:00:00, UTC)
		Since     CustomDay `json:"since"`
		Timeframe string    `json:"timeframe"`
	} `json:"backfill"`
}

DefaultConfig is the configuration for Alpaca Broker API Feeder 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.

type Exchange

type Exchange string

func (*Exchange) UnmarshalJSON

func (e *Exchange) UnmarshalJSON(s []byte) error

func (*Exchange) Valid

func (e *Exchange) Valid() error

Jump to

Keyboard shortcuts

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