Historical "limit" in c#

i’m using the alpaca official nuget and it’s seem a “limit” by default of 1000 results . this work pretty well for all i need but when i want to have RSI indicator on the 15 minutes timeframe i need like 2000 results

because manu indicator need warmup period

i saw a option to change it in python but i’m dumb i can’t find it in c#

i only get 67 results wich represent the initial 1000 results / 15 .

 public static async System.Threading.Tasks.Task<object> GetHistorical_15_Minute_With_Alpaca_Async(string symbol,int days)
        {

            var client = Alpaca.Markets.Environments.Paper.GetAlpacaDataClient(new SecretKey(clsConfig.ALPACA_PUBLIC_KEY_PAPER, clsConfig.ALPACA_SECRET_KEY_PAPER));
           
            var current_bar = client.GetSnapshotAsync(symbol);
            var lastest_trade = current_bar.Result.MinuteBar.TimeUtc;

            // DAILY 
        
            var historical_bar_minute = await client.ListHistoricalBarsAsync(new HistoricalBarsRequest(symbol, lastest_trade.AddDays(-days), lastest_trade, BarTimeFrame.Minute));

            int end = historical_bar_minute.Items.Count();
            List<Quote> results = new List<Quote>();

            for (int i = 0; i < end; i += 15)
            {
                Quote x = new()
                {
                    Date = historical_bar_minute.Items[i].TimeUtc.ToLocalTime(),
                    Open = historical_bar_minute.Items[i].Open,
                    High = historical_bar_minute.Items[i].High,
                    Low = historical_bar_minute.Items[i].Low,
                    Close = historical_bar_minute.Items[i].Close,
                    Volume = historical_bar_minute.Items[i].Volume,


                };

                results.Add(x);

            }

            return results;

        }

@jeonnagroup Sorry for the delayed answer - it’s better to ask such questions on Slack (#dev-csharp and #dev-net channels) or directly on GitHub. For requesting more items in a single request you can specify alternate page size using the WithPageSize extension method. In your case code will look like this:

var historical_bar_minute = await client.ListHistoricalBarsAsync(new HistoricalBarsRequest(symbol, lastest_trade.AddDays(-days), lastest_trade, BarTimeFrame.Minute).WithPageSize(2000));

But you can request 15 minutes bars directly from API. Just use this expression instead of the BarTimeFrame.Minute in your request: new BarTimeFrame(15, BarTimeFrameUnit.Minute) - in this case server will do all aggregation for you.

1 Like

Ty buddy !! do i have to sign up to the Slack ?