cmd

package
v0.0.0-...-daaccfe Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddErrorHelp

func AddErrorHelp(err error) error

func ClearAuth

func ClearAuth(customerId string, cfgFolder ConfigurationFolder, cfgStore *CustomerConfigurationStore) (
	jsonmap.JsonMap, error,
)

func DeleteAlerts

func DeleteAlerts(eTradeClient client.ETradeClient, alertIds []string) (jsonmap.JsonMap, error)

func GetAccountBalances

func GetAccountBalances(eTradeClient client.ETradeClient, accountId string, realTimeBalance bool) (
	jsonmap.JsonMap, error,
)

func GetAccountById

func GetAccountById(client client.ETradeClient, accountId string) (etradelib.ETradeAccount, error)

func GetCustomerList

func GetCustomerList(cfgStore *CustomerConfigurationStore) jsonmap.JsonMap

func GetOptionChains

func GetOptionChains(
	eTradeClient client.ETradeClient, symbol string, expiryYear int, expiryMonth int, expiryDay int,
	strikePriceNear int, noOfStrikes int, includeWeekly bool, skipAdjusted bool,
	optionCategory constants.OptionCategory, chainType constants.OptionChainType, priceType constants.OptionPriceType,
) (jsonmap.JsonMap, error)

func GetOptionExpireDates

func GetOptionExpireDates(
	eTradeClient client.ETradeClient, symbol string, expiryType constants.OptionExpiryType,
) (jsonmap.JsonMap, error)

func GetQuotes

func GetQuotes(
	eTradeClient client.ETradeClient, symbols []string, detail constants.QuoteDetailFlag, requireEarningsDate bool,
	skipMiniOptionsCheck bool,
) (
	jsonmap.JsonMap, error,
)

func ListAccounts

func ListAccounts(eTradeClient client.ETradeClient) (jsonmap.JsonMap, error)

func ListAlertDetails

func ListAlertDetails(eTradeClient client.ETradeClient, alertId string) (jsonmap.JsonMap, error)

func ListAlerts

func ListAlerts(
	eTradeClient client.ETradeClient, count int, category constants.AlertCategory, status constants.AlertStatus,
	sortOrder constants.SortOrder, search string,
) (jsonmap.JsonMap, error)

func ListOrders

func ListOrders(
	eTradeClient client.ETradeClient, accountId string, status constants.OrderStatus, fromDate *time.Time,
	toDate *time.Time, symbols []string, securityType constants.OrderSecurityType,
	transactionType constants.OrderTransactionType, marketSession constants.MarketSession,
) (jsonmap.JsonMap, error)

func ListTransactionDetails

func ListTransactionDetails(eTradeClient client.ETradeClient, accountId string, transactionId string) (
	jsonmap.JsonMap, error,
)

func ListTransactions

func ListTransactions(
	eTradeClient client.ETradeClient, accountId string, startDate *time.Time, endDate *time.Time,
	sortOrder constants.SortOrder,
) (jsonmap.JsonMap, error)

func Lookup

func Lookup(eTradeClient client.ETradeClient, search string) (jsonmap.JsonMap, error)

func NewETradeClientForCustomer

func NewETradeClientForCustomer(
	customerId string, cfgFolder ConfigurationFolder, cfgStore *CustomerConfigurationStore, logger *slog.Logger,
) (client.ETradeClient, error)

func NewETradeServer

func NewETradeServer(
	addr string, logger *slog.Logger, cfgFolder ConfigurationFolder, cfgStore *CustomerConfigurationStore,
) *http.Server

func SaveCachedCredentials

func SaveCachedCredentials(writer io.Writer, credentials *CachedCredentials) error

func SaveCachedCredentialsToFile

func SaveCachedCredentialsToFile(filename string, credentials *CachedCredentials, logger *slog.Logger) error

func SaveCustomerConfigurationStore

func SaveCustomerConfigurationStore(writer io.Writer, cc *CustomerConfigurationStore) error

func SaveCustomerConfigurationStoreToFile

func SaveCustomerConfigurationStoreToFile(
	filename string, overwriteExisting bool, cc *CustomerConfigurationStore, logger *slog.Logger,
) error

func ViewPortfolio

func ViewPortfolio(
	eTradeClient client.ETradeClient, accountId string, sortBy constants.PortfolioSortBy, sortOrder constants.SortOrder,
	marketSession constants.MarketSession, totalsRequired bool, portfolioView constants.PortfolioView, withLots bool,
) (jsonmap.JsonMap, error)

Types

type CachedCredentials

type CachedCredentials struct {
	AccessToken  string    `json:"accessToken"`
	AccessSecret string    `json:"accessSecret"`
	LastUpdated  time.Time `json:"lastUpdated"`
}

func LoadCachedCredentials

func LoadCachedCredentials(reader io.Reader) (*CachedCredentials, error)

func LoadCachedCredentialsFromFile

func LoadCachedCredentialsFromFile(filename string, logger *slog.Logger) (*CachedCredentials, error)

type CommandAccounts

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

func (*CommandAccounts) Command

func (c *CommandAccounts) Command(globalFlags *globalFlags) *cobra.Command

type CommandAccountsBalances

type CommandAccountsBalances struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandAccountsBalances) Command

func (c *CommandAccountsBalances) Command() *cobra.Command

type CommandAccountsList

type CommandAccountsList struct {
	Context *CommandContextWithClient
}

func (*CommandAccountsList) Command

func (c *CommandAccountsList) Command() *cobra.Command

type CommandAccountsPortfolio

type CommandAccountsPortfolio struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandAccountsPortfolio) Command

func (c *CommandAccountsPortfolio) Command() *cobra.Command

type CommandAccountsTransactions

type CommandAccountsTransactions struct {
	Context *CommandContextWithClient
}

func (*CommandAccountsTransactions) Command

type CommandAccountsTransactionsDetails

type CommandAccountsTransactionsDetails struct {
	Context *CommandContextWithClient
}

func (*CommandAccountsTransactionsDetails) Command

type CommandAccountsTransactionsList

type CommandAccountsTransactionsList struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandAccountsTransactionsList) Command

type CommandAlerts

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

func (*CommandAlerts) Command

func (c *CommandAlerts) Command(globalFlags *globalFlags) *cobra.Command

type CommandAlertsDelete

type CommandAlertsDelete struct {
	Context *CommandContextWithClient
}

func (*CommandAlertsDelete) Command

func (c *CommandAlertsDelete) Command() *cobra.Command

type CommandAlertsDetails

type CommandAlertsDetails struct {
	Context *CommandContextWithClient
}

func (*CommandAlertsDetails) Command

func (c *CommandAlertsDetails) Command() *cobra.Command

type CommandAlertsList

type CommandAlertsList struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandAlertsList) Command

func (c *CommandAlertsList) Command() *cobra.Command

type CommandAuth

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

func (*CommandAuth) Command

func (c *CommandAuth) Command(globalFlags *globalFlags) *cobra.Command

type CommandAuthClear

type CommandAuthClear struct {
	Context *CommandContextWithStore
}

func (*CommandAuthClear) Command

func (c *CommandAuthClear) Command(globalFlags *globalFlags) *cobra.Command

type CommandAuthLogin

type CommandAuthLogin struct {
	Context *CommandContextWithStore
}

func (*CommandAuthLogin) Command

func (c *CommandAuthLogin) Command(globalFlags *globalFlags) *cobra.Command

func (*CommandAuthLogin) Login

func (c *CommandAuthLogin) Login(customerId string) error

type CommandCfg

type CommandCfg struct {
}

func (*CommandCfg) Command

func (c *CommandCfg) Command(globalFlags *globalFlags) *cobra.Command

type CommandCfgCreate

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

func (*CommandCfgCreate) Command

func (c *CommandCfgCreate) Command(globalFlags *globalFlags) *cobra.Command

func (*CommandCfgCreate) CreateConfig

func (c *CommandCfgCreate) CreateConfig() error

type CommandCfgList

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

func (*CommandCfgList) Command

func (c *CommandCfgList) Command(globalFlags *globalFlags) *cobra.Command

type CommandContext

type CommandContext struct {
	Logger              *slog.Logger
	Renderer            Renderer
	ConfigurationFolder ConfigurationFolder
}

func NewCommandContextFromFlags

func NewCommandContextFromFlags(flags *globalFlags) (*CommandContext, error)

func (*CommandContext) Close

func (c *CommandContext) Close() error

type CommandContextWithClient

type CommandContextWithClient struct {
	Logger   *slog.Logger
	Renderer Renderer
	Client   client.ETradeClient
}

func NewCommandContextWithClientFromFlags

func NewCommandContextWithClientFromFlags(flags *globalFlags) (*CommandContextWithClient, error)

func (*CommandContextWithClient) Close

func (c *CommandContextWithClient) Close() error

type CommandContextWithStore

type CommandContextWithStore struct {
	Logger                     *slog.Logger
	Renderer                   Renderer
	ConfigurationFolder        ConfigurationFolder
	CustomerConfigurationStore *CustomerConfigurationStore
}

func NewCommandContextWithStoreFromFlags

func NewCommandContextWithStoreFromFlags(flags *globalFlags) (*CommandContextWithStore, error)

func (*CommandContextWithStore) Close

func (c *CommandContextWithStore) Close() error

type CommandMarket

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

func (*CommandMarket) Command

func (c *CommandMarket) Command(globalFlags *globalFlags) *cobra.Command

type CommandMarketLookup

type CommandMarketLookup struct {
	Context *CommandContextWithClient
}

func (*CommandMarketLookup) Command

func (c *CommandMarketLookup) Command() *cobra.Command

type CommandMarketOptionChains

type CommandMarketOptionChains struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandMarketOptionChains) Command

func (c *CommandMarketOptionChains) Command() *cobra.Command

type CommandMarketOptionExpire

type CommandMarketOptionExpire struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandMarketOptionExpire) Command

func (c *CommandMarketOptionExpire) Command() *cobra.Command

type CommandMarketQuote

type CommandMarketQuote struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandMarketQuote) Command

func (c *CommandMarketQuote) Command() *cobra.Command

type CommandOrders

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

func (*CommandOrders) Command

func (c *CommandOrders) Command(globalFlags *globalFlags) *cobra.Command

type CommandOrdersList

type CommandOrdersList struct {
	Context *CommandContextWithClient
	// contains filtered or unexported fields
}

func (*CommandOrdersList) Command

func (c *CommandOrdersList) Command() *cobra.Command

type CommandServer

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

func (*CommandServer) Command

func (c *CommandServer) Command(globalFlags *globalFlags) *cobra.Command

type ConfigurationFolder

type ConfigurationFolder string

func NewConfigurationFolder

func NewConfigurationFolder(cfgFolder string) ConfigurationFolder

func (ConfigurationFolder) GetConfigurationFilePath

func (f ConfigurationFolder) GetConfigurationFilePath() string

func (ConfigurationFolder) GetFileCachePathForCustomer

func (f ConfigurationFolder) GetFileCachePathForCustomer(customerConsumerKey string) string

func (ConfigurationFolder) LoadCachedCredentialsFromFile

func (f ConfigurationFolder) LoadCachedCredentialsFromFile(
	customerConsumerKey string, logger *slog.Logger,
) (*CachedCredentials, error)

func (ConfigurationFolder) LoadCustomerConfiguration

func (f ConfigurationFolder) LoadCustomerConfiguration(logger *slog.Logger) (*CustomerConfigurationStore, error)

func (ConfigurationFolder) RemoveCachedCredentialsFile

func (f ConfigurationFolder) RemoveCachedCredentialsFile(customerConsumerKey string) error

func (ConfigurationFolder) SaveCachedCredentialsToFile

func (f ConfigurationFolder) SaveCachedCredentialsToFile(
	customerConsumerKey string, credentials *CachedCredentials, logger *slog.Logger,
) error

func (ConfigurationFolder) SaveCustomerConfiguration

func (f ConfigurationFolder) SaveCustomerConfiguration(
	cfgStore *CustomerConfigurationStore, overwriteExisting bool, logger *slog.Logger,
) error

type CustomerConfiguration

type CustomerConfiguration struct {
	CustomerName           string `json:"customerName"`
	CustomerProduction     bool   `json:"customerProduction"`
	CustomerConsumerKey    string `json:"customerConsumerKey"`
	CustomerConsumerSecret string `json:"customerConsumerSecret"`
}

type CustomerConfigurationStore

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

func LoadCustomerConfigurationStore

func LoadCustomerConfigurationStore(reader io.Reader) (*CustomerConfigurationStore, error)

func LoadCustomerConfigurationStoreFromFile

func LoadCustomerConfigurationStoreFromFile(filename string, logger *slog.Logger) (
	*CustomerConfigurationStore, error,
)

func (*CustomerConfigurationStore) GetAllConfigurations

func (c *CustomerConfigurationStore) GetAllConfigurations() map[string]CustomerConfiguration

func (*CustomerConfigurationStore) GetCustomerConfigurationById

func (c *CustomerConfigurationStore) GetCustomerConfigurationById(customerId string) (*CustomerConfiguration, error)

func (*CustomerConfigurationStore) SetCustomerConfigurationForId

func (c *CustomerConfigurationStore) SetCustomerConfigurationForId(
	customerId string, configuration *CustomerConfiguration,
)

type RenderDescriptor

type RenderDescriptor struct {
	ObjectPath   string
	Values       []RenderValue
	SubObjects   []RenderDescriptor
	DefaultValue string
	SpaceAfter   bool
}

func GetCompleteViewRenderDescriptor

func GetCompleteViewRenderDescriptor(withLots bool) []RenderDescriptor

func GetFundamentalViewRenderDescriptor

func GetFundamentalViewRenderDescriptor(withLots bool) []RenderDescriptor

func GetOptionsWatchViewRenderDescriptor

func GetOptionsWatchViewRenderDescriptor(withLots bool) []RenderDescriptor

func GetPerformanceViewRenderDescriptor

func GetPerformanceViewRenderDescriptor(withLots bool) []RenderDescriptor

func GetQuickViewRenderDescriptor

func GetQuickViewRenderDescriptor(withLots bool) []RenderDescriptor

type RenderValue

type RenderValue struct {
	Header      string
	Path        string
	Transformer TransformerFn
}

type Renderer

type Renderer interface {
	Render(jsonMap jsonmap.JsonMap, descriptors []RenderDescriptor) error
	Close() error
}

type RootCommand

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

func (*RootCommand) Command

func (c *RootCommand) Command() *cobra.Command

type TransformerFn

type TransformerFn func(value interface{}) interface{}

Jump to

Keyboard shortcuts

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