Skip to content

Portfolio

dhanhq._portfolio

Classes

Portfolio

Portfolio(dhan_context)
Functions
convert_position
convert_position(from_product_type, exchange_segment, position_type, security_id, convert_qty, to_product_type)

Convert Position from Intraday to Delivery or vice versa.

Parameters:

Name Type Description Default
from_product_type str

The product type to convert from (e.g., CNC).

required
exchange_segment str

The exchange segment (e.g., NSE_EQ).

required
position_type str

The type of position (e.g., LONG).

required
security_id str

The ID of the security to convert.

required
convert_qty int

The quantity to convert.

required
to_product_type str

The product type to convert to (e.g., CNC).

required

Returns:

Name Type Description
dict

The response containing the status of the conversion.

get_holdings
get_holdings()

Retrieve all holdings bought/sold in previous trading sessions.

Returns:

Name Type Description
dict

The response containing holdings data.

get_positions
get_positions()

Retrieve a list of all open positions for the day.

Returns:

Name Type Description
dict

The response containing open positions.