From b93ad8840a2d053cae06b15f0b122456d35c2f7f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 11 Jul 2020 15:20:50 +0200 Subject: [PATCH] Return date column unmodified --- freqtrade/rpc/api_server.py | 1 - freqtrade/rpc/rpc.py | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/freqtrade/rpc/api_server.py b/freqtrade/rpc/api_server.py index 081dcd623..b0620d6e2 100644 --- a/freqtrade/rpc/api_server.py +++ b/freqtrade/rpc/api_server.py @@ -548,7 +548,6 @@ class ApiServer(RPC): results = self._rpc_analysed_history_full(pair, timeframe, timerange) return self.rest_dump(results) - @require_login @rpc_catch_errors def _plot_config(self): diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index ef44aeee2..fa125721c 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -10,6 +10,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union import arrow from numpy import NAN, int64, mean +from pandas import DataFrame from freqtrade.configuration.timerange import TimeRange from freqtrade.constants import CANCEL_REASON @@ -656,8 +657,9 @@ class RPC: raise RPCException('Edge is not enabled.') return self._freqtrade.edge.accepted_pairs() - def _convert_dataframe_to_dict(self, pair, dataframe, last_analyzed): - dataframe['date'] = dataframe['date'].astype(int64) // 1000 // 1000 + def _convert_dataframe_to_dict(self, pair: str, dataframe: DataFrame, last_analyzed: datetime): + + dataframe.loc[:, '__date_ts'] = dataframe.loc[:, 'date'].astype(int64) // 1000 // 1000 # Move open to seperate column when signal for easy plotting if 'buy' in dataframe.columns: buy_mask = (dataframe['buy'] == 1) @@ -673,13 +675,14 @@ class RPC: 'data': dataframe.values.tolist(), 'length': len(dataframe), 'last_analyzed': last_analyzed, + 'last_analyzed_ts': int(last_analyzed.timestamp()), } def _analysed_dataframe(self, pair: str, timeframe: str, limit: int) -> Dict[str, Any]: _data, last_analyzed = self._freqtrade.dataprovider.get_analyzed_dataframe(pair, timeframe) if limit: - _data = _data.iloc[-limit:] + _data = _data.iloc[-limit:].copy() return self._convert_dataframe_to_dict(pair, _data, last_analyzed) def _rpc_analysed_history_full(self, pair: str, timeframe: str,