mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
grid2: remove default profit stats
This commit is contained in:
parent
0a6261b6b9
commit
6444fd5e03
|
@ -115,9 +115,8 @@ type Strategy struct {
|
||||||
|
|
||||||
SkipSpreadCheck bool `json:"skipSpreadCheck"`
|
SkipSpreadCheck bool `json:"skipSpreadCheck"`
|
||||||
|
|
||||||
GridProfitStats *GridProfitStats `persistence:"grid_profit_stats"`
|
GridProfitStats *GridProfitStats `persistence:"grid_profit_stats"`
|
||||||
ProfitStats *types.ProfitStats `persistence:"profit_stats"`
|
Position *types.Position `persistence:"position"`
|
||||||
Position *types.Position `persistence:"position"`
|
|
||||||
|
|
||||||
grid *Grid
|
grid *Grid
|
||||||
session *bbgo.ExchangeSession
|
session *bbgo.ExchangeSession
|
||||||
|
@ -1251,10 +1250,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
||||||
s.GridProfitStats = newGridProfitStats(s.Market)
|
s.GridProfitStats = newGridProfitStats(s.Market)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.ProfitStats == nil {
|
|
||||||
s.ProfitStats = types.NewProfitStats(s.Market)
|
|
||||||
}
|
|
||||||
|
|
||||||
if s.Position == nil {
|
if s.Position == nil {
|
||||||
s.Position = types.NewPositionFromMarket(s.Market)
|
s.Position = types.NewPositionFromMarket(s.Market)
|
||||||
}
|
}
|
||||||
|
@ -1276,7 +1271,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
||||||
|
|
||||||
orderExecutor := bbgo.NewGeneralOrderExecutor(session, s.Symbol, ID, instanceID, s.Position)
|
orderExecutor := bbgo.NewGeneralOrderExecutor(session, s.Symbol, ID, instanceID, s.Position)
|
||||||
orderExecutor.BindEnvironment(s.Environment)
|
orderExecutor.BindEnvironment(s.Environment)
|
||||||
orderExecutor.BindProfitStats(s.ProfitStats)
|
|
||||||
orderExecutor.Bind()
|
orderExecutor.Bind()
|
||||||
orderExecutor.TradeCollector().OnTrade(func(trade types.Trade, _, _ fixedpoint.Value) {
|
orderExecutor.TradeCollector().OnTrade(func(trade types.Trade, _, _ fixedpoint.Value) {
|
||||||
s.GridProfitStats.AddTrade(trade)
|
s.GridProfitStats.AddTrade(trade)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user