Skip to content

Commit 5fbc6a5

Browse files
committed
Data
1 parent e5c464d commit 5fbc6a5

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Dashboard/Dashboard/Pages/Options/ShortConvexProtection.razor.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,17 @@ protected override async Task OnTradeUpdate(Instrument instrument)
155155
{
156156
var options = await GetOptions(instrument, nextDate);
157157
var (curDelta, nextDelta, sigma) = GetIndicators(positions, point);
158-
var isBuy = Price > Strike && nextPositions.Any(o => o.Operation.Instrument.Derivative.Side is OptionSideEnum.Put); // curDelta > 0 && nextDelta > 0;
159-
var isSell = Price < Strike && nextPositions.Any(o => o.Operation.Instrument.Derivative.Side is OptionSideEnum.Call); // curDelta < 0 && nextDelta < 0;
158+
var isBuy = Price > Strike && nextPositions.Any(o => o.Operation.Instrument.Derivative.Side is OptionSideEnum.Put);
159+
var isSell = Price < Strike && nextPositions.Any(o => o.Operation.Instrument.Derivative.Side is OptionSideEnum.Call);
160+
161+
if (Math.Abs((Price - Strike).Value) > 1)
162+
{
163+
//await ClosePosition(adapter, o => Equals(o?.Operation?.Instrument?.Derivative?.ExpirationDate?.Date, NextDate(point).Date));
164+
await ClosePosition(adapter);
165+
Strike = Price;
166+
isBuy = Price > Strike;
167+
isSell = Price < Strike;
168+
}
160169

161170
if (nextPositions.Count is 0 || isBuy || isSell)
162171
{

0 commit comments

Comments
 (0)