Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPError: {"data":{},"error_code":44000,"message":"order_side can't be blank","status":"error"} #68

Open
vikashpissey opened this issue May 27, 2024 · 1 comment

Comments

@vikashpissey
Copy link

sas.place_order(transaction_type=TransactionType.Buy,
#instrument=sas.get_instrument_by_symbol(n_call.exchange,n_call.symbol),
instrument=sas.get_instrument_by_symbol('NFO', 'BANKNIFTY MAY 49300.0 CE'),
quantity=15,
order_type=OrderType.StopLossLimit,
product_type=ProductType.BracketOrder,
price=float(400),
trigger_price=float(400),
stop_loss=float(380),
square_off=float(420),
trailing_sl=None,
is_amo=False)
##########################################################
Traceback (most recent call last):

File C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels[py3compat.py:356](https://py3compat.py:356/) in compat_exec
exec(code, globals, locals)

File c:\users\vikash.spyder-py3\bank[untitled4.py:43](https://untitled4.py:43/)
sas.place_order(transaction_type=TransactionType.Buy,

File C:\ProgramData\Anaconda3\lib\site-packages\alphatrade[alphatrade.py:687](https://alphatrade.py:687/) in place_order
return self.__api_call_helper(helper, Requests.POST, None, order)

File C:\ProgramData\Anaconda3\lib\site-packages\alphatrade[alphatrade.py:1086](https://alphatrade.py:1086/) in __api_call_helper
raise requests.HTTPError(response.text)

HTTPError: {"data":{},"error_code":44000,"message":"product can't be blank","status":"error"}

@coolprafulpl
Copy link

open alphatrade.py find and replace all transaction_type with order_side

and change this code

order = {'exchange': instrument.exchange,
         'order_type': order_type.value,
         'instrument_token': instrument.token,
         'quantity': quantity,
         'disclosed_quantity': 0,
         'price': price,
         'transaction_type': transaction_type.value,
         'trigger_price': trigger_price,
         'validity': 'DAY',
         'product': prod_type,
         'source': 'web',
         'order_tag': order_tag}

with this

order = {'exchange': instrument.exchange,
         'order_type': order_type.value,
         'instrument_token': instrument.token,
         'quantity': quantity,
         'disclosed_quantity': 0,
         'price': price,
         'order_side': order_side.value,
         'trigger_price': trigger_price,
         'validity': 'DAY',
         'product': prod_type,
         "device": 'web',
         "market_protection_percentage":0,
         "user_order_id": order_tag}

and in

def place_order(self, order_side, instrument, quantity, order_type,
product_type, price=0.0, trigger_price=None,
stop_loss=None, square_off=None, trailing_sl=None,
is_amo=False,
order_tag=10001):
change order_tag value instead of 'python' to numbers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants