mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 23:16:52 +00:00
cli: rpc time parsing (#1107)
* fix rpc time parsing * Update cmd/gctcli/helpers.go Beautifully handled Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Fixes combined commit * uses ParseInLocation, parse with timezone, remove helper functions * lint Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -1162,11 +1162,11 @@ func getOrders(c *cli.Context) error {
|
||||
}
|
||||
}
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -1190,8 +1190,8 @@ func getOrders(c *cli.Context) error {
|
||||
Base: p.Base.String(),
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -2991,11 +2991,11 @@ func withdrawlRequestByDate(c *cli.Context) error {
|
||||
limit = limitStr
|
||||
}
|
||||
|
||||
s, err := time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -3014,8 +3014,8 @@ func withdrawlRequestByDate(c *cli.Context) error {
|
||||
result, err := client.WithdrawalEventsByDate(c.Context,
|
||||
&gctrpc.WithdrawalEventsByDateRequest{
|
||||
Exchange: exchange,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
Limit: int32(limit),
|
||||
},
|
||||
)
|
||||
@@ -3382,12 +3382,12 @@ func getAuditEvent(c *cli.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
s, err := time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
|
||||
e, err := time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -3407,8 +3407,8 @@ func getAuditEvent(c *cli.Context) error {
|
||||
|
||||
result, err := client.GetAuditEvent(c.Context,
|
||||
&gctrpc.GetAuditEventRequest{
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
Limit: int32(limit),
|
||||
OrderBy: orderingDirection,
|
||||
})
|
||||
@@ -3974,8 +3974,8 @@ func getHistoricCandles(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
TimeInterval: int64(candleInterval),
|
||||
FillMissingWithTrades: fillMissingData,
|
||||
})
|
||||
@@ -4133,11 +4133,11 @@ func getHistoricCandlesExtended(c *cli.Context) error {
|
||||
|
||||
candleInterval := time.Duration(candleGranularity) * time.Second
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -4162,8 +4162,8 @@ func getHistoricCandlesExtended(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
TimeInterval: int64(candleInterval),
|
||||
ExRequest: true,
|
||||
Sync: sync,
|
||||
@@ -4282,11 +4282,11 @@ func findMissingSavedCandleIntervals(c *cli.Context) error {
|
||||
|
||||
candleInterval := time.Duration(candleGranularity) * time.Second
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -4311,8 +4311,8 @@ func findMissingSavedCandleIntervals(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
Interval: int64(candleInterval),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -4503,11 +4503,11 @@ func getMarginRatesHistory(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -4529,8 +4529,8 @@ func getMarginRatesHistory(c *cli.Context) error {
|
||||
Exchange: exchangeName,
|
||||
Asset: assetType,
|
||||
Currency: curr,
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
GetPredictedRate: getPredictedRate,
|
||||
GetLendingPayments: getLendingPayments,
|
||||
GetBorrowRates: getBorrowRates,
|
||||
|
||||
@@ -399,11 +399,11 @@ func upsertDataHistoryJob(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -504,8 +504,8 @@ func upsertDataHistoryJob(c *cli.Context) error {
|
||||
Base: p.Base.String(),
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
Interval: int64(candleInterval),
|
||||
RequestSizeLimit: int64(requestSizeLimit),
|
||||
DataType: dataType,
|
||||
@@ -544,11 +544,11 @@ func getDataHistoryJobsBetween(c *cli.Context) error {
|
||||
} else {
|
||||
endTime = c.Args().Get(1)
|
||||
}
|
||||
s, err := time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -566,8 +566,8 @@ func getDataHistoryJobsBetween(c *cli.Context) error {
|
||||
client := gctrpc.NewGoCryptoTraderServiceClient(conn)
|
||||
result, err := client.GetDataHistoryJobsBetween(c.Context,
|
||||
&gctrpc.GetDataHistoryJobsBetweenRequest{
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -583,11 +583,11 @@ func getFuturesPositions(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -612,8 +612,8 @@ func getFuturesPositions(c *cli.Context) error {
|
||||
Base: p.Base.String(),
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
Status: status,
|
||||
PositionLimit: int64(limit),
|
||||
Overwrite: overwrite,
|
||||
@@ -774,11 +774,11 @@ func getFundingRates(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -799,8 +799,8 @@ func getFundingRates(c *cli.Context) error {
|
||||
Exchange: exchangeName,
|
||||
Asset: assetType,
|
||||
Pairs: currencyPairs,
|
||||
StartDate: negateLocalOffset(s),
|
||||
EndDate: negateLocalOffset(e),
|
||||
StartDate: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
EndDate: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
IncludePredicted: includePredicted,
|
||||
IncludePayments: includePayments,
|
||||
})
|
||||
|
||||
@@ -6,11 +6,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-corp/gocryptotrader/common"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func clearScreen() error {
|
||||
@@ -34,23 +31,3 @@ func closeConn(conn *grpc.ClientConn, cancel context.CancelFunc) {
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
|
||||
// negateLocalOffset helps negate the offset of time generation
|
||||
// when the unix time gets to rpcserver, it no longer is the same time
|
||||
// that was sent as it handles it as a UTC value, even though when
|
||||
// using starttime it is generated as your local time
|
||||
// eg 2020-01-01 12:00:00 +10 will convert into
|
||||
// 2020-01-01 12:00:00 +00 when at RPCServer
|
||||
// so this function will minus the offset from the local sent time
|
||||
// to allow for proper use at RPCServer
|
||||
func negateLocalOffset(t time.Time) string {
|
||||
_, offset := time.Now().Zone()
|
||||
loc := time.FixedZone("", -offset)
|
||||
|
||||
return t.In(loc).Format(common.SimpleTimeFormat)
|
||||
}
|
||||
|
||||
func negateLocalOffsetTS(t time.Time) *timestamppb.Timestamp {
|
||||
_, offset := time.Now().Zone()
|
||||
return timestamppb.New(t.Add(time.Duration(-offset) * time.Second))
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
"github.com/thrasher-corp/gocryptotrader/gctrpc"
|
||||
"github.com/urfave/cli/v2"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -295,15 +296,14 @@ func getTecnicalAnalysis(c *cli.Context, algo string) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.Parse(common.SimpleTimeFormat, taStartTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.Parse(common.SimpleTimeFormat, taEndTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
err = common.StartEndTimeCheck(s, e)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -335,8 +335,8 @@ func getTecnicalAnalysis(c *cli.Context, algo string) error {
|
||||
AssetType: asset,
|
||||
AlgorithmType: algo,
|
||||
Interval: taGranularity * int64(time.Second),
|
||||
Start: negateLocalOffsetTS(s),
|
||||
End: negateLocalOffsetTS(e),
|
||||
Start: timestamppb.New(s),
|
||||
End: timestamppb.New(e),
|
||||
Period: taPeriod,
|
||||
}
|
||||
|
||||
@@ -411,11 +411,11 @@ func getBollingerBands(c *cli.Context) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.Parse(common.SimpleTimeFormat, taStartTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.Parse(common.SimpleTimeFormat, taEndTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -488,8 +488,8 @@ func getBollingerBands(c *cli.Context) error {
|
||||
AssetType: asset,
|
||||
AlgorithmType: "BBANDS",
|
||||
Interval: taGranularity * int64(time.Second),
|
||||
Start: negateLocalOffsetTS(s),
|
||||
End: negateLocalOffsetTS(e),
|
||||
Start: timestamppb.New(s),
|
||||
End: timestamppb.New(e),
|
||||
Period: taPeriod,
|
||||
StandardDeviationUp: taStdDevUp,
|
||||
StandardDeviationDown: taStdDevDown,
|
||||
@@ -567,11 +567,11 @@ func getMACD(c *cli.Context) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.Parse(common.SimpleTimeFormat, taStartTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.Parse(common.SimpleTimeFormat, taEndTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -629,8 +629,8 @@ func getMACD(c *cli.Context) error {
|
||||
AssetType: asset,
|
||||
AlgorithmType: "MACD",
|
||||
Interval: taGranularity * int64(time.Second),
|
||||
Start: negateLocalOffsetTS(s),
|
||||
End: negateLocalOffsetTS(e),
|
||||
Start: timestamppb.New(s),
|
||||
End: timestamppb.New(e),
|
||||
Period: taPeriod,
|
||||
SlowPeriod: taSlowPeriod,
|
||||
FastPeriod: taFastPeriod,
|
||||
@@ -707,11 +707,11 @@ func getCoco(c *cli.Context) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.Parse(common.SimpleTimeFormat, taStartTime)
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.Parse(common.SimpleTimeFormat, taEndTime)
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -781,8 +781,8 @@ func getCoco(c *cli.Context) error {
|
||||
AssetType: asset,
|
||||
AlgorithmType: "COCO",
|
||||
Interval: taGranularity * int64(time.Second),
|
||||
Start: negateLocalOffsetTS(s),
|
||||
End: negateLocalOffsetTS(e),
|
||||
Start: timestamppb.New(s),
|
||||
End: timestamppb.New(e),
|
||||
Period: taPeriod,
|
||||
OtherExchange: otherExchange,
|
||||
OtherPair: &gctrpc.CurrencyPair{Base: otherPair.Base.String(), Quote: otherPair.Quote.String()},
|
||||
|
||||
@@ -267,11 +267,11 @@ func findMissingSavedTradeIntervals(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -292,8 +292,8 @@ func findMissingSavedTradeIntervals(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -396,11 +396,11 @@ func getSavedTrades(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -425,8 +425,8 @@ func getSavedTrades(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -547,11 +547,11 @@ func getHistoricTrades(c *cli.Context) error {
|
||||
}
|
||||
}
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -577,8 +577,8 @@ func getHistoricTrades(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -685,11 +685,11 @@ func convertSavedTradesToCandles(c *cli.Context) error {
|
||||
|
||||
candleInterval := time.Duration(candleGranularity) * time.Second
|
||||
var s, e time.Time
|
||||
s, err = time.Parse(common.SimpleTimeFormat, startTime)
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.Parse(common.SimpleTimeFormat, endTime)
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -714,8 +714,8 @@ func convertSavedTradesToCandles(c *cli.Context) error {
|
||||
Quote: p.Quote.String(),
|
||||
},
|
||||
AssetType: assetType,
|
||||
Start: negateLocalOffset(s),
|
||||
End: negateLocalOffset(e),
|
||||
Start: s.Format(common.SimpleTimeFormatWithTimezone),
|
||||
End: e.Format(common.SimpleTimeFormatWithTimezone),
|
||||
TimeInterval: int64(candleInterval),
|
||||
Sync: sync,
|
||||
Force: force,
|
||||
|
||||
Reference in New Issue
Block a user