py5paisa icon indicating copy to clipboard operation
py5paisa copied to clipboard

Unable to place new orders using place_orders()

Open psaigal95 opened this issue 2 years ago • 0 comments

  • 5paisa Python SDK version: 0.5.5
  • Python version: 3.8.2
  • Operating System: macOS Big Sur v11.4

Description

  1. We are unable to place new orders using client.place_orders() as mentioned in this repo README.md
  2. There is no documentation on place Intraday Limit orders using this same function. How can we do that?

What I Did

client.place_order(OrderType='S',Exchange='N',ExchangeType='D', ScripCode = 47925, Qty=50, Price=50)

This is the output I get:

 14:33:43 | 'body'
None

I modified the source code of the SDK to get a bit more detailed error:

{'Message': 'Error while processing, Please try to re-login'}
Traceback (most recent call last):
  File "poc.py", line 329, in <module>
    main()
  File "poc.py", line 312, in main
    place_test_order(client)
  File "poc.py", line 272, in place_test_order
    response = client.place_order(OrderType='S',
  File "/Users/saigal/envs/trading/lib/python3.8/site-packages/py5paisa/py5paisa.py", line 377, in place_order
    return self.order_request("OP")
  File "/Users/saigal/envs/trading/lib/python3.8/site-packages/py5paisa/py5paisa.py", line 248, in order_request
    log_response(res["body"]["Message"])
KeyError: 'body'

Can we please check this ?

psaigal95 avatar Sep 15 '22 11:09 psaigal95