Hitting Rate Limit on Pro MarketData

Considering I cannot partition symbols into a historical bars request; I went ahead and upgraded to Pro and sending 1 symbol at a time for my desired time window. And now I’m hitting a rate limit on requests.

Why is there a rate limit for Pro MarketData subscriptions? I thought it was unlimited calls per minute? @Alpaca

1 Like

The Pro data rate limits (or lack of) are only applicable to the v2 APIs. What API or SDK method are you using when you get the rate limit error?

client = Alpaca.Markets.Environments.Live.GetAlpacaDataClient(new SecretKey(LIVE_API_KEY, LIVE_API_SECRET));

foreach( string tradeable in lstAlpacaTradeables){

client.ListHistoricalBarsAsync(new HistoricalBarsRequest(symbol, startTime, endTime, BarTimeFrame.Minute))
}

Where startTime = DateTime.UtcNow.AddDays(-1) and endTime = DateTime.UtcNow and symbol is the symbolname

I get a response with the requested symbol-name back in the property of the response but the bars propertyis empty and some calls will return and some other calls will give a strange IThrottle exception coming from the Alpaca library itself.

Let me know…

I’m using the latest SDK from NuGet package manager

The latest ‘production’ alpaca-trade-api-csharp SDK doesn’t support the v2 data plans. Unless you have loaded SDK 5.0.1 1st alpha you are still fetching the v1 data and will be rate limited.

Could that be the issue?

OK i see, that may be the issue. I will update this and try again

Please, report this issue on GitHub and provide more information about the IThrottle exception. The AlpacaDataClient shouldn’t throttle any requests for v2 calls. And I strongly recommend you to use the LTS 4.1.2 version instead of highly experimental 5.0.x builds.

Hello, so I changed the package to SDK 5.0.1 1st alpha. And still getting this error but not on every call, some calls return symbol but the items count is empty. See below error and piece of code that triggers error:

Error :internal server error occurred
StackTrace: at Alpaca.Markets.HttpResponseMethodExtensions.DeserializeAsync[TApi,TJson](HttpResponseMessage response)
at Alpaca.Markets.HttpClientExtensions.callAndDeserializeAsync[TApi,TJson](HttpClient httpClient, HttpRequestMessage request, CancellationToken cancellationToken, IThrottler throttler)
at Alpaca.Markets.HttpClientExtensions.callAndDeserializeAsync[TApi,TJson](HttpClient httpClient, HttpMethod method, Uri endpointUri, CancellationToken cancellationToken, IThrottler throttler)

try{
var iclient = Alpaca.Markets.Environments.Live.GetAlpacaDataClient(new SecretKey(LIVE_API_KEY, LIVE_API_SECRET));

            DateTime startTime = DateTime.UtcNow.AddDays(-1);
            DateTime endTime = DateTime.UtcNow;
            
            HistoricalBarsRequest barRequest= new HistoricalBarsRequest(stub.symbolCode, startTime, endTime, BarTimeFrame.Minute);
            var unprocessed_bars = await iclient.ListHistoricalBarsAsync(barRequest);

            System.Console.WriteLine("{0}: RECV: {1} {2}", DateTime.UtcNow, unprocessed_bars.Symbol, unprocessed_bars.Items.Count);

}catch(Exception ex)
{
    System.Console.WriteLine("GetNewCandlesAsync():Error :{0} \nStackTrace: {1}", ex.Message,ex.StackTrace);
}

The 4.1.2 version also gives me same internal server error and also items count are still empty in the response.

I am having the same problem for time frame of hourly