krishnavelu / alice_blue

Official Python library for Alice Blue API trading
GNU General Public License v3.0
134 stars 82 forks source link

`prod_type` variable should be declared before using #215

Closed Jeyanthinath closed 3 years ago

Jeyanthinath commented 3 years ago

Traceback (most recent call last): File "C:\NSE\Python Script\cash_new.py", line 73, in alice.place_order( File "C:\Users\branjan3\AppData\Local\Programs\Python\Python39\lib\site-packages\alice_blue\alice_blue.py", line 536, in place_order 'product':prod_type, UnboundLocalError: local variable 'prod_type' referenced before assignment

There is a bug in the code, either you should declare the variable and default to that if nothing matches (it won't be logically correct here), or you should say order type should matches and throw an exception yourself. Can you please fix it

ref: https://github.com/krishnavelu/alice_blue/blob/master/alice_blue/alice_blue.py#L514-L539

krishnavelu commented 3 years ago

Read this before you create a new issue.

Also What was your order type? Try latest develop. something related to this is fixed in #196 but not yet released.

Jeyanthinath commented 3 years ago

The issue was in my code , I sent the empty in orderType, but instead of sdk error saying ordertype is empty or wrong , the python exception is happening.