mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
xfunding: customize netural position profit
This commit is contained in:
parent
f4a35132e8
commit
e5d2db0f72
|
@ -876,11 +876,12 @@ func (s *Strategy) allocateOrderExecutor(ctx context.Context, session *bbgo.Exch
|
|||
bbgo.Sync(ctx, s)
|
||||
})
|
||||
orderExecutor.TradeCollector().OnTrade(func(trade types.Trade, _ fixedpoint.Value, _ fixedpoint.Value) {
|
||||
s.ProfitStats.AddTrade(trade)
|
||||
|
||||
if profit, netProfit, madeProfit := s.NeutralPosition.AddTrade(trade); madeProfit {
|
||||
_ = profit
|
||||
_ = netProfit
|
||||
p := s.NeutralPosition.NewProfit(trade, profit, netProfit)
|
||||
s.ProfitStats.AddProfit(p)
|
||||
}
|
||||
})
|
||||
orderExecutor.BindProfitStats(s.ProfitStats.ProfitStats)
|
||||
return orderExecutor
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user