algo2t / alphatrade

Python APIs for SAS Online Alpha Trade Web platform for creating algo trading using python
https://algo2t.github.io/alphatrade
MIT License
44 stars 23 forks source link

how to give NFO Orders ? #48

Closed shubhvashishth closed 1 year ago

shubhvashishth commented 1 year ago

print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print( sas.place_order(transaction_type = TransactionType.Sell, instrument = sas.get_instrument_by_symbol('NFO', 'BANKNIFTY2311241600PE'), quantity = 1, order_type = OrderType.Market, product_type = ProductType.Delivery, price = 0.0, trigger_price = None, stop_loss = None, square_off = None, trailing_sl = None, is_amo = False) )

The above code should have placed the order but instead its saying instrument not found. Am I doing it wrong or its flawed?

nevatia commented 1 year ago

Try like this instrument = sas.get_instrument_by_symbol('NFO', 'BANKNIFTY 19 JAN23 41600.0 PE'), OR instrument = sas.get_instrument_for_fno(symbol = 'BANKNIFTY', expiry_date=datetime.date(2023, 1, 19), is_fut=False, strike=41600, is_call = False)

algo2t commented 1 year ago

Close this issue @nevatia method works fine