mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
grid2: check profitStats.Since for the since time range
This commit is contained in:
parent
2efdee9347
commit
f1919a2b43
|
@ -31,14 +31,12 @@ func (f *ProfitFixer) Fix(parent context.Context, since, until time.Time, initia
|
|||
profitStats.TotalQuoteProfit = fixedpoint.Zero
|
||||
profitStats.ArbitrageCount = 0
|
||||
|
||||
defer log.Infof("profit fix is done")
|
||||
defer log.Infof("profitFixer: done")
|
||||
|
||||
/*
|
||||
if profitStats.Since != nil && profitStats.Since.Before(since) {
|
||||
log.Infof("profitStats.since %s is ealier than the given since %s, setting since to %s", profitStats.Since, since, profitStats.Since)
|
||||
since = *profitStats.Since
|
||||
}
|
||||
*/
|
||||
if profitStats.Since != nil && profitStats.Since.Before(since) {
|
||||
log.Infof("profitFixer: profitStats.since %s is ealier than the given since %s, setting since to %s", profitStats.Since, since, profitStats.Since)
|
||||
since = *profitStats.Since
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(parent, 15*time.Minute)
|
||||
defer cancel()
|
||||
|
@ -46,6 +44,10 @@ func (f *ProfitFixer) Fix(parent context.Context, since, until time.Time, initia
|
|||
q := &batch.ClosedOrderBatchQuery{ExchangeTradeHistoryService: f.historyService}
|
||||
orderC, errC := q.Query(ctx, f.symbol, since, until, initialOrderID)
|
||||
|
||||
defer func() {
|
||||
log.Infof("profitFixer: fixed profitStats=%#v", profitStats)
|
||||
}()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
@ -90,7 +92,6 @@ func (f *ProfitFixer) Fix(parent context.Context, since, until time.Time, initia
|
|||
profitStats.ArbitrageCount++
|
||||
|
||||
log.Debugf("profitFixer: filledSellOrder=%#v", order)
|
||||
log.Debugf("profitFixer: profitStats=%#v", profitStats)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user