mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
add TradeCollector.Process() log message
This commit is contained in:
parent
885c58f77e
commit
b9616a0805
|
@ -203,9 +203,10 @@ func (e *GeneralOrderExecutor) SubmitOrders(ctx context.Context, submitOrders ..
|
||||||
orderCreateCallback := func(createdOrder types.Order) {
|
orderCreateCallback := func(createdOrder types.Order) {
|
||||||
e.orderStore.Add(createdOrder)
|
e.orderStore.Add(createdOrder)
|
||||||
e.activeMakerOrders.Add(createdOrder)
|
e.activeMakerOrders.Add(createdOrder)
|
||||||
e.tradeCollector.Process()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer e.tradeCollector.Process()
|
||||||
|
|
||||||
if e.maxRetries == 0 {
|
if e.maxRetries == 0 {
|
||||||
createdOrders, _, err := BatchPlaceOrder(ctx, e.session.Exchange, orderCreateCallback, formattedOrders...)
|
createdOrders, _, err := BatchPlaceOrder(ctx, e.session.Exchange, orderCreateCallback, formattedOrders...)
|
||||||
return createdOrders, err
|
return createdOrders, err
|
||||||
|
|
|
@ -385,9 +385,11 @@ func (session *ExchangeSession) initSymbol(ctx context.Context, environ *Environ
|
||||||
|
|
||||||
session.Trades[symbol] = &types.TradeSlice{Trades: trades}
|
session.Trades[symbol] = &types.TradeSlice{Trades: trades}
|
||||||
session.UserDataStream.OnTradeUpdate(func(trade types.Trade) {
|
session.UserDataStream.OnTradeUpdate(func(trade types.Trade) {
|
||||||
if trade.Symbol == symbol {
|
if trade.Symbol != symbol {
|
||||||
session.Trades[symbol].Append(trade)
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.Trades[symbol].Append(trade)
|
||||||
})
|
})
|
||||||
|
|
||||||
position := &types.Position{
|
position := &types.Position{
|
||||||
|
|
|
@ -529,7 +529,8 @@ var BacktestCmd = &cobra.Command{
|
||||||
profitFactor := tradeState.ProfitFactor
|
profitFactor := tradeState.ProfitFactor
|
||||||
winningRatio := tradeState.WinningRatio
|
winningRatio := tradeState.WinningRatio
|
||||||
intervalProfits := tradeState.IntervalProfits[types.Interval1d]
|
intervalProfits := tradeState.IntervalProfits[types.Interval1d]
|
||||||
symbolReport, err := createSymbolReport(userConfig, session, symbol, trades.Trades, intervalProfits, profitFactor, winningRatio)
|
|
||||||
|
symbolReport, err := createSymbolReport(userConfig, session, symbol, trades.Copy(), intervalProfits, profitFactor, winningRatio)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ func (c *TradeCollector) setDone(key types.TradeKey) {
|
||||||
// if we have the order in the order store, then the trade will be considered for the position.
|
// if we have the order in the order store, then the trade will be considered for the position.
|
||||||
// profit will also be calculated.
|
// profit will also be calculated.
|
||||||
func (c *TradeCollector) Process() bool {
|
func (c *TradeCollector) Process() bool {
|
||||||
|
logrus.Debugf("TradeCollector.Process()")
|
||||||
positionChanged := false
|
positionChanged := false
|
||||||
|
|
||||||
c.tradeStore.Filter(func(trade types.Trade) bool {
|
c.tradeStore.Filter(func(trade types.Trade) bool {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user