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