def test_option_chain_url(self): """ 1. Underlying symbol 2. instrument (FUTSTK, OPTSTK, FUTIDX, OPTIDX) 3. expiry date (ddMMMyyyy) where dd is not padded with zero when date is single digit """ resp = option_chain_url('SBIN', 'OPTSTK', '30JAN2020') self.assertGreaterEqual(resp.text.find('Open Interest'), 0)
def get_option_chain(symbol, instrument=None, expiry=None): '''if expiry: expiry_str = "%02d%s%d"%(expiry.day, months[expiry.month][0:3].upper(), expiry.year) else: expiry_str = "-"''' option_chain_url.session.headers.update({'Referer': option_chain_referer}) r = option_chain_url(symbol, instrument, expiry)
def test_option_chain_url(self): """ 1. Underlying symbol 2. instrument (FUTSTK, OPTSTK, FUTIDX, OPTIDX) 3. expiry date (ddMMMyyyy) where dd is not padded with zero when date is single digit """ resp = option_chain_url('SBIN', 'OPTSTK', '29NOV2016') self.assertGreaterEqual(resp.text.find('Open Interest'), 0)