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

Basket order issue for FNO.... Invalid price type #8

Open
ravi14390 opened this issue Jun 21, 2021 · 8 comments
Open

Basket order issue for FNO.... Invalid price type #8

ravi14390 opened this issue Jun 21, 2021 · 8 comments

Comments

@ravi14390
Copy link

ravi14390 commented Jun 21, 2021

Hi All,
I am not able to place basket order using "sas.place_basket_order(orders)" method. Orders are sent to exchanges but they are getting rejected with error "Invalid price type". When we check order details, "Order Type" is always blank?

sas_error
Attaching screenshot of order details.

Here is my sample code.

ins1 = sas.get_instrument_for_fno(symbol = "NIFTY", expiry_date=datetime.date(2021,6,24), is_fut=False, strike=16500, is_call= True)
ins2 = sas.get_instrument_for_fno(symbol = "NIFTY", expiry_date=datetime.date(2021,6,24), is_fut=False, strike=14500, is_call= False)
order1 = {  "instrument"        : ins1,
            "order_type"        : OrderType.Market,
            "quantity"          : 75,
            "transaction_type"  : TransactionType.Buy,
            "product_type"      : ProductType.Delivery}
order2 = {  "instrument"        : ins2,
            "order_type"        : OrderType.Market,
            "quantity"          : 75,
            "transaction_type"  : TransactionType.Buy,
            "product_type"      : ProductType.Delivery}
orders = [order1, order2]
print(sas.place_basket_order(orders))
@rojagadeesh
Copy link

I'm also facing the same issue

@algo2t
Copy link
Owner

algo2t commented Aug 5, 2021

I will check the issue at my end never tried basket order for Delivery of FnO segment. May be you can try mentioning price as 0.0.
If you are able to debug solution by yourself, do let me know I can update the same in module.
This is not official module so expect some errors.

@algo2t
Copy link
Owner

algo2t commented Aug 27, 2021

Have you checked whether this works in AliceBlue API? If yes, please report I will try to fix it here.

@algo2t
Copy link
Owner

algo2t commented Aug 27, 2021

I have tried to apply the fixes please recheck and confirm. Thanks

@ravi14390
Copy link
Author

ravi14390 commented Sep 30, 2021

I have tried to apply the fixes please recheck and confirm. Thanks

Still getting same error. Orders are getting rejected.

image

@algo2t
Copy link
Owner

algo2t commented Oct 13, 2021

Hi @ravi14390 , I tried below and it seems there is some issue in SAS platform not in the API written in this framework. I will try to analyse more and update soon.

ins1 = sas.get_instrument_for_fno(symbol = "USDINR", expiry_date=datetime.date(2021,10,14), is_fut=False, strike=75.5, is_call= True, exchange='CDS')
print(ins1)
ins2 = sas.get_instrument_for_fno(symbol = "USDINR", expiry_date=datetime.date(2021,10,14), is_fut=False, strike=75.25, is_call= False, exchange='CDS')
print(ins2)
order1 = {  "instrument"        : ins1,
            "order_type"        : OrderType.Limit,
            "quantity"          : 1,
            "price"             : 0.08,
            "transaction_type"  : TransactionType.Buy,
            "product_type"      : ProductType.Intraday}

order2 = {  "instrument"        : ins2,
            "order_type"        : OrderType.Limit,
            "quantity"          : 1,
            "price"             : 0.04,
            "transaction_type"  : TransactionType.Buy,
            "product_type"      : ProductType.Intraday}
orders = [order1, order2]
print(orders)
print(sas.place_basket_order(orders))
print(sas.get_order_history())

Instrument(exchange='CDS', token=9307, symbol='USDINR 14 OCT21 75.5 CE', name='USDINR', expiry=datetime.date(2021, 10, 14), lot_size=None)
Instrument(exchange='CDS', token=9306, symbol='USDINR 14 OCT21 75.25 PE', name='USDINR', expiry=datetime.date(2021, 10, 14), lot_size=None)
[{'instrument': Instrument(exchange='CDS', token=9307, symbol='USDINR 14 OCT21 75.5 CE', name='USDINR', expiry=datetime.date(2021, 10, 14), lot_size=None), 'order_type': <OrderType.Limit: 'LIMIT'>, 'quantity': 1, 'price': 0.08, 'transaction_type': <TransactionType.Buy: 'BUY'>, 'product_type': <ProductType.Intraday: 'I'>}, {'instrument': Instrument(exchange='CDS', token=9306, symbol='USDINR 14 OCT21 75.25 PE', name='USDINR', expiry=datetime.date(2021, 10, 14), lot_size=None), 'order_type': <OrderType.Limit: 'LIMIT'>, 'quantity': 1, 'price': 0.04, 'transaction_type': <TransactionType.Buy: 'BUY'>, 'product_type': <ProductType.Intraday: 'I'>}]
{'status': 'success', 'message': 'Order placed successfully', 'data': {}}
{'status': 'success', 'message': '', 'data': {'pending_orders': [], 'completed_orders': [{'validity': 'DAY', 'user_order_id': '1', 'trigger_price': 0.0, 'transaction_type': 'BUY', 'trading_symbol': 'USDINR21O1475.5CE', 'remaining_quantity': 1, 'rejection_reason': 'Invalid price type', 'quantity': 1, 'product': 'MIS', 'price': 0.08, 'order_type': 'LIMIT', 'order_tag': '', 'order_status': 'rejected', 'order_entry_time': 1634108490, 'oms_order_id': '211013000108478', 'nest_request_id': '1', 'lotsize': 1, 'login_id': 'RR369', 'leg_order_indicator': '', 'instrument_token': '9307', 'filled_quantity': 0, 'exchange_time': 0, 'exchange_order_id': 'NA', 'exchange': 'CDS', 'disclosed_quantity': 0, 'client_id': 'RR369', 'average_price': 0.0}, {'validity': 'DAY', 'user_order_id': '1', 'trigger_price': 0.0, 'transaction_type': 'BUY', 'trading_symbol': 'USDINR21O1475.25PE', 'remaining_quantity': 1, 'rejection_reason': 'Invalid price type', 'quantity': 1, 'product': 'MIS', 'price': 0.04, 'order_type': 'LIMIT', 'order_tag': '', 'order_status': 'rejected', 'order_entry_time': 1634108490, 'oms_order_id': '211013000108479', 'nest_request_id': '1', 'lotsize': 1, 'login_id': 'RR369', 'leg_order_indicator': '', 'instrument_token': '9306', 'filled_quantity': 0, 'exchange_time': 0, 'exchange_order_id': 'NA', 'exchange': 'CDS', 'disclosed_quantity': 0, 'client_id': 'RR369', 'average_price': 0.0}, {'validity': 'DAY', 'user_order_id': '1', 'trigger_price': 0.0, 'transaction_type': 'BUY', 'trading_symbol': 'USDINR21O1475.5CE', 'remaining_quantity': 1000, 'rejection_reason': 'RMS:Margin Exceeds,Required:80000.00, Available:465.94 for entity account-RR369 across exchange across segment across product ', 'quantity': 1000, 'product': 'MIS', 'price': 0.08, 'order_type': 'LIMIT', 'order_tag': '', 'order_status': 'rejected', 'order_entry_time': 1634108456, 'oms_order_id': '211013000108144', 'nest_request_id': '1', 'lotsize': 1, 'login_id': 'RR369', 'leg_order_indicator': '', 'instrument_token': '9307', 'filled_quantity': 0, 'exchange_time': 0, 'exchange_order_id': 'NA', 'exchange': 'CDS', 'disclosed_quantity': 0, 'client_id': 'RR369', 'average_price': 0.0}, {'validity': 'DAY', 'user_order_id': '1', 'trigger_price': 0.0, 'transaction_type': 'BUY', 'trading_symbol': 'USDINR21O1475.25PE', 'remaining_quantity': 1000, 'rejection_reason': 'RMS:Margin Exceeds,Required:40000.00, Available:465.94 for entity account-RR369 across exchange across segment across product ', 'quantity': 1000, 'product': 'MIS', 'price': 0.04, 'order_type': 'LIMIT', 'order_tag': '', 'order_status': 'rejected', 'order_entry_time': 1634108456, 'oms_order_id': '211013000108145', 'nest_request_id': '1', 'lotsize': 1, 'login_id': 'RR369', 'leg_order_indicator': '', 'instrument_token': '9306', 'filled_quantity': 0, 'exchange_time': 0, 'exchange_order_id': 'NA', 'exchange': 'CDS', 'disclosed_quantity': 0, 'client_id': 'RR369', 'average_price': 0.0}]}}
PS D:\trading_st

@algo2t algo2t closed this as completed Oct 13, 2021
@algo2t algo2t reopened this Oct 13, 2021
@ronaldpaul
Copy link

I am also facing this issue. Specifying the price as 0 in int or float doesn't resolve the issue. Looks like F&O basket order always throws the error 'Invalid price type'. Thanks.

@sseshank
Copy link

Any workaround for this.. send each order one by one ?

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

5 participants