How do you sell cnc holdings through Fyers API? Please share sample api request.
Hi,
Please check the docs - https://myapi.fyers.in/docs/#tag/Order-Placement/paths/~1OthePlacement/get
Have the productType as CNC
Make sure to provide CDSL Authorization before selling stocks from holdings - https://myapi.fyers.in/docs/#tag/EDIS
Hi Vikram, Once i have a CNC position? How do i sell that?
- Is it using Place_order with side=-1
- Shall i call exit_positions?
@bd14338 you can call exit positions to close it
Hi Vikram,
i want to exit only one stock out of multiple holdings that i have. How do i do it ?
I executed this …
exitResponse=fyers.exit_positions(symbol)
and it closed all my open holdings. Why did this happen? Am i missing something?
@bd14338 If its single position to exit you need, you need to exit position by ID,
https://myapi.fyers.in/docs/#tag/Other-Transactions/paths/~1OtherTransactions/patch
Please go through docs.
Hi Vikram,
I understand for Positions whereby i get the ID. But i dont see ID in Holdings response.
Documentation from Position API:
"
Positions
Fetches the current open and closed positions for the current trading day. Note that previous trading day’s closed positions will not be shown here.
Response attributes - For each position
Attribute Data Type Description
symbol string Eg: NSE:SBIN-EQ
id string The unique value for each position
"
But for holdings there is no Id:
"Holdings
Fetches the equity and mutual fund holdings which the user has in this demat account. This will include T1 and demat holdings.
Request Attributes - For each holding
Attribute Data Type Description
symbol string Eg: NSE:RCOM-EQ
holdingType string Identify the type of holding
View Details
quantity int The quantity of the symbol which the user has at the beginning of the day
remainingQuantity int This reflects the quantity - the quantity sold during the day
costPrice float The original buy price of the holding
marketVal float The Market value of the current holding
ltp float LTP is the price from which the next sale of the stocks happens
fytoken string Fytoken is a unique identifier for every symbol.
View Details
exchange int The exchange in which order is placed.
View Details
"
@vikram_sri , Please help.
Dear @vikram_sri , am still unable to understand this. How do i exit partially for a given stock? Is this correct?
exitResponse=fyers.exit_positions({“Id”:symbol})
Also in documentation, at some places you have “Id” and some places you have “id”. Which one is correct?
Appreciate your relevant response here as the documentation link & “Please go through docs” is confusing.