reorg

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:          "reorg",
	Short:        "Functions for handling ICE's reorg files",
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		return cmd.Help()
	},
}

Cmd is the parent for other Reorg related commands.

View Source
var ImportCmd = &cobra.Command{
	Use:   "import <datadir> <icefilesdir>",
	Short: "Import corporate actions announcements ",
	Long: `This command is used for importing corporate action entries from ICE's rerog files
	<datadir> must point to Marketstore's data directory
	<icefilesdir> must contain ICE's reorg.* and sirs.*/sirs.refresh.* files
	Each successfully imported rerog file will be renamed to reorg.*.processed to avoid reimporting it later
	
	By default, without --reimport option it only imports unprocessed data files (those without .processed suffix)
	With --reimport specified, it reprocess every file reorg.* file found in <icefilesdir>.  Be aware that 
	due to the nature of how marketstore stores records, it will duplicate corporate action announcements 
	if run on already existing import

	--fallback-to-cusip allows Marketstore to store corporate action records by their TargetCusipID 
    if a matching symbol is not found. Default is false, so only records with matching symbols are stored 
	`,
	SilenceUsage: false,
	RunE: func(cmd *cobra.Command, args []string) error {
		// usage: import <datadir> <icefilesdir>
		const argLen = 2
		if len(args) != argLen {
			_ = cmd.Help()
			return nil
		}
		dataDir := args[0]
		reorgDir := args[1]

		cfg := utils.NewDefaultConfig(dataDir)
		cfg.WALBypass = true
		c := di.NewContainer(cfg)
		executor.NewInstanceSetup(c.GetCatalogDir(), c.GetInitWALFile())

		utils.InstanceConfig.DisableVariableCompression = disableVarComp
		err := reorg.Import(reorgDir, reimport, storeWithoutSymbols)
		if err != nil {
			return fmt.Errorf("failed to import: %w", err)
		}
		return nil
	},
}

ImportCmd provides a command line interface for importing corporate action entries from ICE's data files without --reimport option it only imports unprocessed data files (those without .processed suffix) with --reimport specified, it reprocess every file found in <icefilesdir>. Be aware that due to the nature of how marketstore stores records, it will duplicate corporate action announcements if run on an already populated data directory.

View Source
var ShowRecordsCmd = &cobra.Command{
	Use:   "show <datadir> <cusip/symbol>",
	Short: "Shows corporate action announcement",
	Long: `This command shows accouncements stored for a given symbol or cusip
	<datadir> must point to Marketstore's data directory
	<cusip/symbol> is euther a CUSIP id or a symbol name

	Mainly for debugging / verification purposes.
	`,
	SilenceUsage: false,
	RunE: func(cmd *cobra.Command, args []string) error {
		// usage: show <datadir> <cusip/symbol>
		const argLen = 2
		if len(args) != argLen {
			_ = cmd.Help()
			return nil
		}
		cusip := args[1]
		dataDir := args[0]

		cfg := utils.NewDefaultConfig(dataDir)
		cfg.WALBypass = true
		c := di.NewContainer(cfg)
		executor.NewInstanceSetup(c.GetCatalogDir(), c.GetInitWALFile())
		showRecords(cusip, c.GetCatalogDir())
		return nil
	},
}

ShowRecordsCmd shows stored corporate action announcements in marketstore. Its main purpose is to provide a way of verification of the imported data.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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