Skip to content

Commit 8df040d

Browse files
committed
Fix bug in Hyperliquid orders handling
1 parent 4a0fd0d commit 8df040d

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<LangVersion>latest</LangVersion>
7-
<Version>2.13.3</Version>
7+
<Version>2.13.4</Version>
88
</PropertyGroup>
99

1010
</Project>

src/Crypto.Websocket.Extensions/Orders/Sources/HyperliquidOrderSource.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ private void HandleFill(Fill fill)
119119
private void HandleFillsSnapshot(Fill[] fills)
120120
{
121121
var orders = fills
122+
.Where(x => !ExistingOrders.ContainsKey(x.OrderId.ToString()))
122123
.Select(ConvertFill)
123124
.ToArray();
125+
if (orders.Length == 0)
126+
return;
124127
foreach (var order in orders)
125128
order.IsSnapshot = true;
126129
OrderSnapshotSubject.OnNext(orders);
@@ -190,11 +193,6 @@ private CryptoOrder ConvertFill(Fill fill)
190193
var existingPartial = _partiallyFilledOrders.GetValueOrDefault(id);
191194
var existing = existingPartial ?? existingCurrent;
192195

193-
if (existingCurrent?.OrderStatus == CryptoOrderStatus.Executed)
194-
return existingCurrent;
195-
if (existingPartial?.OrderStatus == CryptoOrderStatus.Executed)
196-
return existingPartial;
197-
198196
var price = Math.Abs(FirstNonZero(fill.Price, existing?.Price) ?? 0);
199197

200198
var currentStatus = (existing?.AmountFilledCumulative ?? 0) > (existing?.AmountOrig ?? 0) + fill.Size ? CryptoOrderStatus.PartiallyFilled : CryptoOrderStatus.Executed;

0 commit comments

Comments
 (0)