mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 07:26:47 +00:00
common: remove SimpleTimeFormat const for time package layout const DateTime (#1246)
* switch over to package defined const for time layout * bump appveyor playa * bumperino to latest while setting patherino * whoooops * bump VS version set GOROOT * puge build cache * Revert "puge build cache" This reverts commit 315bb578afc19529457f435e52af2172f5143bc5. * bumperino to test * purge setting of golang directory for version and allow default * purge cache state when file change * whoops * thrasher: nits * don't need to flusherino the cacherino --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
build: off
|
||||
|
||||
image: Visual Studio 2019
|
||||
image: Visual Studio 2022 # See https://www.appveyor.com/docs/build-environment/#build-worker-images
|
||||
|
||||
clone_folder: c:\gopath\src\github.com\thrasher-corp\gocryptotrader
|
||||
|
||||
@@ -36,7 +36,6 @@ services:
|
||||
|
||||
init:
|
||||
- set PATH=%POSTGRES_PATH%\bin;%PATH%
|
||||
- set PATH=C:\go119\bin;%PATH%
|
||||
|
||||
install:
|
||||
- set Path=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%Path%
|
||||
|
||||
@@ -42,12 +42,12 @@ var executeStrategyFromFileCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "starttimeoverride",
|
||||
Aliases: []string{"s"},
|
||||
Usage: fmt.Sprintf("override the strategy file's start time using your local time. eg '%v'", time.Now().Truncate(time.Hour).AddDate(0, -1, 0).Format(common.SimpleTimeFormat)),
|
||||
Usage: fmt.Sprintf("override the strategy file's start time using your local time. eg '%v'", time.Now().Truncate(time.Hour).AddDate(0, -1, 0).Format(time.DateTime)),
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "endtimeoverride",
|
||||
Aliases: []string{"e"},
|
||||
Usage: fmt.Sprintf("override the strategy file's end time using your local time. eg '%v'", time.Now().Truncate(time.Hour).Format(common.SimpleTimeFormat)),
|
||||
Usage: fmt.Sprintf("override the strategy file's end time using your local time. eg '%v'", time.Now().Truncate(time.Hour).Format(time.DateTime)),
|
||||
},
|
||||
&cli.Uint64Flag{
|
||||
Name: "intervaloverride",
|
||||
@@ -100,13 +100,13 @@ func executeStrategyFromFile(c *cli.Context) error {
|
||||
|
||||
var s, e time.Time
|
||||
if startTimeOverride != "" {
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTimeOverride, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTimeOverride, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
}
|
||||
if endTimeOverride != "" {
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTimeOverride, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTimeOverride, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/thrasher-corp/gocryptotrader/backtester/common"
|
||||
@@ -316,8 +317,8 @@ func (c *Config) PrintSetting() {
|
||||
log.Infoln(common.Config, common.CMDColours.H2+"------------------API Settings-------------------------------"+common.CMDColours.Default)
|
||||
log.Infof(common.Config, "Data type: %v", c.DataSettings.DataType)
|
||||
log.Infof(common.Config, "Interval: %v", c.DataSettings.Interval)
|
||||
log.Infof(common.Config, "Start date: %v", c.DataSettings.APIData.StartDate.Format(gctcommon.SimpleTimeFormat))
|
||||
log.Infof(common.Config, "End date: %v", c.DataSettings.APIData.EndDate.Format(gctcommon.SimpleTimeFormat))
|
||||
log.Infof(common.Config, "Start date: %v", c.DataSettings.APIData.StartDate.Format(time.DateTime))
|
||||
log.Infof(common.Config, "End date: %v", c.DataSettings.APIData.EndDate.Format(time.DateTime))
|
||||
}
|
||||
if c.DataSettings.CSVData != nil {
|
||||
log.Infoln(common.Config, common.CMDColours.H2+"------------------CSV Settings-------------------------------"+common.CMDColours.Default)
|
||||
@@ -329,7 +330,7 @@ func (c *Config) PrintSetting() {
|
||||
log.Infoln(common.Config, common.CMDColours.H2+"------------------Database Settings--------------------------"+common.CMDColours.Default)
|
||||
log.Infof(common.Config, "Data type: %v", c.DataSettings.DataType)
|
||||
log.Infof(common.Config, "Interval: %v", c.DataSettings.Interval)
|
||||
log.Infof(common.Config, "Start date: %v", c.DataSettings.DatabaseData.StartDate.Format(gctcommon.SimpleTimeFormat))
|
||||
log.Infof(common.Config, "End date: %v", c.DataSettings.DatabaseData.EndDate.Format(gctcommon.SimpleTimeFormat))
|
||||
log.Infof(common.Config, "Start date: %v", c.DataSettings.DatabaseData.StartDate.Format(time.DateTime))
|
||||
log.Infof(common.Config, "End date: %v", c.DataSettings.DatabaseData.EndDate.Format(time.DateTime))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,10 +333,10 @@ func parseAPI(reader *bufio.Reader, cfg *config.Config) error {
|
||||
var err error
|
||||
defaultStart := time.Now().Add(-time.Hour * 24 * 365)
|
||||
defaultEnd := time.Now()
|
||||
fmt.Printf("What is the start date? Leave blank for \"%v\"\n", defaultStart.Format(gctcommon.SimpleTimeFormat))
|
||||
fmt.Printf("What is the start date? Leave blank for \"%v\"\n", defaultStart.Format(time.DateTime))
|
||||
startDate = quickParse(reader)
|
||||
if startDate != "" {
|
||||
cfg.DataSettings.APIData.StartDate, err = time.Parse(gctcommon.SimpleTimeFormat, startDate)
|
||||
cfg.DataSettings.APIData.StartDate, err = time.Parse(time.DateTime, startDate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -344,10 +344,10 @@ func parseAPI(reader *bufio.Reader, cfg *config.Config) error {
|
||||
cfg.DataSettings.APIData.StartDate = defaultStart
|
||||
}
|
||||
|
||||
fmt.Printf("What is the end date? Leave blank for \"%v\"\n", defaultEnd.Format(gctcommon.SimpleTimeFormat))
|
||||
fmt.Printf("What is the end date? Leave blank for \"%v\"\n", defaultEnd.Format(time.DateTime))
|
||||
endDate = quickParse(reader)
|
||||
if endDate != "" {
|
||||
cfg.DataSettings.APIData.EndDate, err = time.Parse(gctcommon.SimpleTimeFormat, endDate)
|
||||
cfg.DataSettings.APIData.EndDate, err = time.Parse(time.DateTime, endDate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -373,10 +373,10 @@ func parseDatabase(reader *bufio.Reader, cfg *config.Config) error {
|
||||
var err error
|
||||
defaultStart := time.Now().Add(-time.Hour * 24 * 365)
|
||||
defaultEnd := time.Now()
|
||||
fmt.Printf("What is the start date? Leave blank for \"%v\"\n", defaultStart.Format(gctcommon.SimpleTimeFormat))
|
||||
fmt.Printf("What is the start date? Leave blank for \"%v\"\n", defaultStart.Format(time.DateTime))
|
||||
startDate := quickParse(reader)
|
||||
if startDate != "" {
|
||||
cfg.DataSettings.DatabaseData.StartDate, err = time.Parse(gctcommon.SimpleTimeFormat, startDate)
|
||||
cfg.DataSettings.DatabaseData.StartDate, err = time.Parse(time.DateTime, startDate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -384,9 +384,9 @@ func parseDatabase(reader *bufio.Reader, cfg *config.Config) error {
|
||||
cfg.DataSettings.DatabaseData.StartDate = defaultStart
|
||||
}
|
||||
|
||||
fmt.Printf("What is the end date? Leave blank for \"%v\"\n", defaultEnd.Format(gctcommon.SimpleTimeFormat))
|
||||
fmt.Printf("What is the end date? Leave blank for \"%v\"\n", defaultEnd.Format(time.DateTime))
|
||||
if endDate := quickParse(reader); endDate != "" {
|
||||
cfg.DataSettings.DatabaseData.EndDate, err = time.Parse(gctcommon.SimpleTimeFormat, endDate)
|
||||
cfg.DataSettings.DatabaseData.EndDate, err = time.Parse(time.DateTime, endDate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ func (s *Statistic) CreateLog(data common.Event) (string, error) {
|
||||
}
|
||||
result = fmt.Sprintf(colour+
|
||||
"%v %v%v%v| Price: %v\tDirection: %v",
|
||||
ev.GetTime().Format(gctcommon.SimpleTimeFormat),
|
||||
ev.GetTime().Format(time.DateTime),
|
||||
fSIL(ev.GetExchange(), limit12),
|
||||
fSIL(ev.GetAssetType().String(), limit10),
|
||||
fSIL(ev.Pair().String(), limit14),
|
||||
@@ -169,7 +169,7 @@ func (s *Statistic) CreateLog(data common.Event) (string, error) {
|
||||
}
|
||||
result = fmt.Sprintf(colour+
|
||||
"%v %v%v%v| Price: %v\tDirection %v\tOrder placed: Amount: %v\tFee: %v\tTotal: %v",
|
||||
ev.GetTime().Format(gctcommon.SimpleTimeFormat),
|
||||
ev.GetTime().Format(time.DateTime),
|
||||
fSIL(ev.GetExchange(), limit12),
|
||||
fSIL(ev.GetAssetType().String(), limit10),
|
||||
fSIL(ev.Pair().String(), limit14),
|
||||
@@ -183,7 +183,7 @@ func (s *Statistic) CreateLog(data common.Event) (string, error) {
|
||||
}
|
||||
case signal.Event:
|
||||
result = fmt.Sprintf("%v %v%v%v| Price: $%v",
|
||||
ev.GetTime().Format(gctcommon.SimpleTimeFormat),
|
||||
ev.GetTime().Format(time.DateTime),
|
||||
fSIL(ev.GetExchange(), limit12),
|
||||
fSIL(ev.GetAssetType().String(), limit10),
|
||||
fSIL(ev.Pair().String(), limit14),
|
||||
@@ -192,7 +192,7 @@ func (s *Statistic) CreateLog(data common.Event) (string, error) {
|
||||
result += common.CMDColours.Default
|
||||
case data2.Event:
|
||||
result = fmt.Sprintf("%v %v%v%v| Price: $%v",
|
||||
ev.GetTime().Format(gctcommon.SimpleTimeFormat),
|
||||
ev.GetTime().Format(time.DateTime),
|
||||
fSIL(ev.GetExchange(), limit12),
|
||||
fSIL(ev.GetAssetType().String(), limit10),
|
||||
fSIL(ev.Pair().String(), limit14),
|
||||
|
||||
@@ -188,7 +188,7 @@ func (s *Strategy) massageMissingData(data []decimal.Decimal, t time.Time) ([]fl
|
||||
if missingDataStreak >= s.rsiPeriod.IntPart() {
|
||||
return nil, fmt.Errorf("missing data exceeds RSI period length of %v at %s and will distort results. %w",
|
||||
s.rsiPeriod,
|
||||
t.Format(gctcommon.SimpleTimeFormat),
|
||||
t.Format(time.DateTime),
|
||||
base.ErrTooMuchBadData)
|
||||
}
|
||||
resp[i] = data[i].InexactFloat64()
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base"
|
||||
"github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal"
|
||||
"github.com/thrasher-corp/gocryptotrader/backtester/funding"
|
||||
gctcommon "github.com/thrasher-corp/gocryptotrader/common"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
||||
)
|
||||
|
||||
@@ -265,7 +264,7 @@ func (s *Strategy) massageMissingData(data []decimal.Decimal, t time.Time) ([]fl
|
||||
if missingDataStreak >= s.mfiPeriod.IntPart() {
|
||||
return nil, fmt.Errorf("missing data exceeds mfi period length of %v at %s and will distort results. %w",
|
||||
s.mfiPeriod,
|
||||
t.Format(gctcommon.SimpleTimeFormat),
|
||||
t.Format(time.DateTime),
|
||||
base.ErrTooMuchBadData)
|
||||
}
|
||||
resp[i] = data[i].InexactFloat64()
|
||||
|
||||
@@ -1097,13 +1097,13 @@ var getOrdersCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "start date, optional. Will filter any results before this date",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "end date, optional. Will filter any results after this date",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
},
|
||||
@@ -1162,11 +1162,11 @@ func getOrders(c *cli.Context) error {
|
||||
}
|
||||
}
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -2820,13 +2820,13 @@ var withdrawalRequestCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "the start date to get withdrawals from. Any withdrawal before this date will be filtered",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "the end date to get withdrawals from. Any withdrawal after this date will be filtered",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
@@ -2991,11 +2991,11 @@ func withdrawlRequestByDate(c *cli.Context) error {
|
||||
limit = limitStr
|
||||
}
|
||||
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -3327,14 +3327,14 @@ var getAuditEventCommand = &cli.Command{
|
||||
Name: "start",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "start date to search",
|
||||
Value: time.Now().Add(-time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Add(-time.Hour).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Aliases: []string{"e"},
|
||||
Usage: "end time to search",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
@@ -3382,12 +3382,12 @@ func getAuditEvent(c *cli.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -4018,13 +4018,13 @@ var getHistoricCandlesExtendedCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "the date to begin retrieveing candles. Any candles before this date will be filtered",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "the date to end retrieveing candles. Any candles after this date will be filtered",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
@@ -4133,11 +4133,11 @@ func getHistoricCandlesExtended(c *cli.Context) error {
|
||||
|
||||
candleInterval := time.Duration(candleGranularity) * time.Second
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -4210,13 +4210,13 @@ var findMissingSavedCandleIntervalsCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "<start> rounded down to the nearest hour",
|
||||
Value: time.Now().AddDate(0, -1, 0).Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "<end> rounded down to the nearest hour",
|
||||
Value: time.Now().Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
},
|
||||
@@ -4282,11 +4282,11 @@ func findMissingSavedCandleIntervals(c *cli.Context) error {
|
||||
|
||||
candleInterval := time.Duration(candleGranularity) * time.Second
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -4371,14 +4371,14 @@ var getMarginRatesHistoryCommand = &cli.Command{
|
||||
Name: "start",
|
||||
Aliases: []string{"sd"},
|
||||
Usage: "<start>",
|
||||
Value: time.Now().AddDate(0, -1, 0).Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Aliases: []string{"ed"},
|
||||
Usage: "<end>",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
@@ -4503,11 +4503,11 @@ func getMarginRatesHistory(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ var dataHistoryCommands = &cli.Command{
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "start_date",
|
||||
Usage: "formatted as: 2006-01-02 15:04:05",
|
||||
Usage: "formatted as: " + time.DateTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end_date",
|
||||
Usage: "formatted as: 2006-01-02 15:04:05",
|
||||
Usage: "formatted as: " + time.DateTime,
|
||||
},
|
||||
},
|
||||
Action: getDataHistoryJobsBetween,
|
||||
@@ -221,14 +221,14 @@ var (
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "start_date",
|
||||
Usage: "formatted as: 2006-01-02 15:04:05",
|
||||
Value: time.Now().AddDate(-1, 0, 0).Format(common.SimpleTimeFormat),
|
||||
Usage: "formatted as: " + time.DateTime,
|
||||
Value: time.Now().AddDate(-1, 0, 0).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end_date",
|
||||
Usage: "formatted as: 2006-01-02 15:04:05",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Usage: "formatted as: " + time.DateTime,
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.Uint64Flag{
|
||||
@@ -399,11 +399,11 @@ func upsertDataHistoryJob(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -544,11 +544,11 @@ func getDataHistoryJobsBetween(c *cli.Context) error {
|
||||
} else {
|
||||
endTime = c.Args().Get(1)
|
||||
}
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
@@ -122,14 +122,14 @@ var futuresCommands = &cli.Command{
|
||||
Name: "start",
|
||||
Aliases: []string{"sd"},
|
||||
Usage: "<start> rounded down to the nearest hour, ensure your starting position is within this window for accurate calculations",
|
||||
Value: time.Now().AddDate(-1, 0, 0).Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(-1, 0, 0).Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Aliases: []string{"ed"},
|
||||
Usage: "<end> rounded down to the nearest hour, ensure your last position is within this window for accurate calculations",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
@@ -237,14 +237,14 @@ var futuresCommands = &cli.Command{
|
||||
Name: "start",
|
||||
Aliases: []string{"sd"},
|
||||
Usage: "<start> rounded down to the nearest hour, ensure your starting position is within this window for accurate calculations",
|
||||
Value: time.Now().AddDate(-1, 0, 0).Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(-1, 0, 0).Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Aliases: []string{"ed"},
|
||||
Usage: "<end> rounded down to the nearest hour, ensure your last position is within this window for accurate calculations",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
@@ -583,11 +583,11 @@ func getFuturesPositions(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -774,11 +774,11 @@ func getFundingRates(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
@@ -49,13 +49,13 @@ var commonFlag = []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "the start date",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &taStartTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "the end date",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &taEndTime,
|
||||
},
|
||||
}
|
||||
@@ -296,11 +296,11 @@ func getTecnicalAnalysis(c *cli.Context, algo string) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -411,11 +411,11 @@ func getBollingerBands(c *cli.Context) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -567,11 +567,11 @@ func getMACD(c *cli.Context) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -707,11 +707,11 @@ func getCoco(c *cli.Context) error {
|
||||
taEndTime, _ = c.Value("end").(string)
|
||||
}
|
||||
|
||||
s, err := time.ParseInLocation(common.SimpleTimeFormat, taStartTime, time.Local)
|
||||
s, err := time.ParseInLocation(time.DateTime, taStartTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err := time.ParseInLocation(common.SimpleTimeFormat, taEndTime, time.Local)
|
||||
e, err := time.ParseInLocation(time.DateTime, taEndTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
@@ -81,13 +81,13 @@ var tradeCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "<start>",
|
||||
Value: time.Now().Add(-time.Hour * 6).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Add(-time.Hour * 6).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "<end> WARNING: large date ranges may take considerable time",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
},
|
||||
@@ -116,13 +116,13 @@ var tradeCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "<start>",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "<end>",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
},
|
||||
@@ -151,13 +151,13 @@ var tradeCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "<start> rounded down to the nearest hour",
|
||||
Value: time.Now().Add(-time.Hour * 24).Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Add(-time.Hour * 24).Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "<end> rounded down to the nearest hour",
|
||||
Value: time.Now().Truncate(time.Hour).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Truncate(time.Hour).Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
},
|
||||
@@ -193,13 +193,13 @@ var tradeCommand = &cli.Command{
|
||||
&cli.StringFlag{
|
||||
Name: "start",
|
||||
Usage: "<start>",
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().AddDate(0, -1, 0).Format(time.DateTime),
|
||||
Destination: &startTime,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "end",
|
||||
Usage: "<end>",
|
||||
Value: time.Now().Format(common.SimpleTimeFormat),
|
||||
Value: time.Now().Format(time.DateTime),
|
||||
Destination: &endTime,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
@@ -267,11 +267,11 @@ func findMissingSavedTradeIntervals(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -396,11 +396,11 @@ func getSavedTrades(c *cli.Context) error {
|
||||
}
|
||||
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
@@ -547,11 +547,11 @@ func getHistoricTrades(c *cli.Context) error {
|
||||
}
|
||||
}
|
||||
var s, e time.Time
|
||||
s, err = time.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", 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.ParseInLocation(common.SimpleTimeFormat, startTime, time.Local)
|
||||
s, err = time.ParseInLocation(time.DateTime, startTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for start: %v", err)
|
||||
}
|
||||
e, err = time.ParseInLocation(common.SimpleTimeFormat, endTime, time.Local)
|
||||
e, err = time.ParseInLocation(time.DateTime, endTime, time.Local)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid time format for end: %v", err)
|
||||
}
|
||||
|
||||
@@ -26,10 +26,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// SimpleTimeFormat a common, but non-implemented time format in golang
|
||||
SimpleTimeFormat = "2006-01-02 15:04:05"
|
||||
// SimpleTimeFormatWithTimezone a common, but non-implemented time format in golang
|
||||
SimpleTimeFormatWithTimezone = "2006-01-02 15:04:05 MST"
|
||||
SimpleTimeFormatWithTimezone = time.DateTime + " MST"
|
||||
// GctExt is the extension for GCT Tengo script files
|
||||
GctExt = ".gct"
|
||||
defaultTimeout = time.Second * 15
|
||||
|
||||
@@ -1015,7 +1015,7 @@ func (m *DataHistoryManager) validateCandles(job *DataHistoryJob, exch exchange.
|
||||
apiCandles.Candles[i] = can
|
||||
|
||||
if len(candleIssues) > 0 {
|
||||
candleIssues = append([]string{fmt.Sprintf("issues found at %v", can.Time.Format(common.SimpleTimeFormat))}, candleIssues...)
|
||||
candleIssues = append([]string{fmt.Sprintf("issues found at %v", can.Time.Format(time.DateTime))}, candleIssues...)
|
||||
validationIssues = append(validationIssues, candleIssues...)
|
||||
r.Status = dataHistoryStatusFailed
|
||||
apiCandles.Candles[i].ValidationIssues = strings.Join(candleIssues, ", ")
|
||||
|
||||
@@ -3921,11 +3921,11 @@ func (s *RPCServer) GetDataHistoryJobDetails(_ context.Context, r *gctrpc.GetDat
|
||||
for _, v := range result.Results {
|
||||
for i := range v {
|
||||
jobResults = append(jobResults, &gctrpc.DataHistoryJobResult{
|
||||
StartDate: v[i].IntervalStartDate.Format(common.SimpleTimeFormat),
|
||||
EndDate: v[i].IntervalEndDate.Format(common.SimpleTimeFormat),
|
||||
StartDate: v[i].IntervalStartDate.Format(time.DateTime),
|
||||
EndDate: v[i].IntervalEndDate.Format(time.DateTime),
|
||||
HasData: v[i].Status == dataHistoryStatusComplete,
|
||||
Message: v[i].Result,
|
||||
RunDate: v[i].Date.Format(common.SimpleTimeFormat),
|
||||
RunDate: v[i].Date.Format(time.DateTime),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -3941,8 +3941,8 @@ func (s *RPCServer) GetDataHistoryJobDetails(_ context.Context, r *gctrpc.GetDat
|
||||
Base: result.Pair.Base.String(),
|
||||
Quote: result.Pair.Quote.String(),
|
||||
},
|
||||
StartDate: result.StartDate.Format(common.SimpleTimeFormat),
|
||||
EndDate: result.EndDate.Format(common.SimpleTimeFormat),
|
||||
StartDate: result.StartDate.Format(time.DateTime),
|
||||
EndDate: result.EndDate.Format(time.DateTime),
|
||||
Interval: int64(result.Interval.Duration()),
|
||||
RequestSizeLimit: result.RequestSizeLimit,
|
||||
MaxRetryAttempts: result.MaxRetryAttempts,
|
||||
@@ -3979,8 +3979,8 @@ func (s *RPCServer) GetActiveDataHistoryJobs(_ context.Context, _ *gctrpc.GetInf
|
||||
Base: jobs[i].Pair.Base.String(),
|
||||
Quote: jobs[i].Pair.Quote.String(),
|
||||
},
|
||||
StartDate: jobs[i].StartDate.Format(common.SimpleTimeFormat),
|
||||
EndDate: jobs[i].EndDate.Format(common.SimpleTimeFormat),
|
||||
StartDate: jobs[i].StartDate.Format(time.DateTime),
|
||||
EndDate: jobs[i].EndDate.Format(time.DateTime),
|
||||
Interval: int64(jobs[i].Interval.Duration()),
|
||||
RequestSizeLimit: jobs[i].RequestSizeLimit,
|
||||
MaxRetryAttempts: jobs[i].MaxRetryAttempts,
|
||||
@@ -4033,8 +4033,8 @@ func (s *RPCServer) GetDataHistoryJobsBetween(_ context.Context, r *gctrpc.GetDa
|
||||
Base: jobs[i].Pair.Base.String(),
|
||||
Quote: jobs[i].Pair.Quote.String(),
|
||||
},
|
||||
StartDate: jobs[i].StartDate.Format(common.SimpleTimeFormat),
|
||||
EndDate: jobs[i].EndDate.Format(common.SimpleTimeFormat),
|
||||
StartDate: jobs[i].StartDate.Format(time.DateTime),
|
||||
EndDate: jobs[i].EndDate.Format(time.DateTime),
|
||||
Interval: int64(jobs[i].Interval.Duration()),
|
||||
RequestSizeLimit: jobs[i].RequestSizeLimit,
|
||||
MaxRetryAttempts: jobs[i].MaxRetryAttempts,
|
||||
@@ -4076,8 +4076,8 @@ func (s *RPCServer) GetDataHistoryJobSummary(_ context.Context, r *gctrpc.GetDat
|
||||
Base: job.Pair.Base.String(),
|
||||
Quote: job.Pair.Quote.String(),
|
||||
},
|
||||
StartDate: job.StartDate.Format(common.SimpleTimeFormat),
|
||||
EndDate: job.EndDate.Format(common.SimpleTimeFormat),
|
||||
StartDate: job.StartDate.Format(time.DateTime),
|
||||
EndDate: job.EndDate.Format(time.DateTime),
|
||||
Interval: int64(job.Interval.Duration()),
|
||||
Status: job.Status.String(),
|
||||
DataType: job.DataType.String(),
|
||||
|
||||
@@ -73,8 +73,7 @@ const (
|
||||
withdrawHistory = "/sapi/v1/capital/withdraw/history"
|
||||
depositAddress = "/sapi/v1/capital/deposit/address"
|
||||
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
binanceSAPITimeLayout = "2006-01-02 15:04:05"
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
)
|
||||
|
||||
// GetInterestHistory gets interest history for currency/currencies provided
|
||||
|
||||
@@ -115,23 +115,6 @@ func TestWrapperGetServerTime(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSAPITime(t *testing.T) {
|
||||
t.Parallel()
|
||||
tm, err := time.Parse(binanceSAPITimeLayout, "2021-05-27 03:56:46")
|
||||
if err != nil {
|
||||
t.Fatal(tm)
|
||||
}
|
||||
tm = tm.UTC()
|
||||
if tm.Year() != 2021 ||
|
||||
tm.Month() != 5 ||
|
||||
tm.Day() != 27 ||
|
||||
tm.Hour() != 3 ||
|
||||
tm.Minute() != 56 ||
|
||||
tm.Second() != 46 {
|
||||
t.Fatal("incorrect values")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateTicker(t *testing.T) {
|
||||
t.Parallel()
|
||||
r, err := b.UpdateTicker(context.Background(), testPairMapping, asset.Spot)
|
||||
|
||||
@@ -107,8 +107,7 @@ const (
|
||||
userAccountStream = "/api/v3/userDataStream"
|
||||
|
||||
// Other Consts
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
binanceUSAPITimeLayout = "2006-01-02 15:04:05"
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
|
||||
// recvWindowSize5000
|
||||
recvWindowSize5000 = 5000
|
||||
|
||||
@@ -502,7 +502,7 @@ func (bi *Binanceus) GetWithdrawalsHistory(ctx context.Context, c currency.Code,
|
||||
}
|
||||
resp := make([]exchange.WithdrawalHistory, len(withdrawals))
|
||||
for i := range withdrawals {
|
||||
tm, err := time.Parse(binanceUSAPITimeLayout, withdrawals[i].ApplyTime)
|
||||
tm, err := time.Parse(time.DateTime, withdrawals[i].ApplyTime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ func (b *Bithumb) GetOrders(ctx context.Context, orderID, transactionType string
|
||||
}
|
||||
|
||||
if !after.IsZero() {
|
||||
params.Set("after", after.Format(common.SimpleTimeFormat))
|
||||
params.Set("after", after.Format(time.DateTime))
|
||||
}
|
||||
|
||||
return response,
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
const (
|
||||
wsEndpoint = "wss://pubwss.bithumb.com/pub/ws"
|
||||
tickerTimeLayout = "20060102150405"
|
||||
tradeTimeLayout = "2006-01-02 15:04:05.000000"
|
||||
tradeTimeLayout = time.DateTime + ".000000"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -478,7 +478,7 @@ func (b *Bithumb) GetRecentTrades(ctx context.Context, p currency.Pair, assetTyp
|
||||
return nil, err
|
||||
}
|
||||
var t time.Time
|
||||
t, err = time.Parse(common.SimpleTimeFormat, tradeData.Data[i].TransactionDate)
|
||||
t, err = time.Parse(time.DateTime, tradeData.Data[i].TransactionDate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ func (b *Bitstamp) GetOrderInfo(ctx context.Context, orderID string, _ currency.
|
||||
Amount: o.Transactions[i].BTC,
|
||||
}
|
||||
}
|
||||
orderDate, err := time.Parse(common.SimpleTimeFormat, o.DateTime)
|
||||
orderDate, err := time.Parse(time.DateTime, o.DateTime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -613,5 +613,5 @@ func (b *BTSE) calculateTradingFee(ctx context.Context, feeBuilder *exchange.Fee
|
||||
}
|
||||
|
||||
func parseOrderTime(timeStr string) (time.Time, error) {
|
||||
return time.Parse(common.SimpleTimeFormat, timeStr)
|
||||
return time.Parse(time.DateTime, timeStr)
|
||||
}
|
||||
|
||||
@@ -580,8 +580,8 @@ func (h *IntervalRangeHolder) createDateSummaryRange(start, end time.Time, hasDa
|
||||
|
||||
return fmt.Sprintf("%s data between %s and %s",
|
||||
dataString,
|
||||
start.Format(common.SimpleTimeFormat),
|
||||
end.Format(common.SimpleTimeFormat))
|
||||
start.Format(time.DateTime),
|
||||
end.Format(time.DateTime))
|
||||
}
|
||||
|
||||
// CreateIntervalTime is a simple helper function to set the time twice
|
||||
|
||||
@@ -892,7 +892,7 @@ func (p *Poloniex) processAccountOrderLimit(notification []interface{}) error {
|
||||
}
|
||||
|
||||
var timeParse time.Time
|
||||
timeParse, err = time.Parse(common.SimpleTimeFormat, ts)
|
||||
timeParse, err = time.Parse(time.DateTime, ts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1030,7 +1030,7 @@ func (p *Poloniex) processAccountTrades(notification []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("%w time not string", errTypeAssertionFailure)
|
||||
}
|
||||
timeParse, err := time.Parse(common.SimpleTimeFormat, t)
|
||||
timeParse, err := time.Parse(time.DateTime, t)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ allTrades:
|
||||
}
|
||||
for i := range tradeData {
|
||||
var tt time.Time
|
||||
tt, err = time.Parse(common.SimpleTimeFormat, tradeData[i].Date)
|
||||
tt, err = time.Parse(time.DateTime, tradeData[i].Date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -765,7 +765,7 @@ func (p *Poloniex) GetOrderInfo(ctx context.Context, orderID string, pair curren
|
||||
return nil, err
|
||||
}
|
||||
tradeHistory.TID = trades[i].GlobalTradeID
|
||||
tradeHistory.Timestamp, err = time.Parse(common.SimpleTimeFormat, trades[i].Date)
|
||||
tradeHistory.Timestamp, err = time.Parse(time.DateTime, trades[i].Date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -801,7 +801,7 @@ func (p *Poloniex) GetOrderInfo(ctx context.Context, orderID string, pair curren
|
||||
return nil, err
|
||||
}
|
||||
|
||||
orderInfo.Date, err = time.Parse(common.SimpleTimeFormat, resp.Date)
|
||||
orderInfo.Date, err = time.Parse(time.DateTime, resp.Date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -953,7 +953,7 @@ func (p *Poloniex) GetActiveOrders(ctx context.Context, req *order.MultiOrderReq
|
||||
return nil, err
|
||||
}
|
||||
var orderDate time.Time
|
||||
orderDate, err = time.Parse(common.SimpleTimeFormat, resp.Data[key][i].Date)
|
||||
orderDate, err = time.Parse(time.DateTime, resp.Data[key][i].Date)
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys,
|
||||
"Exchange %v Func %v Order %v Could not parse date to unix with value of %v",
|
||||
@@ -1011,7 +1011,7 @@ func (p *Poloniex) GetOrderHistory(ctx context.Context, req *order.MultiOrderReq
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
orderDate, err := time.Parse(common.SimpleTimeFormat,
|
||||
orderDate, err := time.Parse(time.DateTime,
|
||||
resp.Data[key][i].Date)
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys,
|
||||
|
||||
Reference in New Issue
Block a user