import pandas as pd
    import requests
    from bs4 import BeautifulSoup
    import time
    import datetime
    from datetime import date, timedelta
    # MM/DD/YYYY : time.strftime("%m/%d/%Y")
    # YYYYMMDD : time.strftime('%Y%m%d')
if datetime.datetime.now().isoweekday() == 1 : # If today is a Monday -> some dates must be minus 3 days to take the previous Friday's data
    url_DAX = 'https://www.eurexchange.com/exchange-en/market-data/statistics/market-statistics-online/100!onlineStats?viewType=4&productGroupId=13394&productId=34642&cp=&month=&year=&busDate=' + str(time.strftime('%Y%m%d') - timedelta(days=3))   #Should be minus 3 days
    df = pd.read_html(url_DAX)[0]
    df.to_csv('results_DAX_' + str(time.strftime('%Y%m%d')) + '.csv') 
    print(df)
This give me the following error :
 url_DAX = 'https://www.eurexchange.com/exchange-en/market-data/statistics/market-statistics-online/100!onlineStats?viewType=4&productGroupId=13394&productId=34642&cp=&month=&year=&busDate=' + str(time.strftime('%Y%m%d') - timedelta(days=2))  # Should be minus 2 days
TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'
I'd like to know how to write this correctly as I need to have the final date (after the minus 1, 2 or 3 days) in the following format : YYYYMMDD.
Thanks
 
     
    