Reverse engineered prompt

GitHub

Build me an official feeling Python client for the Dhan API that makes investing and trading automation simple. I want one clean library where I can log in, create and renew access tokens, check the user profile, and manage IP whitelisting. After that it should let me place, modify, cancel, and track orders, see order book and tradebook, manage holdings and positions, check funds and margins, and pull market quotes, option chains, historical candles, expired options data, and the security list.

Please also include real time market feed support over WebSocket, plus the newer stuff like conditional orders, forever orders, global stocks trading and live feed, P and L based exit, and multi leg margin calculation. Keep the API easy to use with clear examples for the most common flows, especially login and placing trades. Add tests and sensible error handling so it feels production ready.

If anything is unclear, look up the current Dhan API and Python SDK docs online and match them closely.

Have a live product UI? Try website reverse