backtrader2 / backtrader

Python Backtesting library for trading strategies
https://www.backtrader.com
GNU General Public License v3.0
221 stars 52 forks source link

yahoo feed fromdate #65

Closed Kiessar closed 2 years ago

Kiessar commented 3 years ago

As mentioned by borutF here: https://community.backtrader.com/topic/3917/setting-only-the-fromdate-parameter-in-yahoo-data-feed The fromdate is not taken into accont when todate is not set

  if self.p.todate is not None:
              period2 = (self.p.todate.date() - posix).total_seconds()
              urlargs.append('period2={}'.format(int(period2)))

  if self.p.todate is not None:
              period1 = (self.p.fromdate.date() - posix).total_seconds()
              urlargs.append('period1={}'.format(int(period1)))

yahoo.py