sectors

package
v0.0.0-...-274743d Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SectorsCmd = &cobra.Command{
	Use:   "sectors",
	Short: "Returns the performance of various sectors over a time period",
	Long: `The sectors cmd can also take the optional 't' flag which allows you
	to specify a time period to benchmark sector performance against. This cmd can
	also take the 's' stock flag which allows you to compare all the sectors against
	the performance of a particular equity.`,
	Example: "  king-spy sectors \n" +
		"  king-spy sectors -t=1M \n" +
		"  king-spy sectors -t=1M -s=aapl \n",
	Run: func(cmd *cobra.Command, args []string) {
		ksCmd := "sectors"
		timeArg, _ := cmd.Flags().GetString("time")
		if timeArg == "" {
			timeVal = "YTD"
		} else {
			timeVal = timeArg
		}

		stockArg, _ := cmd.Flags().GetString("stock")
		if stockArg == "" {
			stockVal = "NA"
		} else {
			utils.TickerValidation(stockArg)
			stockVal = stockArg
		}

		_, key, secret := config.Init()
		cfg := GetSectorsConfig{
			Key:    key,
			Secret: secret,
			Cmd:    ksCmd,
		}

		CompareSectors(cfg, timeVal, stockVal)
	},
}

SectorsCmd represents the sectors command

Functions

func CompareSectors

func CompareSectors(cfg GetSectorsConfig, timeVal string, stockVal string)

Types

type GetSectorsConfig

type GetSectorsConfig struct {
	Key    string
	Secret string
	Cmd    string
}

type Sector

type Sector struct {
	Name  string
	Value float64
}

Jump to

Keyboard shortcuts

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