Documentation ¶
Overview ¶
package commands contains commands that can be executed by the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CLI struct { Debug bool `help:"Enable debug mode."` Security SecurityCmd `cmd:"" help:"Security commands."` Portfolio PortfolioCmd `cmd:"" help:"Portfolio commands."` BankAccount BankAccountCmd `cmd:"" help:"Bank account commands."` Completion kongcompletion.Completion `cmd:"" help:"Outputs shell code for initializing tab completions" hidden:"" completion-shell-default:"false"` }
View Source
var PredictPortfolios = kongcompletion.WithPredictor( "portfolio", complete.PredictFunc(func(complete.Args) (names []string) { client := portfoliov1connect.NewPortfolioServiceClient( http.DefaultClient, "http://localhost:8080", connect.WithHTTPGet(), ) res, err := client.ListPortfolios( context.Background(), connect.NewRequest(&portfoliov1.ListPortfoliosRequest{}), ) if err != nil { return nil } for _, p := range res.Msg.Portfolios { names = append(names, p.Name) } return }), )
View Source
var PredictSecurities = kongcompletion.WithPredictor( "security", complete.PredictFunc(func(complete.Args) (names []string) { client := portfoliov1connect.NewSecuritiesServiceClient( http.DefaultClient, "http://localhost:8080", connect.WithHTTPGet(), ) res, err := client.ListSecurities( context.Background(), connect.NewRequest(&portfoliov1.ListSecuritiesRequest{}), ) if err != nil { return nil } for _, p := range res.Msg.Securities { names = append(names, p.Name) } return }), )
Functions ¶
This section is empty.
Types ¶
type BankAccountCmd ¶ added in v0.1.0
type BankAccountCmd struct {
Create CreateBankAccountCmd `cmd:"" help:"Creates a new bank account."`
}
type CreateBankAccountCmd ¶ added in v0.1.0
type CreatePortfolioCmd ¶
type CreateTransactionCmd ¶ added in v0.0.4
type CreateTransactionCmd struct { PortfolioName string `required:"" predictor:"portfolio" help:"The name of the portfolio where the transaction will be created in"` SecurityName string `arg:"" predictor:"security" help:"The name of the security this transaction belongs to (its ISIN)"` Type string `required:"" enum:"buy,sell,delivery-inbound,delivery-outbound,dividend" default:"buy"` Amount float64 `required:"" help:"The amount of securities involved in the transaction"` Price float32 `required:"" help:"The price without fees or taxes"` Fees float32 `help:"Any fees that applied to the transaction"` Taxes float32 `help:"Any taxes that applied to the transaction"` Time time.Time `help:"The time of the transaction. Defaults to 'now'" format:"2006-01-02 15:04"` }
type ImportTransactionsCmd ¶
type ImportTransactionsCmd struct { PortfolioName string `required:"" predictor:"portfolio"` CsvFile string `arg:"" help:"The path to the CSV file to import"` }
func (*ImportTransactionsCmd) Run ¶
func (cmd *ImportTransactionsCmd) Run(s *cli.Session) error
Exec implements cli.Command
type ListPortfolioCmd ¶
type ListPortfolioCmd struct{}
type ListSecuritiesCmd ¶
type ListSecuritiesCmd struct{}
type PortfolioCmd ¶
type PortfolioCmd struct { Create CreatePortfolioCmd `cmd:"" help:"Creates a new portfolio."` List ListPortfolioCmd `cmd:"" help:"Lists all portfolios."` Show ShowPortfolioCmd `cmd:"" help:"Shows details about one portfolio."` Transactions struct { Create CreateTransactionCmd `cmd:"" help:"Creates a transaction. Defaults to a \"buy\" transaction."` Import ImportTransactionsCmd `cmd:"" help:"Imports transactions from CSV."` } `cmd:"" help:"Subcommands supporting transactions within one portfolio"` }
type SecurityCmd ¶
type SecurityCmd struct { List ListSecuritiesCmd `cmd:"" help:"Lists all securities."` UpdateQuote UpdateQuoteCmd `cmd:"" help:"Triggers an update of one or more securities' quotes."` UpdateAllQuotes UpdateAllQuotesCmd `cmd:"" help:"Triggers an update of all quotes."` }
type ShowPortfolioCmd ¶
type ShowPortfolioCmd struct {
PortfolioName string `help:"The identifier of the portfolio, e.g. mybank/myportfolio" required:"" predictor:"portfolio"`
}
type UpdateAllQuotesCmd ¶
type UpdateAllQuotesCmd struct{}
func (*UpdateAllQuotesCmd) Run ¶
func (cmd *UpdateAllQuotesCmd) Run(s *cli.Session) error
Exec implements cli.Command
type UpdateQuoteCmd ¶
type UpdateQuoteCmd struct {
SecurityNames []string `arg:""`
}
func (*UpdateQuoteCmd) Run ¶
func (cmd *UpdateQuoteCmd) Run(s *cli.Session) error
Exec implements cli.Command
Click to show internal directories.
Click to hide internal directories.