dhan_rs/api/option_chain.rs
1//! Option Chain endpoints — full chain data, expiry list.
2
3use crate::client::DhanClient;
4use crate::error::Result;
5use crate::types::option_chain::*;
6
7impl DhanClient {
8 /// Retrieve real-time Option Chain for a given underlying and expiry.
9 ///
10 /// Returns OI, Greeks, Volume, LTP, Best Bid/Ask and IV across all strikes.
11 ///
12 /// Rate limit: 1 unique request every 3 seconds.
13 ///
14 /// **Endpoint:** `POST /v2/optionchain`
15 pub async fn get_option_chain(&self, req: &OptionChainRequest) -> Result<OptionChainResponse> {
16 self.post("/v2/optionchain", req).await
17 }
18
19 /// Retrieve all active expiry dates for an underlying instrument.
20 ///
21 /// Rate limit: 1 unique request every 3 seconds.
22 ///
23 /// **Endpoint:** `POST /v2/optionchain/expirylist`
24 pub async fn get_expiry_list(&self, req: &ExpiryListRequest) -> Result<ExpiryListResponse> {
25 self.post("/v2/optionchain/expirylist", req).await
26 }
27}