Platform
Overview.
ThirdLeaf is a high-bandwidth trading journal engineered for the Indian market. We bridge the gap between retail execution and institutional analytics by providing automated, multi-broker synchronization.
Zerodha Kite
Connect your Kite Connect API to automate your journaling and trade analytics.
API Reference
REST endpoints and webhook structures for quants building custom dashboards.
Zerodha Kite Connect
To connect Zerodha, you must have an active Kite Connect API subscription. ThirdLeaf uses this to fetch your trades and positions securely.
- 1.Create an app in the Kite Connect dashboard.
- 2.Set Redirect URL to
https://thirdleaf.in/auth/callback. - 3.Copy your API Key and Secret into ThirdLeaf Settings.
API Costs
Zerodha charges ₹2000/month for Kite Connect. ThirdLeaf does not charge extra for the sync service.
Open Kite DashboardDhanHQ
Dhan provides a free API for all its users. This is the fastest way to get started with ThirdLeaf.
- 1.Login to
api.dhan.co. - 2.Generate a Personal Access Token (PAT).
- 3.Ensure "Orders" and "Trades" scopes are checked.
Best For Quants
Dhan offers the lowest latency for trade-to-journal sync in our ecosystem.
Fyers V3
Fyers V3 API is supported for both individual traders and business partners.
- 1.Register your app at
api-dashboard.fyers.in. - 2.Add
https://thirdleaf.in/api/v1/fyers-authas your App Redirect ID.
Note: Fyers requires a daily authentication token refresh which ThirdLeaf automates for you.
Shoonya (Finvasia)
Shoonya connectivity is handled via their standard TOTP and AppKey protocol. Ensure you have enabled TOTP in your Finvasia portal before connecting to ThirdLeaf.
PnL Calculation Logic
ThirdLeaf uses the **First-In-First-Out (FIFO)** method for calculating PnL, which is the gold standard for Indian tax compliance. This means your oldest buy positions are cleared first against your sell orders.
FIFO Example
Buy 100 Qty @ 150 (Order A)
Buy 100 Qty @ 160 (Order B)
Sell 100 Qty @ 180
ThirdLeaf will match the sell against Order A, realizing a profit of ₹3,000.
Brokerage & Charges
Most Indian brokers do not provide the exact stamp duty and STT in their real-time execution payloads. ThirdLeaf estimates these using standard SEBI charge sheets:
- - STT: 0.1% on Turnover
- - GST: 18% on Brokerage
- - Stamp Duty: 0.015% (Buy side)
Risk Ratios & Metrics
Winning isn't enough—you need to know if you're taking too much risk for every rupee earned. ThirdLeaf automates these institutional-grade calculations.
Sharpe Ratio
Measures risk-adjusted return. A ratio above 2.0 is considered excellent for retail traders using high-leverage F&O.
Sortino Ratio
Similar to Sharpe, but only penalizes downside volatility. This gives you a clearer picture of your risk in volatile markets.
Max Drawdown
The largest peak-to-trough decline in your portfolio. Critical for understanding the "emotional pain" of your strategy.
Excursion Analysis (MAE/MFE)
MAE (Max Adverse Excursion)
The maximum "pain" your trade was in before it closed. If your MAE is consistently close to your Stop Loss, you may need a wider entry or better timing.
MFE (Max Favorable Excursion)
The maximum "unrealized" profit your trade reached. High MFE with low realized PnL indicates that you are leaving too much money on the table (failing to take profits).