If you need a 17 years D1 data file in CSV format for training every day, then either use dataDownload, or download it directly with http functions.

There are not many data sources that provide 17 years history. Certainly not AV or STOOQ. You might have luck with Google or Quandl. And yes, for this you must know the name of your asset by the data source. - I wonder what AI algo would use 17 years data.