fix: Polymarket API offset limit crash in CopytradingEstimator
This commit is contained in:
@@ -201,7 +201,9 @@ public class CopytradingEstimator : ICopytradingEstimator
|
||||
int limit = 1000;
|
||||
int offset = 0;
|
||||
|
||||
while (true)
|
||||
while (offset <= 4000)
|
||||
{
|
||||
try
|
||||
{
|
||||
var page = await _polymarketClient.GetMarketTradesAsync(traderTrade.MarketId, limit, offset, ct);
|
||||
if (page.Count == 0) break;
|
||||
@@ -220,6 +222,11 @@ public class CopytradingEstimator : ICopytradingEstimator
|
||||
}
|
||||
offset += limit;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
break; // Offset exceeded limit or API error
|
||||
}
|
||||
}
|
||||
|
||||
var relevantTrades = tape
|
||||
.Where(t => t.Asset == traderTrade.AssetId && t.Timestamp >= windowStart && t.Timestamp <= windowEnd)
|
||||
@@ -316,7 +323,9 @@ public class CopytradingEstimator : ICopytradingEstimator
|
||||
int limit = 1000;
|
||||
int offset = 0;
|
||||
|
||||
while (true)
|
||||
while (offset <= 4000)
|
||||
{
|
||||
try
|
||||
{
|
||||
var page = await _polymarketClient.GetMarketTradesAsync(tradeEvent.MarketId, limit, offset, ct);
|
||||
if (page.Count == 0) break;
|
||||
@@ -330,6 +339,11 @@ public class CopytradingEstimator : ICopytradingEstimator
|
||||
}
|
||||
offset += limit;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
break; // Offset exceeded limit or API error
|
||||
}
|
||||
}
|
||||
|
||||
var relevantTrades = tape
|
||||
.Where(t => t.Asset == tradeEvent.AssetId && t.Timestamp >= startUnix && t.Timestamp <= endUnix)
|
||||
|
||||
Reference in New Issue
Block a user