Skip to content

Commit

Permalink
fix tz
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfatman committed Oct 27, 2024
1 parent 3709425 commit e450d08
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions twelve_data/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ func (c *Client) GetLatestCandles(symbol string, micCode string) []*data.Candle
return candles
}
for _, item := range res.Values {
//dateTime := strings.ReplaceAll(item.DateTime, " ", "T")
//if micCode == "COMMODITY" {
//dateTime := strings.ReplaceAll(item.DateTime, " ", "T") + " AEST"
//}
aest, err := time.LoadLocation("Australia/Sydney")
closingTimestamp, err := time.ParseInLocation(time.DateTime, item.DateTime, aest)
tz, _ := time.LoadLocation("UTC")
if micCode == "COMMODITY" {
tz, _ = time.LoadLocation("Australia/Sydney")
}
closingTimestamp, err := time.ParseInLocation(time.DateTime, item.DateTime, tz)
if err != nil {
log.Errorf("cannot get closing timestamp from twelve data %v", err)
}
Expand Down

0 comments on commit e450d08

Please sign in to comment.