mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 07:26:45 +00:00
backtester: run manager (#1040)
* begins defining run management options * fleshes out concept * completes fund manager and RPC commands * coverage and improvements * adds coverage, and bad log concept * simplifies output at expense of races * removes run logging for now. tightens races. adds cov * Lints thine splints * Fixes stopping and clearing bugs * some niteroos * fix races
This commit is contained in:
@@ -286,7 +286,7 @@ func (b *Binance) batchAggregateTrades(ctx context.Context, arg *AggregatedTrade
|
||||
// cutting off trades for high activity pairs
|
||||
increment := time.Second * 10
|
||||
for start := arg.StartTime; len(resp) == 0; start = start.Add(increment) {
|
||||
if !arg.EndTime.IsZero() && !start.Before(arg.EndTime) {
|
||||
if !arg.EndTime.IsZero() && start.After(arg.EndTime) {
|
||||
// All requests returned empty
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ func (bi *Binanceus) batchAggregateTrades(ctx context.Context, arg *AggregatedTr
|
||||
increment := time.Second * 10
|
||||
for len(resp) == 0 {
|
||||
startTime = startTime.Add(increment)
|
||||
if !endTime.IsZero() && !startTime.Before(endTime) {
|
||||
if !endTime.IsZero() && startTime.After(endTime) {
|
||||
// All requests returned empty
|
||||
return nil, nil
|
||||
}
|
||||
@@ -915,10 +915,10 @@ func (bi *Binanceus) GetSubaccountTransferHistory(ctx context.Context,
|
||||
|
||||
hundredDayBefore := time.Now()
|
||||
hundredDayBefore.Sub(time.UnixMilli(int64((time.Hour * 24 * 10) / time.Millisecond)))
|
||||
if !(startTimeT.Before(hundredDayBefore)) || !startTimeT.After(time.Now()) {
|
||||
if !(startTimeT.Before(hundredDayBefore)) || startTimeT.Before(time.Now()) {
|
||||
params.Set("startTime", strconv.Itoa(int(startTime)))
|
||||
}
|
||||
if !(endTimeT.Before(hundredDayBefore)) || !endTimeT.After(time.Now()) {
|
||||
if !(endTimeT.Before(hundredDayBefore)) || endTimeT.Before(time.Now()) {
|
||||
params.Set("startTime", strconv.Itoa(int(endTime)))
|
||||
}
|
||||
return resp.Transfers, bi.SendAuthHTTPRequest(ctx,
|
||||
|
||||
@@ -415,7 +415,7 @@ func CalculateCandleDateRanges(start, end time.Time, interval Interval, limit ui
|
||||
End: CreateIntervalTime(end),
|
||||
}
|
||||
var intervalsInWholePeriod []IntervalData
|
||||
for i := start; !i.After(end) && !i.Equal(end); i = i.Add(interval.Duration()) {
|
||||
for i := start; i.Before(end) && !i.Equal(end); i = i.Add(interval.Duration()) {
|
||||
intervalsInWholePeriod = append(intervalsInWholePeriod, IntervalData{
|
||||
Start: CreateIntervalTime(i.Round(interval.Duration())),
|
||||
End: CreateIntervalTime(i.Round(interval.Duration()).Add(interval.Duration())),
|
||||
|
||||
Reference in New Issue
Block a user