From e450d0857cb4151e906f55d3067da15443252488 Mon Sep 17 00:00:00 2001 From: 0xfatman <0xfatman@proton.me> Date: Sun, 27 Oct 2024 05:58:03 +0000 Subject: [PATCH] fix tz --- twelve_data/client.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/twelve_data/client.go b/twelve_data/client.go index cd02374..de7b991 100644 --- a/twelve_data/client.go +++ b/twelve_data/client.go @@ -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) }