mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
xdepthmaker: replace AtomicAdd with Add
This commit is contained in:
parent
ab3579700f
commit
3048a13f0b
|
@ -148,7 +148,8 @@ func (s *CrossExchangeMarketMakingStrategy) Initialize(
|
|||
// 1) short position -> reduce short position
|
||||
// 2) short position -> increase short position
|
||||
if trade.Exchange == s.hedgeSession.ExchangeName {
|
||||
s.CoveredPosition.AtomicAdd(c)
|
||||
// TODO: make this atomic
|
||||
s.CoveredPosition = s.CoveredPosition.Add(c)
|
||||
}
|
||||
|
||||
s.ProfitStats.AddTrade(trade)
|
||||
|
@ -557,9 +558,9 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
|
|||
// if the hedge is on sell side, then we should add positive position
|
||||
switch side {
|
||||
case types.SideTypeSell:
|
||||
s.CoveredPosition.AtomicAdd(quantity)
|
||||
s.CoveredPosition = s.CoveredPosition.Add(quantity)
|
||||
case types.SideTypeBuy:
|
||||
s.CoveredPosition.AtomicAdd(quantity.Neg())
|
||||
s.CoveredPosition = s.CoveredPosition.Add(quantity.Neg())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user