C# how to get today's (daily) candle information?

In my C# application, I want to know today’s daily candle - open, high, low , close and volume.

I know we have api for history, but it works for today’s date -1, I mean my end date should be the previous day, not the current one.

e.g. for Pacific Time - the market opens at 6:30AM and close at 1:00PM ( PT).

Now if I want to know today’s daily candle at 2:00PM (PT), which API I should use so I can get the correct details.
If I use HistoricalBarsRequest - in that if I give end date as today’s date, it doesn’t work.

thanks in advance.


Hey @mehtadharmesh!

You’ll want to use the “real-time data” side of the Market Data API instead, using a websocket connection: Real-time data - Documentation | Alpaca

If you OK with incomplete daily bar data you can use the snapshot endpoint of the Alpaca Data API v2. Corresponding .NET SDK method is IAlpacaDataClient.GetSnapshotAsync

You can find another REST URL to SDK methods mappings on this Wiki page.