py5paisa icon indicating copy to clipboard operation
py5paisa copied to clipboard

place_order() takes 1 positional argument but 2 were given

Open nageshraj opened this issue 2 years ago • 8 comments

  • 5paisa Python SDK version: 0.5.1
  • Python version: 3.7.4
  • Operating System: Windows 10

Description

I am trying to place an order via the place_order() method. But I am getting the following error :

17:38:32 | 'NoneType' object is not subscriptable 17:38:32 | 'head' 17:38:32 | 'NoneType' object is not subscriptable None Traceback (most recent call last): File "c:/Users/test/Desktop/Projects/NewProject/Code/core.py", line 38, in response = client.place_order(test_order) TypeError: place_order() takes 1 positional argument but 2 were given

My code:

from py5paisa import FivePaisaClient
from py5paisa.order import Order, OrderType, Exchange

cred={
    "APP_NAME":"YOUR APP_NAME",
    "APP_SOURCE":"YOUR APP_SOURCE",
    "USER_ID":"YOUR USER_ID",
    "PASSWORD":"YOUR PASSWORD",
    "USER_KEY":"YOUR USERKEY",
    "ENCRYPTION_KEY":"YOUR ENCRYPTION_KEY"
    }

client = FivePaisaClient(email="[email protected]", passwd="password", dob="YYYYMMDD",cred=cred)
client.login()

test_order = Order(order_type='B',exchange='B',exchange_segment='C', scripdata = 'GOLDM 03 Nov 2021_20211103', quantity=1, price=47900,is_intraday=True,IsGTCOrder=False,IsEOSOrder=True)
response = client.place_order(test_order)

nageshraj avatar Jul 07 '22 12:07 nageshraj

I am too facing the same problem !!

K-A-B-I-L-A-N avatar Jul 13 '22 09:07 K-A-B-I-L-A-N

Having same issue. @5paisa Looks like some of your new changes causing this issue in py5paisa.py file. Please fix asap

rajeshbagavathy avatar Jul 16 '22 01:07 rajeshbagavathy

Any workarounds at least?

nageshraj avatar Jul 16 '22 05:07 nageshraj

same issue facing as well when deploying the code on Google cloud, could you please help with solution

sutiwari84 avatar Jul 30 '22 16:07 sutiwari84

I am also facing same issue. 5paise has changed the way of placing an order as per new documentation.

client.place_order(OrderType='B',Exchange='N',ExchangeType='C', ScripCode = 1660, Qty=1, Price=260)

But with the above format, I am not able to make market order. If i set Price to 0 for market order, 11:04:36 | please enter valid input above error is being thrown.

5paise team, please help.

mithunpradeep avatar Aug 01 '22 05:08 mithunpradeep

Please follow latest documentation.

Now it is single instruction.

SomaKonijeti avatar Aug 02 '22 04:08 SomaKonijeti

Dear @5paisa team, please help. I'm having same issue for Bo TypeError: FivePaisaClient.bo_order() takes 1 positional argument but 2 were given

anksliv avatar Nov 16 '22 12:11 anksliv

I'm still facing the same error in 2023.....When will this problem be resolved?

kvekka avatar Feb 26 '23 14:02 kvekka