Skip to main content

dhan_rs/types/
statements.rs

1#![allow(missing_docs)]
2//! Statement types — Ledger Report, Trade History.
3
4use serde::Deserialize;
5
6// ---------------------------------------------------------------------------
7// Ledger Entry
8// ---------------------------------------------------------------------------
9
10/// A single ledger entry from the trading account.
11///
12/// Returned by `GET /v2/ledger?from-date={}&to-date={}`.
13#[derive(Debug, Clone, Deserialize)]
14#[serde(rename_all = "camelCase")]
15pub struct LedgerEntry {
16    pub dhan_client_id: Option<String>,
17    pub narration: Option<String>,
18    pub voucherdate: Option<String>,
19    pub exchange: Option<String>,
20    pub voucherdesc: Option<String>,
21    pub vouchernumber: Option<String>,
22    pub debit: Option<String>,
23    pub credit: Option<String>,
24    pub runbal: Option<String>,
25}
26
27// ---------------------------------------------------------------------------
28// Trade History Entry
29// ---------------------------------------------------------------------------
30
31/// A single historical trade entry.
32///
33/// Returned by `GET /v2/trades/{from-date}/{to-date}/{page}`.
34#[derive(Debug, Clone, Deserialize)]
35#[serde(rename_all = "camelCase")]
36pub struct TradeHistoryEntry {
37    pub dhan_client_id: Option<String>,
38    pub order_id: Option<String>,
39    pub exchange_order_id: Option<String>,
40    pub exchange_trade_id: Option<String>,
41    pub transaction_type: Option<String>,
42    pub exchange_segment: Option<String>,
43    pub product_type: Option<String>,
44    pub order_type: Option<String>,
45    pub trading_symbol: Option<String>,
46    pub custom_symbol: Option<String>,
47    pub security_id: Option<String>,
48    #[serde(default)]
49    pub traded_quantity: Option<i64>,
50    #[serde(default)]
51    pub traded_price: Option<f64>,
52    pub isin: Option<String>,
53    pub instrument: Option<String>,
54    #[serde(default)]
55    pub sebi_tax: Option<f64>,
56    #[serde(default)]
57    pub stt: Option<f64>,
58    #[serde(default)]
59    pub brokerage_charges: Option<f64>,
60    #[serde(default)]
61    pub service_tax: Option<f64>,
62    #[serde(default)]
63    pub exchange_transaction_charges: Option<f64>,
64    #[serde(default)]
65    pub stamp_duty: Option<f64>,
66    pub create_time: Option<String>,
67    pub update_time: Option<String>,
68    pub exchange_time: Option<String>,
69    pub drv_expiry_date: Option<String>,
70    pub drv_option_type: Option<String>,
71    #[serde(default)]
72    pub drv_strike_price: Option<f64>,
73}