mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
xfunding: add guard condition for starting and stopping
This commit is contained in:
parent
e016892a70
commit
108bb5deeb
|
@ -620,6 +620,10 @@ func (s *Strategy) detectPremiumIndex(premiumIndex *types.PremiumIndex) (changed
|
|||
}
|
||||
|
||||
func (s *Strategy) startOpeningPosition(pt types.PositionType, t time.Time) {
|
||||
if s.positionAction == PositionOpening {
|
||||
return
|
||||
}
|
||||
|
||||
s.positionAction = PositionOpening
|
||||
s.positionType = pt
|
||||
|
||||
|
@ -630,6 +634,10 @@ func (s *Strategy) startOpeningPosition(pt types.PositionType, t time.Time) {
|
|||
}
|
||||
|
||||
func (s *Strategy) startClosingPosition() {
|
||||
if s.positionAction == PositionClosing {
|
||||
return
|
||||
}
|
||||
|
||||
s.positionAction = PositionClosing
|
||||
|
||||
// reset the transfer stats
|
||||
|
|
Loading…
Reference in New Issue
Block a user