samedi 23 février 2019

if else not working in nsepy code python fetching data from nse

startdate = datetime.date(2017,1,13)
expirydate = datetime.date(2017,1,19)
data = dict()

for x in range(0,3):
    for y in range(1,8):
        if ((startdate.weekday() !=5) or (startdate.weekday() !=6)):

            data [(x,y)] = get_history(symbol="BANKNIFTY",
                        start= startdate,
                        end= startdate,
                        index=True,
                        option_type='CE',
                        strike_price= int(df['CE Strike'][y]),
                        expiry_date=expirydate)
            startdate += datetime.timedelta(days=1)

    expirydate += datetime.timedelta(days=7)

if Day is Saturday or Sunday please don't run. That's what I was expecting from this code. but it is still including sat and sun.

Aucun commentaire:

Enregistrer un commentaire