Dhan APIs Order Placement & Management

If you trade with TSL You’ll typically need to makemodify and remove orders. You may often, you’ll need to split them into smaller pieces (sliced or sliced).

Here’s the function that each one accomplishes, and includes examples.

1. Place an Order — tsl.order_placement

Places an fresh order on markets (buy and sell).

Example Use Cases:

  • Purchase 75 NIFTY CALL options at Rs0.05
  • Buy 1 ACC stock for Rs.2,674
  • Create a stop-loss request for CRUDEOIL

Arguments:

  • trading symbol (str) – Name of the instrument (e.g., 'NIFTY 21 NOV 24400 CALL').
  • exchange (str) – Exchange code (NFONSEMCX, etc. ).
  • number (int) – Number of lots/units to be traded.
  • price (float) – Order price (0 for market prices).
  • trigger_price (float) – Trigger price for stop orders.
  • order_type (str) – ‘MARKET’, ‘LIMIT’, ‘STOPLIMIT’, ‘STOPMARKET’.
  • type of transaction (str) – "BUY" or SELL.
  • trade_type (str) – ‘MIS’, ‘CNC’, ‘CO’, ‘BO’.
  • (optional) disclosed_quantity Part of the order that is shown to market.
  • (optional) after_market_order True for orders made through AMO.
  • (optional) validity – "DAY" or IOC.
  • (optional) bo_profit_value – Profit target for BO orders.
  • (optional) bo_stop_loss_value Stop-loss in BO orders.

Example:

# Buy NIFTY Call Option
orderid = tsl.order_placement(
    tradingsymbol='NIFTY 21 NOV 24400 CALL',
    exchange='NFO',
    quantity=75,
    price=0.05,
    trigger_price=0,
    order_type='LIMIT',
    transaction_type='BUY',
    trade_type='MIS'
)
print(orderid)

2. Modify an Order — tsl.modify_order

Modifies the amount, price or the kind of an existing purchase.

Example Use Cases:

  • The quantity will increase between 50 and 75.
  • Price change between Rs0.05 up to Rs0.10.
  • Update trigger price.

Arguments:

  • Order_ID (str) – Order to be altered.
  • order_type (str) – ‘LIMIT’, ‘MARKET’, ‘STOPLIMIT’, ‘STOPMARKET’.
  • amount (int) – Updated quantity.
  • (optional) price – New price.
  • (optional) trigger_price – New trigger price.
  • (optional) validity – "DAY" or IOC.
  • (optional) leg_name – for BO/CO orders (ENTRY_LEG STOP_LOSS_LEG).

Example:

orderid = '12241210603927'
modified_order_id = tsl.modify_order(
    order_id=orderid,
    order_type="LIMIT",
    quantity=50,
    price=0.1
)

3. Cancel an Order — tsl.cancel_order

Cancels an order in progress.

If the purchase has been completed, it cannot be canceled.

Arguments:

  • orderID (str) – The order that is to be cancelled.

Example:

orderid = '12241210603927'
status = tsl.cancel_order(OrderID=orderid)
print(status)  # "Cancelled"

4. Cancel All Intraday Orders — tsl.cancel_all_orders

Cancels all intraday open positions and is able to square off any intraday position.

Example:

order_details = tsl.cancel_all_orders()

5. Place Sliced Orders — tsl.place_slice_order

Places an order of a significant size by breaking it up into smaller chunks to prevent the issue of liquidity or huge market impacts.

Arguments:

  • Similar to place an order However, the the quantity will be cut automatically.
  • Returns one ID when one slice is returned, list of IDs for more than one slice.

Example:

order_ids = tsl.place_slice_order(
    tradingsymbol="NIFTY 19 DEC 18000 CALL",
    exchange="NFO",
    transaction_type="BUY",
    quantity=1875,
    order_type="LIMIT",
    trade_type="MIS",
    price=0.05
)

6. Get Order Details — tsl.get_order_detail

The system captures the entire information of an order (price, quantity, status, etc. ).

Example:

orderid = '12241210603927'
details = tsl.get_order_detail(orderid=orderid)
print(details)

7. Get Order Status — tsl.get_order_status

Examine if the purchase is In ProcessCompleted Or Returned.

Example:

orderid = '12241210603927'
status = tsl.get_order_status(orderid=orderid)

8. Get Executed Price — tsl.get_executed_price

It displays the the average trade price of an order that was executed.

Example:

orderid = '12241210603927'
price = tsl.get_executed_price(orderid=orderid)

9. Get Exchange Time — tsl.get_exchange_time

The return will include the exchange time stamp for the date that the order was made.

Example:

orderid = '12241210603927'
time = tsl.get_exchange_time(orderid=orderid)

Through these features it is possible to make, modify the amount, cancel and track orders using an automated trading system by using TSL.

Your Business Potential with Our Proven Strategies

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Your Algo Trading Partner. Trade Smart, Trade Right “Trade Algo!

Company

Blog

Privacy Policy

Help

Address: Rani Bagh, Delhi – 110034

Phone: 701-153-3217

Terms And Conditions

Refund & Cancellation Policy

Subscribe Us Today

Stay Ahead in Trading – Subscribe for Updates and Insights

Address: Rani Bagh, Delhi – 110034 | Phone: 701-153-3217 | Email: [email protected]

 Copyright © 2025 – TradeHull