Hello,
I am trying to place order that will square off my existing position. I get error message
{'s': 'error', 'code': -310, 'message': 'Please provide a valid order quantity', 'id': ''}
My quantity are correct. My existing position is as below
{'s': 'ok', 'code': 200, 'message': '', 'netPositions': [{'symbol': 'NSE:NIFTY2361518550PE', 'id': 'NSE:NIFTY2361518550PE-MARGIN', 'buyAvg': 7.45, 'buyQty': 750, 'buyVal': 5587.5, 'sellAvg': 0, 'sellQty': 0, 'sellVal': 0, 'netAvg': 7.45, 'netQty': 750, 'side': 1, 'qty': 750, 'productType': 'MARGIN', 'realized_profit': 0, 'crossCurrency': '', 'qtyMulti_com': 1, 'segment': '11', 'ltp': 5.25, 'fyToken': '101123061555357', 'exchange': '10', 'unrealized_profit': -1650.0000000000002, 'dayBuyQty': 750, 'cfBuyQty': 0, 'daySellQty': 0, 'cfSellQty': 0, 'rbiRefRate': 1, 'pl': -1650.0000000000002, 'slNo': 0, 'avgPrice': 0}, {'symbol': 'NSE:NIFTY2361518700PE', 'id': 'NSE:NIFTY2361518700PE-MARGIN', 'buyAvg': 0, 'buyQty': 0, 'buyVal': 0, 'sellAvg': 38.75, 'sellQty': 750, 'sellVal': 29062.5, 'netAvg': 38.75, 'netQty': -750, 'side': -1, 'qty': 750, 'productType': 'MARGIN', 'realized_profit': 0, 'crossCurrency': '', 'qtyMulti_com': 1, 'segment': '11', 'ltp': 24.3, 'fyToken': '101123061555382', 'exchange': '10', 'unrealized_profit': 10837.5, 'dayBuyQty': 0, 'cfBuyQty': 0, 'daySellQty': 750, 'cfSellQty': 0, 'rbiRefRate': 1, 'pl': 10837.5, 'slNo': 0, 'avgPrice': 0}}
Below is the code:
if len(squareOffOrd) > 0:
response = fyers.place_order(squareOffOrd)
print(response)Where squareOffOrd is:
[{'symbol': 'NSE:NIFTY2361518550PE', 'qty': 750, 'type': 2, 'side': -1, 'productType': 'MARGIN', 'limitPrice': 0, 'stopPrice': 0, 'validity': 'DAY', 'disclosedQty': 0, 'offlineOrder': 'False', 'stopLoss': 0, 'takeProfit': 0}, {'symbol': 'NSE:NIFTY2361518700PE', 'qty': 750, 'type': 2, 'side': 1, 'productType': 'MARGIN', 'limitPrice': 0, 'stopPrice': 0, 'validity': 'DAY', 'disclosedQty': 0, 'offlineOrder': 'False', 'stopLoss': 0, 'takeProfit': 0}]
pip list:
fyers-apiv2 2.0.6
Please help me resolve this issue.
Thanks.