Skip to content

Dhanhq

dhanhq.dhanhq

A class that has core DhanHQ APIs.

This library provides methods to manage orders, retrieve market data, and perform various trading operations through the DhanHQ API.

:copyright: (c) 2025 by Dhan. :license: see LICENSE for details.

Classes

dhanhq

dhanhq(dhan_context)

Bases: Order, ForeverOrder, Portfolio, Funds, Statement, TraderControl, Security, MarketFeed, HistoricalData, OptionChain, SuperOrder

DhanHQ Class having Core APIs

Attributes
INDEX class-attribute instance-attribute
INDEX = 'IDX_I'

Constants for Transaction Type

MTF class-attribute instance-attribute
MTF = 'MTF'

Constants for Order Type

SELL class-attribute instance-attribute
SELL = 'SELL'

Constants for Product Type

SLM class-attribute instance-attribute
SLM = 'STOP_LOSS_MARKET'

Constants for Validity

Functions
convert_to_date_time staticmethod
convert_to_date_time(epoch)

Convert EPOCH time to Python datetime object in IST.

Parameters:

Name Type Description Default
epoch int

The EPOCH time to convert.

required

Returns:

Name Type Description
datetime

Corresponding datetime object in IST.