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 22 forks source link

get master contract by exchange #27

Closed dccgarch closed 2 years ago

dccgarch commented 2 years ago

nfo_master = sas.get_master_contract('NFO')

when i try this it is returning all contracts from CDS and nothing from FNO.

As a result sas.get_intraday_candles('NFO', instrument , 1) is returning nonetype object. Is it because NFO market is closed now? This seems weird.

dccgarch commented 2 years ago

get_instrument_for_fno(self, symbol, expiry_date, is_fut=False, strike=None, is_call=False, exchange='NFO')

I guess this method is to be used to get options contract. I guess i am getting the nomenclature wrong for options contract. Can you please give couple of examples for weekly and monthly options contracts

Thanks

algo2t commented 2 years ago

@dccgarch you better provide the code which you are using at your end while you open the issue, please clarify properly. I think there is already an example mentioned in the README, problem with many of us is that we start using the framework directly and don't read the documentation properly , sometimes we skip things and that is where the problem comes. Check the code here and the documentation here

The examples for FnO are so crystal clear for BANKNIFTY.

bn_fut = sas.get_instrument_for_fno(symbol = 'BANKNIFTY', expiry_date=datetime.date(2019, 6, 27), is_fut=True, strike=None, is_call = False)
bn_call = sas.get_instrument_for_fno(symbol = 'BANKNIFTY', expiry_date=datetime.date(2019, 6, 27), is_fut=False, strike=30000, is_call = True)
bn_put = sas.get_instrument_for_fno(symbol = 'BANKNIFTY', expiry_date=datetime.date(2019, 6, 27), is_fut=False, strike=30000, is_call = False)

Check the below ones for NIFTY which I wrote based on above example.

bn_fut = sas.get_instrument_for_fno(symbol = 'NIFTY', expiry_date=datetime.date(2021, 10, 28), is_fut=True, strike=None, is_call = False)
bn_call = sas.get_instrument_for_fno(symbol = 'NIFTY', expiry_date=datetime.date(2021, 10, 28), is_fut=False, strike=18000, is_call = True)
bn_put = sas.get_instrument_for_fno(symbol = 'NIFTY', expiry_date=datetime.date(2021, 10, 28), is_fut=False, strike=18100, is_call = False)