Fix API offset limit 400 Bad Request, implement requested UI/UX improvements
This commit is contained in:
@@ -111,6 +111,16 @@ public class PolymarketApiClient
|
||||
return result ?? [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch CLOB orderbook for a given token ID.
|
||||
/// </summary>
|
||||
public async Task<OrderBookResponse?> GetOrderBookAsync(string tokenId, CancellationToken ct = default)
|
||||
{
|
||||
var url = $"/book?token_id={tokenId}";
|
||||
_logger.LogDebug("Fetching orderbook for token: {TokenId}", tokenId);
|
||||
return await ExecuteWithRetryAsync<OrderBookResponse>(_clobClient, url, "CLOB", ct);
|
||||
}
|
||||
|
||||
private async Task<T?> ExecuteWithRetryAsync<T>(HttpClient client, string url, string endpointGroup, CancellationToken ct, int attempt = 1)
|
||||
{
|
||||
await _rateLimiter.WaitAsync(PlatformType.Polymarket, ct, endpointGroup);
|
||||
|
||||
Reference in New Issue
Block a user