Skip to content

Commit

Permalink
fix how local flags are set and configure logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jdfergason committed Jan 8, 2025
1 parent 7bc2c7d commit ef0d9f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/backtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/goccy/go-json"
"github.com/penny-vault/pv-api/common"
"github.com/penny-vault/pv-api/data/database"
"github.com/penny-vault/pv-api/portfolio"
"github.com/penny-vault/pv-api/strategies"
Expand All @@ -33,8 +34,8 @@ var backtestStartTime string
var backtestEndTime string

func init() {
backtestCmd.LocalFlags().StringVarP(&backtestStartTime, "start", "s", "1980-01-01", "start time for back test of form yyyy-mm-dd")
backtestCmd.LocalFlags().StringVarP(&backtestEndTime, "end", "e", "1980-01-01", "end time for back test of form yyyy-mm-dd")
backtestCmd.Flags().StringVarP(&backtestStartTime, "start", "s", "1980-01-01", "start time for back test of form yyyy-mm-dd")
backtestCmd.Flags().StringVarP(&backtestEndTime, "end", "e", "1980-01-01", "end time for back test of form yyyy-mm-dd")
rootCmd.AddCommand(backtestCmd)
}

Expand All @@ -45,6 +46,10 @@ var backtestCmd = &cobra.Command{
ArgAliases: []string{"StrategyShortcode", "StrategyArguments"},
Run: func(_ *cobra.Command, args []string) {
ctx := context.Background()

// setup logging
common.SetupLogging()

// setup database
err := database.Connect(ctx)
if err != nil {
Expand Down

0 comments on commit ef0d9f8

Please sign in to comment.