Skip to content

Forever Order

dhanhq._forever_order

Classes

ForeverOrder

ForeverOrder(dhan_context)
Functions
cancel_forever
cancel_forever(order_id)

Delete Forever orders using the order id of an order.

get_forever
get_forever()

Retrieve a list of all existing Forever Orders.

modify_forever
modify_forever(order_id, order_flag, order_type, leg_name, quantity, price, trigger_price, disclosed_quantity, validity)

Modify a forever order based on the specified leg name. The variables that can be modified include price, quantity, order type, and validity.

Parameters:

Name Type Description Default
order_id str

The ID of the order to modify.

required
order_flag str

The order flag indicating the type of order (e.g., SINGLE, OCO).

required
order_type str

The type of order (e.g., LIMIT, MARKET).

required
leg_name str

The name of the leg to modify.

required
quantity int

The new quantity for the order.

required
price float

The new price for the order.

required
trigger_price float

The trigger price for the order.

required
disclosed_quantity int

The disclosed quantity for the order.

required
validity str

The validity of the order.

required

Returns:

Name Type Description
dict

The response containing the status of the modification.

place_forever
place_forever(security_id, exchange_segment, transaction_type, product_type, order_type, quantity, price, trigger_Price, order_flag='SINGLE', disclosed_quantity=0, validity='DAY', price1=0, trigger_Price1=0, quantity1=0, tag=None, symbol='')

Place a new forever order in the Dhan account.

Parameters:

Name Type Description Default
security_id str

The ID of the security to trade.

required
exchange_segment str

The exchange segment (e.g., NSE, BSE).

required
transaction_type str

The type of transaction (BUY/SELL).

required
product_type str

The product type (e.g., CNC, INTRA).

required
order_type str

The type of order (LIMIT, MARKET, etc.).

required
quantity int

The quantity of the order.

required
price float

The price of the order.

required
trigger_Price float

The trigger price for the order.

required
order_flag str

The order flag (default is "SINGLE").

'SINGLE'
disclosed_quantity int

The disclosed quantity for the order.

0
validity str

The validity of the order (DAY, IOC, etc.).

'DAY'
price1 float

The secondary price for the order.

0
trigger_Price1 float

The secondary trigger price for the order.

0
quantity1 int

The secondary quantity for the order.

0
tag str

Optional correlation ID for tracking.

None
symbol str

The trading symbol for the order.

''

Returns:

Name Type Description
dict

The response containing the status of the order placement.