dhan_rs/api/market_quote.rs
1//! Market Quote endpoints — LTP, OHLC, Market Depth snapshots.
2
3use crate::client::DhanClient;
4use crate::error::Result;
5use crate::types::market_quote::*;
6
7impl DhanClient {
8 /// Retrieve LTP (Last Traded Price) for a list of instruments.
9 ///
10 /// Up to 1000 instruments per request (rate limit: 1 req/sec).
11 ///
12 /// **Endpoint:** `POST /v2/marketfeed/ltp`
13 pub async fn get_ltp(
14 &self,
15 instruments: &MarketQuoteRequest,
16 ) -> Result<MarketQuoteResponse<TickerData>> {
17 self.post("/v2/marketfeed/ltp", instruments).await
18 }
19
20 /// Retrieve OHLC + LTP for a list of instruments.
21 ///
22 /// Up to 1000 instruments per request (rate limit: 1 req/sec).
23 ///
24 /// **Endpoint:** `POST /v2/marketfeed/ohlc`
25 pub async fn get_ohlc(
26 &self,
27 instruments: &MarketQuoteRequest,
28 ) -> Result<MarketQuoteResponse<OhlcData>> {
29 self.post("/v2/marketfeed/ohlc", instruments).await
30 }
31
32 /// Retrieve full market depth (quote) data for a list of instruments.
33 ///
34 /// Includes depth, OHLC, OI, volume and circuit limits.
35 /// Up to 1000 instruments per request (rate limit: 1 req/sec).
36 ///
37 /// **Endpoint:** `POST /v2/marketfeed/quote`
38 pub async fn get_quote(
39 &self,
40 instruments: &MarketQuoteRequest,
41 ) -> Result<MarketQuoteResponse<QuoteData>> {
42 self.post("/v2/marketfeed/quote", instruments).await
43 }
44}