Repository: freqtrade/freqtrade

Issue:
Crash: Timestamp subtraction must have the same timezones or no timezones
## Describe your environment

  * Operating system: Linux
  * Freqtrade Version (docker-compose): freqtrade docker-b50d072d

## Describe the problem:

Recently I pulled new docker image and sometimes bot is crashing on data fillup. Note that I didn't do any actions with timezones or settings, it is a bug that came with the update. I'm using kraken exchage.

## Logs:
```
2020-05-26 04:21:20,354 - freqtrade.data.converter - INFO - Missing data fillup for OMG/BTC: before: 631 - after: 719
2020-05-26 04:21:20,905 - freqtrade.commands.trade_commands - ERROR - Timestamp subtraction must have the same timezones or no timezones
2020-05-26 04:21:20,905 - freqtrade.commands.trade_commands - ERROR - Fatal exception!
Traceback (most recent call last):
File "/freqtrade/freqtrade/commands/trade_commands.py"
, line 20, in start_trading

worker.run()
File "/freqtrade/freqtrade/worker.py", line 73, in run

state = self._worker(old_state=state)
  File "/freqtrade/freqtrade/worker.py", line 107, in _worker

self._throttle(func=self._process_running, throttle_
secs=self._throttle_secs)
File "/freqtrade/freqtrade/worker.py", line 128, in _t
hrottle

result = func(*args, **kwargs)
File "/freqtrade/freqtrade/worker.py", line 141, in _p
rocess_running
self.freqtrade.process()
  File "/freqtrade/freqtrade/freqtradebot.py", line 167, in process

self.enter_positions()
File "/freqtrade/freqtrade/freqtradebot.py", line 233, in enter_positions
trades_created += self.create_trade(pair)
File "/freqtrade/freqtrade/freqtradebot.py", line 416, in create_trade
(buy, sell) = self.strategy.get_signal(
File "/freqtrade/freqtrade/strategy/interface.py", line 338, in get_signal
(arrow.utcnow() - latest_date).seconds // 60
File "/usr/local/lib/python3.8/site-packages/arrow/arrow.py", line 1147, in sub
return self._datetime - other
File "pandas/_libs/tslibs/c_timestamp.pyx", line 300, in pandas._libs.tslibs.c_timestamp._Timestamp.__sub__
TypeError: Timestamp subtraction must have the same timezones or no timezones
```
Crash: Timestamp subtraction must have the same timezones or no timezones
## Describe your environment

  * Operating system: Linux
  * Freqtrade Version (docker-compose): freqtrade docker-b50d072d

## Describe the problem:

Recently I pulled new docker image and sometimes bot is crashing on data fillup. Note that I didn't do any actions with timezones or settings, it is a bug that came with the update. I'm using kraken exchage.

## Logs:
```
2020-05-26 04:21:20,354 - freqtrade.data.converter - INFO - Missing data fillup for OMG/BTC: before: 631 - after: 719
2020-05-26 04:21:20,905 - freqtrade.commands.trade_commands - ERROR - Timestamp subtraction must have the same timezones or no timezones
2020-05-26 04:21:20,905 - freqtrade.commands.trade_commands - ERROR - Fatal exception!
Traceback (most recent call last):
File "/freqtrade/freqtrade/commands/trade_commands.py"
, line 20, in start_trading

worker.run()
File "/freqtrade/freqtrade/worker.py", line 73, in run

state = self._worker(old_state=state)
  File "/freqtrade/freqtrade/worker.py", line 107, in _worker

self._throttle(func=self._process_running, throttle_
secs=self._throttle_secs)
File "/freqtrade/freqtrade/worker.py", line 128, in _t
hrottle

result = func(*args, **kwargs)
File "/freqtrade/freqtrade/worker.py", line 141, in _p
rocess_running
self.freqtrade.process()
  File "/freqtrade/freqtrade/freqtradebot.py", line 167, in process

self.enter_positions()
File "/freqtrade/freqtrade/freqtradebot.py", line 233, in enter_positions
trades_created += self.create_trade(pair)
File "/freqtrade/freqtrade/freqtradebot.py", line 416, in create_trade
(buy, sell) = self.strategy.get_signal(
File "/freqtrade/freqtrade/strategy/interface.py", line 338, in get_signal
(arrow.utcnow() - latest_date).seconds // 60
File "/usr/local/lib/python3.8/site-packages/arrow/arrow.py", line 1147, in sub
return self._datetime - other
File "pandas/_libs/tslibs/c_timestamp.pyx", line 300, in pandas._libs.tslibs.c_timestamp._Timestamp.__sub__
TypeError: Timestamp subtraction must have the same timezones or no timezones
```


Discussion:
are you running docker on a Raspberry pi?
> are you running docker on a Raspberry pi?

No, it's on manjaro desktop. 
seems I already fixed it... (have a kind of deja vu)
are you running docker on a Raspberry pi?
> are you running docker on a Raspberry pi?

No, it's on manjaro desktop. 
seems I already fixed it... (have a kind of deja vu)

Resolving patch:
diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py
--- a/freqtrade/strategy/interface.py
+++ b/freqtrade/strategy/interface.py
@@ -327,6 +327,8 @@ def get_signal(self, pair: str, interval: str, dataframe: DataFrame) -> Tuple[bo
 
         latest_date = dataframe['date'].max()
         latest = dataframe.loc[dataframe['date'] == latest_date].iloc[-1]
+        # Explicitly convert to arrow object to ensure the below comparison does not fail
+        latest_date = arrow.get(latest_date)
 
         # Check if dataframe is out of date
         interval_minutes = timeframe_to_minutes(interval)


Test patch: