mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
grid2: add more log
This commit is contained in:
parent
df236e4342
commit
bd5e98e543
|
@ -27,9 +27,19 @@ func newProfitFixer(grid *Grid, symbol string, historyService types.ExchangeTrad
|
|||
|
||||
// Fix fixes the total quote profit of the given grid
|
||||
func (f *ProfitFixer) Fix(ctx context.Context, since, until time.Time, initialOrderID uint64, profitStats *GridProfitStats) error {
|
||||
// reset profit
|
||||
profitStats.TotalQuoteProfit = fixedpoint.Zero
|
||||
profitStats.ArbitrageCount = 0
|
||||
|
||||
defer log.Infof("profit fix is 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
|
||||
}
|
||||
*/
|
||||
|
||||
q := &batch.ClosedOrderBatchQuery{ExchangeTradeHistoryService: f.historyService}
|
||||
orderC, errC := q.Query(ctx, f.symbol, since, until, initialOrderID)
|
||||
|
||||
|
|
|
@ -82,7 +82,12 @@ func (s *Strategy) recoverByScanningTrades(ctx context.Context, session *bbgo.Ex
|
|||
|
||||
fixer := newProfitFixer(s.grid, s.Symbol, historyService)
|
||||
// set initial order ID = 0 instead of s.GridProfitStats.InitialOrderID because the order ID could be incorrect
|
||||
return fixer.Fix(ctx, since, until, 0, s.GridProfitStats)
|
||||
err := fixer.Fix(ctx, since, until, 0, s.GridProfitStats)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.logger.Infof("fixed profitStats: %#v", s.GridProfitStats)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user