Issue writing code for limit order type

so basically i wrote a code using dhan api and placed an order it worked but the code i have written buy or sell in quantity but i want to trade with flexible amount like any amount i tried but not working could i get help with this ?

Hello @Prajwal7

Welcome to Dhan Community!

You can use Live Market Feed to get current price of stock and then change your code to calculate quantity as per the amount that you want to invest in.

I use live market feed but for an example If I want to trade in adani green energy only using 1000rs but it’s stock price is something around 1800 so the code is quantity based so it will buy or sell minimum 1 quantity. I want to trade in nifty 50 equity.

@Prajwal7 as you may know, fractional shares can not be traded. In this scenario, you will have to buy the minimum quantity which is 1 share.

there isn’t any amount of restriction in equity trading i can trade using 1k or 5k in nifty 50 also but your api dont provide that it only has quantity based codes so if i want to trade in nifty 50 i will have to trade in FnO which is not best at this time because first i want to test my code with small amount what does {order_type
required string Order Type
do the api and Documentation looks incomplete to me on youtube also its not api is not explained he is teaching how to create function in python instead tell how to use the api more clearly.

tell me how to write a code to trade in nifty50 banknifty with a specific amount not quantity. i have written a code but it buy’s in quantity i dont want to trade in quantity tell me or give me a example code for the same.

its been half a month since i took api subscription i hope to atleast write a program which can do what i want it to

Hi Prajwal,
Yes, you may test your codes with FAR OTM in nifty 50 with 1k.
You can test any code you like.
I followed the very same thing while developing my code using Finnifty option.
Quantity can not be in fraction which means your have buy a specific lot size. Considering this that for any particular strike in 1000 INR you cannot purchase 0.98 lot which is not correct you have buy 1 lot. It is set by NSE itself.
If you want to know that how many lots you can purchase against 1000 then you have to do a calculation with the help of security ID where you have to calculate Strike Price * Lot size and there you will know if you can purchase a lot or not.

Lastly, as far concern with DHAN API DOCUMENTATION I found it very Helpful and clean as compared to others. Apart from it, @Dhan community is always there for assistance.

1 Like