Skip to content

Security

dhanhq._security

Classes

Security

Security(dhan_context)

"Constants for HTTP Responses

Attributes
OTP_SENT class-attribute instance-attribute
OTP_SENT = 'OTP sent'

CSV URL for Security ID List

Functions
edis_inquiry
edis_inquiry(isin)

Inquire about the eDIS status of the provided ISIN.

Parameters:

Name Type Description Default
isin str

The ISIN to inquire about.

required

Returns:

Name Type Description
dict

The response containing inquiry results.

fetch_security_list staticmethod
fetch_security_list(mode='compact', filename='security_id_list.csv')

Fetch CSV file from dhan based on the specified mode and save it to the current directory.

Parameters:

Name Type Description Default
mode str

The mode to fetch the CSV ('compact' or 'detailed').

'compact'
filename str

The name of the file to save the CSV as (default is 'data.csv').

'security_id_list.csv'

Returns:

Type Description

pd.DataFrame: The DataFrame containing the CSV data.

generate_tpin
generate_tpin()

Generate T-Pin on registered mobile number.

Returns:

Name Type Description
dict

The response containing the status of T-Pin generation.

open_browser_for_tpin
open_browser_for_tpin(isin, qty, exchange, segment='EQ', bulk=False)

Opens the default web browser to enter T-Pin.

Parameters:

Name Type Description Default
isin str

The ISIN of the security.

required
qty int

The quantity of the security.

required
exchange str

The exchange where the security is listed.

required
segment str

The segment of the exchange (default is 'EQ').

'EQ'
bulk bool

Flag for bulk operations (default is False).

False

Returns:

Name Type Description
dict

The response containing the status of the operation.