Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Mar 18, 2024
1 parent fc9f972 commit c99588d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion risk/_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
super().__init__(symbol, timeframe)
self.lock = asyncio.Lock()
self._position = (None, None)
self._ohlcv = deque(maxlen=55)
self._ohlcv = deque(maxlen=233)
self.config = config_service.get("position")

def pre_receive(self, event: RiskEvent):
Expand Down Expand Up @@ -95,6 +95,9 @@ async def _close_position(self, event: PositionClosed):
None if event.position.side == PositionSide.SHORT else short_position,
)

if not long_position and not short_position:
self._ohlcv.clear()

async def _handle_market_risk(self, event: NewMarketDataReceived):
async with self.lock:
self._ohlcv.append(event.ohlcv)
Expand Down

0 comments on commit c99588d

Please sign in to comment.