mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
use RecordPosition
This commit is contained in:
parent
322f31a56a
commit
d67b800e7e
|
@ -52,9 +52,9 @@ type Strategy struct {
|
||||||
*bbgo.Notifiability
|
*bbgo.Notifiability
|
||||||
*bbgo.Persistence
|
*bbgo.Persistence
|
||||||
|
|
||||||
Environment *bbgo.Environment
|
Environment *bbgo.Environment
|
||||||
StandardIndicatorSet *bbgo.StandardIndicatorSet
|
StandardIndicatorSet *bbgo.StandardIndicatorSet
|
||||||
Market types.Market
|
Market types.Market
|
||||||
|
|
||||||
// Symbol is the market symbol you want to trade
|
// Symbol is the market symbol you want to trade
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
|
@ -143,7 +143,7 @@ type Strategy struct {
|
||||||
bbgo.SmartStops
|
bbgo.SmartStops
|
||||||
|
|
||||||
session *bbgo.ExchangeSession
|
session *bbgo.ExchangeSession
|
||||||
book *types.StreamOrderBook
|
book *types.StreamOrderBook
|
||||||
|
|
||||||
state *State
|
state *State
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
p := s.state.Position.NewProfit(trade, profit, netProfit)
|
p := s.state.Position.NewProfit(trade, profit, netProfit)
|
||||||
p.Strategy = ID
|
p.Strategy = ID
|
||||||
p.StrategyInstanceID = instanceID
|
p.StrategyInstanceID = instanceID
|
||||||
s.Environment.RecordProfit(p)
|
s.Environment.RecordPosition(s.state.Position, trade, p)
|
||||||
|
|
||||||
s.state.ProfitStats.AddProfit(p)
|
s.state.ProfitStats.AddProfit(p)
|
||||||
s.Notify(&p)
|
s.Notify(&p)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user