Skip to content

Commit

Permalink
PriceHistoryOptions fix for empty StartDate and EndDate (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
LifeOverIP authored Apr 24, 2022
1 parent c0f0034 commit e1cf09c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions priceHistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package tdameritrade
import (
"context"
"fmt"
"github.com/google/go-querystring/query"
"time"

"github.com/google/go-querystring/query"
)

var (
validPeriodTypes = []string{"day", "month", "year", "ytd"}
validPeriodTypes = []string{"day", "month", "year", "ytd"}
validFrequencyTypes = []string{"minute", "daily", "weekly", "monthly"}
)

const (
defaultPeriodType = "day"
defaultPeriodType = "day"
defaultFrequencyType = "minute"
)

Expand All @@ -31,15 +32,15 @@ type PriceHistoryOptions struct {
Period int `url:"period"`
FrequencyType string `url:"frequencyType"`
Frequency int `url:"frequency"`
EndDate time.Time `url:"endDate"`
StartDate time.Time `url:"startDate"`
NeedExtendedHoursData *bool `url:"needExtendedHoursData"`
EndDate time.Time `url:"endDate,omitempty"`
StartDate time.Time `url:"startDate,omitempty"`
NeedExtendedHoursData *bool `url:"needExtendedHoursData"`
}

type PriceHistory struct {
Candles []struct {
Close float64 `json:"close"`
Datetime int `json:"datetime"`
Datetime int `json:"datetime"`
High float64 `json:"high"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Expand Down Expand Up @@ -108,4 +109,3 @@ func contains(s string, lst []string) bool {
}
return false
}

0 comments on commit e1cf09c

Please sign in to comment.